/* Hadith Section - Matching Site Design */

/* Page Back Button */
.page-back-button {
    position: fixed;
    top: 90px;
    left: 20px;
    z-index: 999;
}

.page-back-button .back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: white;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.page-back-button .back-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.page-back-button .back-btn i {
    font-size: 1.1rem;
}

/* Page Header - Consistent with other pages */
.hadith-page-header {
    background: linear-gradient(135deg, #0f3d2f, #2e7d32);
    padding-top: 100px;
}

/* Books Grid Section */
.content-section {
    padding: 80px 0;
    background-color: var(--bg-light);
}

.section-header {
    text-align: center;
    margin-bottom: 50px;
}

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-top: 40px;
}

.book-card {
    background: var(--white);
    border-radius: 15px;
    padding: 35px;
    text-align: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(46, 125, 50, 0.15);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(46, 125, 50, 0.08);
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.05), rgba(201, 162, 39, 0.05));
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
}

.book-card:hover::before {
    opacity: 1;
}

.book-card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 15px 40px rgba(46, 125, 50, 0.2);
    border-color: #2e7d32;
}

.book-icon {
    font-size: 4rem;
    color: #2e7d32;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    transition: all 0.4s ease;
}

.book-card:hover .book-icon {
    transform: scale(1.15) rotate(5deg);
    color: #c9a227;
}

.book-title {
    font-family: 'Amiri', serif;
    font-size: 1.8rem;
    color: var(--text-dark);
    margin-bottom: 10px;
    font-weight: 700;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.book-card:hover .book-title {
    color: #2e7d32;
}

.book-info {
    color: var(--text-light);
    font-size: 0.95rem;
    position: relative;
    z-index: 1;
    transition: color 0.3s ease;
}

.book-card:hover .book-info {
    color: var(--primary-color);
}

.book-card-disabled {
    opacity: 0.55;
    cursor: not-allowed;
    box-shadow: none;
}

.book-card-disabled:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(25, 103, 210, 0.1);
}

/* Chapters Section */
.chapters-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 30px;
}

.chapter-item {
    background: var(--white);
    padding: 20px 25px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-right: 4px solid #2e7d32;
    box-shadow: 0 2px 10px rgba(46, 125, 50, 0.08);
    display: flex;
    align-items: center;
    gap: 15px;
}

.chapter-number {
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
}

.chapter-name {
    flex: 1;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: var(--text-dark);
    font-weight: 500;
}

.chapter-item:hover {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.08), rgba(201, 162, 39, 0.05));
    transform: translateX(-10px);
    box-shadow: 0 8px 20px rgba(46, 125, 50, 0.2);
    border-right-color: #c9a227;
}

.chapter-item:hover .chapter-number {
    background: linear-gradient(135deg, #c9a227, #9e7b1b);
    transform: scale(1.1);
}

/* Hadith Display Section */
.hadith-container {
    margin-top: 30px;
}

.hadith-card {
    background: var(--white);
    border-radius: 15px;
    padding: 35px;
    margin-bottom: 25px;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.08);
    position: relative;
    border-left: 5px solid #2e7d32;
    transition: all 0.3s ease;
}

.hadith-card::before {
    content: '﴾';
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 3rem;
    color: #c9a227;
    opacity: 0.12;
    font-family: serif;
}

.hadith-card::after {
    content: '﴿';
    position: absolute;
    bottom: 15px;
    left: 20px;
    font-size: 3rem;
    color: #c9a227;
    opacity: 0.12;
    font-family: serif;
}

.hadith-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(46, 125, 50, 0.15);
    border-left-color: #c9a227;
}

.hadith-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid rgba(46, 125, 50, 0.15);
}

.hadith-number {
    display: inline-block;
    background: linear-gradient(135deg, rgba(25, 103, 210, 0.1), rgba(76, 175, 80, 0.1));
    padding: 8px 16px;
    border-radius: 20px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.95rem;
    font-family: 'Cairo', sans-serif;
}

.hadith-text {
    font-family: 'Amiri', serif;
    font-size: 1.5rem;
    line-height: 2.2;
    color: #1b5e20;
    margin: 25px 0;
    text-align: justify;
    position: relative;
    z-index: 1;
}

.hadith-footer {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 2px solid rgba(46, 125, 50, 0.15);
}

