/* ========================================
   Vālmīki Rāmāyaṇa Reader Styles
   Verse display, glossary, and reading interface
   ======================================== */

/* Reader Controls */
.reader-controls {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-light);
}

.controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.control-label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.control-select,
.control-input {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Noto Serif', serif;
    background: var(--surface-color);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.control-select:focus,
.control-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(185, 28, 28, 0.1);
}

.control-button {
    padding: 0.75rem 1.5rem;
    background: var(--primary-color);
    color: var(--text-inverse);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
}

.control-button:hover {
    background: transparent;
    color: var(--primary-color);
    transform: translateY(-2px);
}

.control-button:active {
    transform: translateY(0);
}

/* ========================================
   VERSE DISPLAY
   ======================================== */

.verse-list {
    margin-top: 2rem;
}

.verse {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-light);
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.verse::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.verse:hover {
    box-shadow: var(--shadow-medium);
    border-color: var(--secondary-color);
}

.verse:hover::before {
    opacity: 1;
}

/* Verse Header */
.verse-header {
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 1rem;
    margin-bottom: 1.5rem;
}

.meta {
    font-size: 1rem;
    color: var(--primary-color);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.meta a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s;
}

.meta a:hover {
    color: var(--secondary-color);
    text-decoration: underline;
}

.meta i {
    color: var(--secondary-color);
}

/* Verse Sections */
.verse-section {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    border-radius: 8px;
    background: var(--surface-color);
}

.verse-section:nth-child(even) {
    background: var(--background-color);
}

.verse-label {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.verse-label i {
    color: var(--secondary-color);
}

/* Sanskrit Text */
.sanskrit {
    font-size: 1.6rem;
    line-height: 2;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 0;
    word-spacing: 0.2rem;
}

/* Glossary Tokens */
.gloss {
    cursor: pointer;
    border-bottom: 2px dotted var(--secondary-color);
    transition: all 0.2s ease;
    padding: 0 2px;
    border-radius: 2px;
}

.gloss:hover {
    background: var(--border-light);
    border-bottom-style: solid;
    color: var(--primary-color);
}

/* Anvaya (Word Order) */
.anvaya {
    background: var(--border-light);
    padding: 1.25rem;
    margin: 1rem 0;
    font-style: italic;
    border-left: 4px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.anvaya strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Translation */
.translation {
    background: var(--card-background);
    padding: 1.25rem;
    margin-top: 1rem;
    border-left: 4px solid var(--accent-color);
    border-radius: 4px;
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-primary);
}

.translation strong {
    color: var(--primary-color);
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.translation div {
    margin-bottom: 0.75rem;
}

.translation div:last-child {
    margin-bottom: 0;
}

/* ========================================
   GLOSSARY MODAL
   ======================================== */

#glossary-modal {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-color);
    z-index: 2000;
    backdrop-filter: blur(4px);
    padding: 1rem;
    overflow-y: auto;
}

.modal-content {
    background: var(--card-background);
    max-width: 600px;
    margin: 5% auto;
    padding: 2rem;
    border-radius: 16px;
    box-shadow: var(--shadow-heavy);
    border: 2px solid var(--border-color);
    position: relative;
}

#modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    color: var(--text-primary);
    transition: all 0.3s ease;
}

#modal-close:hover {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
    transform: rotate(90deg);
}

.modal-content h3 {
    font-family: 'Playfair Display', serif;
    font-size: 1.8rem;
    color: var(--primary-color);
    margin-bottom: 1.5rem;
    padding-right: 3rem;
}

#modal-body {
    font-size: 1rem;
    line-height: 1.7;
}

#modal-body p {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: 8px;
}

#modal-body strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* ========================================
   VERSE NAVIGATION
   ======================================== */

.verse-navigation {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.verse-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: var(--primary-color);
    color: var(--text-inverse);
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--primary-color);
    cursor: pointer;
    font-size: 1rem;
    flex: 1;
    justify-content: center;
    min-width: 150px;
}

.verse-nav-btn:hover:not(:disabled) {
    background: transparent;
    color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.verse-nav-btn:disabled {
    background: var(--border-color);
    color: var(--text-muted);
    cursor: not-allowed;
    transform: none;
    border-color: var(--border-color);
    opacity: 0.6;
}

.verse-nav-btn i {
    font-size: 0.9rem;
}

/* ========================================
   SEARCH RESULTS
   ======================================== */

.search-results-header {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.search-results-header h2 {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    color: var(--primary-color);
    margin: 0;
}

.search-query {
    color: var(--secondary-color);
    font-style: italic;
}

.no-results {
    text-align: center;
    padding: 3rem;
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    color: var(--text-muted);
}

.no-results i {
    font-size: 3rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ========================================
   GLOSSARY PAGE
   ======================================== */

.glossary-container {
    max-width: 1200px;
    margin: 0 auto;
}

.alphabet-nav {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
}

.alphabet-letter {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
}

.alphabet-letter:hover,
.alphabet-letter.active {
    background: var(--primary-color);
    color: var(--text-inverse);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.word-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
}

.word-item {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.word-item:hover {
    border-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.word-item a {
    text-decoration: none;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.word-item a:hover {
    color: var(--secondary-color);
}

.word-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .verse {
        padding: 1.5rem;
    }

    .sanskrit {
        font-size: 1.3rem;
    }

    .controls-grid {
        grid-template-columns: 1fr;
    }

    .verse-navigation {
        flex-direction: column;
    }

    .verse-nav-btn {
        width: 100%;
    }

    .modal-content {
        margin: 10% 0;
        padding: 1.5rem;
    }

    .alphabet-nav {
        gap: 0.5rem;
    }

    .alphabet-letter {
        padding: 0.4rem 0.8rem;
        font-size: 1rem;
    }

    .word-list {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
    .reader-controls,
    .verse-navigation,
    #glossary-modal {
        display: none !important;
    }

    .verse {
        page-break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .gloss {
        border-bottom: none;
        cursor: default;
    }
}