/* Base Styles */
:root {
    --gold: #D4AF37;
    --sufi-green: #0A5C36;
    --light-beige: #F8F1E5;
    --arabic-gold: #C19A6B;
    --sufi-blue: #1E3A8A;
}

/* Layout Structure */
.main-xassida-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 15px;
    position: relative;
    z-index: 1;
}

.container {
    width: 100%;
    padding-right: 15px;
    padding-left: 15px;
    margin-right: auto;
    margin-left: auto;
}

@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
}

@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
}

@media (min-width: 1200px) {
    .container {
        max-width: 1140px;
    }
}

/* Background */
.xassida-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('{% static "front/images/sufi-pattern.png" %}');
    background-size: cover;
    opacity: 0.03;
    z-index: -1;
}

.poem-overlay {
    position: absolute;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, transparent 20%, #f5f5f5 70%);
}

/* Breadcrumb */
.sufi-breadcrumb {
    position: relative;
    padding: 1rem;
    margin: 1rem 0;
    background-color: rgba(10, 92, 54, 0.8);
    border-radius: 5px;
    overflow: hidden;
}

.pattern-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('{% static "front/images/sufi-pattern.png" %}');
    opacity: 0.1;
}

.breadcrumb {
    background: transparent;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
}

.breadcrumb-item {
    font-size: 0.9rem;
}

.breadcrumb-item a {
    color: var(--light-beige);
    text-decoration: none;
}

.breadcrumb-item.active {
    color: var(--gold);
}

/* Section Header */
.section-header {
    text-align: center;
    margin: 2rem 0;
    padding: 1rem 0;
}

.arabic-calligraphy {
    font-size: 3rem;
    font-family: 'Traditional Arabic', 'Amiri', 'Arial', sans-serif;
    color: var(--arabic-gold);
    margin-bottom: -1rem;
    line-height: 1;
}

@media (min-width: 768px) {
    .arabic-calligraphy {
        font-size: 4rem;
        margin-bottom: -1.5rem;
    }
}

.section-title {
    font-size: 1.8rem;
    color: var(--sufi-green);
    margin: 1rem 0 0.5rem;
    position: relative;
    display: inline-block;
}

@media (min-width: 768px) {
    .section-title {
        font-size: 2.5rem;
    }
}

.section-title:after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 3px;
    background: var(--gold);
}

.section-subtitle {
    font-style: italic;
    color: #666;
    max-width: 100%;
    margin: 0 auto;
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (min-width: 576px) {
    .section-subtitle {
        max-width: 80%;
        font-size: 1rem;
    }
}

@media (min-width: 768px) {
    .section-subtitle {
        max-width: 600px;
    }
}

/* Xassida Grid */
.xassida-grid-container {
    margin: 2rem 0;
}

.xassida-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 1.5rem;
    padding: 1rem 0;
}

@media (min-width: 400px) {
    .xassida-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    }
}

@media (min-width: 576px) {
    .xassida-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 2rem;
    }
}

@media (min-width: 768px) {
    .xassida-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

@media (min-width: 992px) {
    .xassida-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}

.xassida-book {
    position: relative;
    height: 280px;
    perspective: 1000px;
    cursor: pointer;
    transition: all 0.3s ease;
}

@media (min-width: 576px) {
    .xassida-book {
        height: 320px;
    }
}

@media (min-width: 768px) {
    .xassida-book {
        height: 350px;
    }
}

.xassida-book:hover {
    transform: translateY(-5px);
}

.book-cover {
    position: absolute;
    width: 100%;
    height: 90%;
    background: linear-gradient(135deg, var(--sufi-blue) 0%, var(--sufi-green) 100%);
    border-radius: 5px 5px 0 0;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    transform-style: preserve-3d;
    transform: rotateY(0deg);
    transition: all 0.5s ease;
    z-index: 2;
    overflow: hidden;
}

@media (min-width: 768px) {
    .xassida-book:hover .book-cover {
        transform: rotateY(-10deg);
        box-shadow: -10px 10px 25px rgba(0,0,0,0.15);
    }
}

.cover-design {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.sufi-pattern {
    position: absolute;
    width: 100%;
    height: 100%;
    background: url('{% static "front/images/xassida-pattern.png" %}');
    opacity: 0.2;
    background-size: cover;
}

.title-box {
    position: absolute;
    bottom: 15px;
    left: 0;
    width: 100%;
    padding: 0.8rem;
    text-align: center;
    background: rgba(0,0,0,0.5);
}

.poem-name {
    display: block;
    font-size: 1.2rem;
    /* color: var(--gold); */
    color: green;
    font-weight: bold;
    margin-bottom: 0.2rem;
}

@media (min-width: 576px) {
    .poem-name {
        font-size: 1.3rem;
    }
}

@media (min-width: 768px) {
    .poem-name {
        font-size: 1.5rem;
    }
}

.author-name {
    display: block;
    font-size: 0.85rem;
    color: white;
}

@media (min-width: 576px) {
    .author-name {
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    .author-name {
        font-size: 1rem;
    }
}

.gold-border {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--gold);
    border-radius: 5px;
    pointer-events: none;
    opacity: 0.5;
}

.book-spine {
    position: absolute;
    left: -8px;
    top: 15px;
    width: 16px;
    height: 82%;
    background: linear-gradient(to right, #2b1b0a 0%, #4a3a20 100%);
    transform: rotateY(90deg);
    transform-origin: left center;
    z-index: 1;
    border-radius: 3px 0 0 3px;
}

@media (min-width: 768px) {
    .book-spine {
        left: -10px;
        width: 20px;
        height: 85%;
    }
}

.spine-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    color: var(--gold);
    font-family: 'Arial', sans-serif;
    font-size: 0.8rem;
    white-space: nowrap;
}

@media (min-width: 768px) {
    .spine-text {
        font-size: 1rem;
    }
}

.book-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 3;
}

.xassida-book:hover .book-actions {
    opacity: 1;
}

.read-btn, .download-btn {
    flex: 1;
    padding: 0.7rem;
    text-align: center;
    color: white;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s ease;
    font-size: 0.8rem;
}

@media (min-width: 576px) {
    .read-btn, .download-btn {
        padding: 0.8rem;
        font-size: 0.9rem;
    }
}

.read-btn {
    background: var(--sufi-green);
    border-radius: 0 0 0 5px;
}

.download-btn {
    background: var(--gold);
    border-radius: 0 0 5px 0;
}

.read-btn:hover, .download-btn:hover {
    filter: brightness(1.1);
}

.book-decoration {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
}

.decoration-circle {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    margin-bottom: 5px;
    opacity: 0.7;
}

@media (min-width: 768px) {
    .decoration-circle {
        width: 10px;
        height: 10px;
    }
}

/* Pagination */
.sufi-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 2rem 0;
    padding: 0.8rem;
    background-color: white;
    border-radius: 50px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
    flex-wrap: wrap;
}