.hadith-grade,
.hadith-narrator {
    background: linear-gradient(135deg, rgba(46, 125, 50, 0.08), rgba(201, 162, 39, 0.05));
    padding: 12px 20px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-family: 'Cairo', sans-serif;
    font-size: 0.95rem;
    border-right: 3px solid #2e7d32;
}

.hadith-grade strong,
.hadith-narrator strong {
    color: #2e7d32;
    margin-left: 5px;
}

/* Back Button */
.back-btn {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border: none;
    color: var(--white);
    padding: 12px 25px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 30px;
    font-family: 'Cairo', sans-serif;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(25, 103, 210, 0.2);
}

.back-btn:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(25, 103, 210, 0.3);
    background: linear-gradient(135deg, var(--gold), #b8932b);
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 60px;
    background: var(--white);
    border-radius: 15px;
    margin: 40px auto;
    max-width: 400px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(25, 103, 210, 0.1);
    border-top-color: var(--primary-color);
    border-right-color: var(--gold);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-spinner p {
    font-family: 'Cairo', sans-serif;
    color: var(--text-light);
    font-size: 1.1rem;
}

/* No Hadiths Message */
.no-hadiths {
    text-align: center;
    padding: 60px 30px;
    color: var(--text-light);
    font-family: 'Cairo', sans-serif;
    font-size: 1.2rem;
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

/* Responsive Design - Extreme Mobile Optimization */
@media (max-width: 1024px) {
    .books-grid {
        grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    }

    .chapters-list {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    }

    .hadith-text {
        font-size: 1.3rem;
        line-height: 2;
    }
}

@media (max-width: 768px) {
    .page-back-button {
        top: 70px;
        left: 10px;
    }
    
    .page-back-button .back-btn {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    
    .page-back-button .back-btn span {
        display: none;
    }
    
    .page-back-button .back-btn i {
        margin: 0;
    }
    
    .content-section {
        padding: 50px 15px;
    }
    
    .container {
        padding: 0 15px;
    }

    .books-grid {
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 20px;
    }

    .book-card {
        padding: 25px 20px;
    }

    .book-icon {
        font-size: 3rem;
    }

    .book-title {
        font-size: 1.5rem;
    }
    
    .search-form {
        flex-direction: column;
    }
    
    .search-input {
        width: 100%;
    }
    
    .search-btn {
        width: 100%;
    }

    .hadith-text {
        font-size: 1.3rem;
        line-height: 2.1;
        padding: 20px;
    }

    .hadith-card {
        padding: 25px;
    }

    .chapters-list {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .chapter-card {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .page-back-button {
        top: 65px;
        left: 8px;
    }
    
    .page-back-button .back-btn {
        padding: 8px 12px;
        border-radius: 20px;
    }
    
    .content-section {
        padding: 40px 10px;
    }
    
    .section-header {
        margin-bottom: 30px;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .books-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .book-card {
        padding: 20px 15px;
    }
    
    .book-icon {
        font-size: 2.5rem;
        margin-bottom: 15px;
    }
    
    .book-title {
        font-size: 1.3rem;
    }
    
    .book-info {
        font-size: 0.85rem;
    }
    
    .search-form {
        margin-bottom: 20px;
    }
    
    .search-input {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .search-btn {
        padding: 12px 15px;
        font-size: 0.95rem;
    }
    
    .hadith-card {
        padding: 20px 15px;
        margin: 0 -5px;
    }
    
    .hadith-number {
        font-size: 0.85rem;
        padding: 6px 12px;
    }
    
    .hadith-text {
        font-size: 1.15rem;
        line-height: 2;
        padding: 15px;
    }
    
    .hadith-meta {
        font-size: 0.85rem;
        padding: 12px 15px;
    }
    
    .chapters-list {
        gap: 12px;
    }
    
    .chapter-card {
        padding: 15px;
    }
    
    .chapter-title {
        font-size: 1.1rem;
    }
}

@media (max-width: 360px) {
    .section-title {
        font-size: 1.5rem;
    }
    
    .book-title {
        font-size: 1.2rem;
    }
    
    .hadith-text {
        font-size: 1.05rem;
        line-height: 1.95;
    }
}

    .back-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .book-card {
        padding: 20px;
    }

    .book-icon {
        font-size: 2.5rem;
    }

    .book-title {
        font-size: 1.3rem;
    }

    .hadith-text {
        font-size: 1.1rem;
    }

    .hadith-card {
        padding: 20px;
    }

    .chapter-item {
        padding: 15px 20px;
    }
}