.page-btn {
    padding: 0.5rem 1rem;
    margin: 0.3rem;
    border: none;
    background: var(--sufi-green);
    color: white;
    border-radius: 50px;
    text-decoration: none;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    font-size: 0.85rem;
}

@media (min-width: 576px) {
    .page-btn {
        padding: 0.5rem 1.5rem;
        margin: 0 0.5rem;
        font-size: 1rem;
    }
}

.page-btn:hover {
    background: var(--gold);
    color: #333;
}

.page-numbers {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.page-number, .current-page {
    width: 35px;
    height: 35px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0.2rem;
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

@media (min-width: 576px) {
    .page-number, .current-page {
        width: 40px;
        height: 40px;
        margin: 0 5px;
    }
}

.page-number {
    background: #f0f0f0;
    color: #333;
}

.page-number:hover {
    background: var(--gold);
    color: white;
}

.current-page {
    background: var(--sufi-green);
    color: white;
    font-weight: bold;
}

.btn-text {
    display: none;
}

@media (min-width: 576px) {
    .btn-text {
        display: inline;
    }
}

/* Quote Display */
.quote-display {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1) 0%, rgba(10, 92, 54, 0.1) 100%);
    padding: 1.5rem;
    border-radius: 10px;
    margin: 2rem 0;
    border: 1px solid rgba(212, 175, 55, 0.3);
}

@media (min-width: 768px) {
    .quote-display {
        padding: 2rem;
        margin: 3rem 0;
    }
}

.quote-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.quote-arabic {
    font-size: 1.5rem;
    font-family: 'Traditional Arabic', 'Amiri', 'Arial', sans-serif;
    color: var(--sufi-green);
    margin-bottom: 1rem;
    line-height: 1.6;
    direction: rtl;
}

@media (min-width: 768px) {
    .quote-arabic {
        font-size: 2rem;
    }
}

.quote-translation {
    font-size: 1rem;
    color: #555;
    margin-bottom: 0.5rem;
    font-style: italic;
    line-height: 1.5;
}

@media (min-width: 768px) {
    .quote-translation {
        font-size: 1.2rem;
    }
}

.quote-reference {
    font-size: 0.9rem;
    color: var(--gold);
    font-weight: bold;
}

/* Audio Player */
.xassida-player-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    padding: 10px;
    z-index: 100;
}

.xassida-player {
    background: white;
    border-radius: 50px;
    padding: 0.8rem 1.2rem;
    box-shadow: 0 -5px 20px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.5s ease;
    max-width: 95%;
}

.xassida-player.show {
    transform: translateY(0);
    opacity: 1;
}

.play-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold);
    color: white;
    border: none;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-right: 0.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.play-btn:hover {
    transform: scale(1.1);
}

.player-info {
    line-height: 1.3;
    overflow: hidden;
}

.poem-name {
    font-size: 0.85rem;
    font-weight: bold;
    color: var(--sufi-green);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.reciter-name {
    font-size: 0.75rem;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

@media (min-width: 400px) {
    .xassida-player {
        padding: 0.8rem 1.5rem;
    }
    
    .poem-name {
        font-size: 0.9rem;
        
    }
    
    .reciter-name {
        font-size: 0.8rem;
    }
}

/* Performance optimizations for mobile */
@media (max-width: 576px) {
    .book-spine {
        display: none;
    }
    
    .xassida-book:hover .book-cover {
        transform: none;
    }
    
    .quote-arabic {
        font-size: 1.3rem;
    }
    
    .book-decoration {
        top: 15px;
        right: 15px;
    }
}