/* Word Index - Redesigned */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background: #000;
    color: #fff;
    min-height: 100vh;
}

/* ── Header ── */
.wi-header {
    text-align: center;
    padding: 28px 20px 16px;
}

.wi-header h1 {
    font-family: 'Cinzel', serif;
    font-size: 2.2rem;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    margin-bottom: 6px;
}

.wi-subtitle {
    font-size: 1rem;
    color: #aaa;
}

/* ── Navigation ── */
.wi-nav {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 0 20px 18px;
    flex-wrap: wrap;
}

.wi-nav a {
    padding: 8px 18px;
    background: rgba(255,255,255,0.06);
    color: #ffd700;
    text-decoration: none;
    border-radius: 8px;
    border: 1px solid rgba(255,215,0,0.25);
    transition: all 0.25s;
    font-size: 0.9rem;
}

.wi-nav a:hover {
    background: rgba(255,215,0,0.15);
    border-color: #ffd700;
    transform: translateY(-1px);
}

.wi-nav a.active {
    background: rgba(255,215,0,0.25);
    border-color: #ffd700;
}

/* ── Controls bar ── */
.wi-controls {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 18px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.wi-search-wrap {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.wi-search {
    width: 100%;
    padding: 11px 44px 11px 16px;
    font-size: 1rem;
    border: 1.5px solid rgba(255,215,0,0.25);
    border-radius: 22px;
    background: rgba(255,255,255,0.05);
    color: #fff;
    outline: none;
    transition: border-color 0.2s;
}

.wi-search::placeholder {
    color: rgba(255,255,255,0.45);
}

.wi-search:focus {
    border-color: #ffd700;
    background: rgba(255,255,255,0.08);
}

.wi-search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    color: #ffd700;
    pointer-events: none;
}

/* Language selector */
.wi-lang-selector {
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.06);
    border-radius: 8px;
    padding: 3px;
    border: 1px solid rgba(255,215,0,0.2);
}

.wi-lang-btn {
    padding: 7px 14px;
    background: transparent;
    color: #aaa;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.wi-lang-btn:hover {
    color: #ffd700;
    background: rgba(255,215,0,0.1);
}

.wi-lang-btn.active {
    background: rgba(255,215,0,0.25);
    color: #ffd700;
    font-weight: bold;
}

/* ── Stats bar ── */
.wi-stats {
    text-align: center;
    padding: 0 20px 14px;
    color: #888;
    font-size: 0.9rem;
}

/* ── Category grid ── */
.wi-categories {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.wi-cat-card {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,215,0,0.18);
    border-radius: 12px;
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.wi-cat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, #ffd700, transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.wi-cat-card:hover {
    background: rgba(255,215,0,0.08);
    border-color: rgba(255,215,0,0.4);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255,215,0,0.08);
}

.wi-cat-card:hover::before {
    opacity: 1;
}

.wi-cat-card.selected {
    border-color: #ffd700;
    background: rgba(255,215,0,0.12);
    box-shadow: 0 0 15px rgba(255,215,0,0.1);
}

.wi-cat-card.selected::before {
    opacity: 1;
}

.wi-cat-icon {
    font-size: 2rem;
    margin-bottom: 8px;
    display: block;
}

.wi-cat-name {
    font-size: 1.15rem;
    color: #ffd700;
    font-weight: 600;
    margin-bottom: 4px;
}

.wi-cat-count {
    font-size: 0.82rem;
    color: #888;
}

/* "All" card special */
.wi-cat-card.all-card {
    border-color: rgba(255,215,0,0.35);
}

/* ── Main content area ── */
.wi-main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 30px;
    display: flex;
    gap: 16px;
    min-height: 60vh;
}

/* ── Alphabet sidebar ── */
.wi-alpha {
    flex: 0 0 52px;
    background: rgba(255,255,255,0.04);
    border-radius: 10px;
    padding: 8px 4px;
    border: 1px solid rgba(255,215,0,0.15);
    position: sticky;
    top: 12px;
    align-self: flex-start;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,215,0,0.3) transparent;
}

.wi-alpha::-webkit-scrollbar {
    width: 4px;
}

.wi-alpha::-webkit-scrollbar-thumb {
    background: rgba(255,215,0,0.3);
    border-radius: 2px;
}

.wi-alpha-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 40px;
    background: transparent;
    color: #999;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95rem;
    line-height: 1;
    transition: all 0.2s;
    margin: 1px 0;
}

.wi-alpha-btn span {
    font-size: 0.6rem;
    opacity: 0.6;
    margin-top: 1px;
}

.wi-alpha-btn:hover {
    background: rgba(255,215,0,0.15);
    color: #ffd700;
}

.wi-alpha-btn.active {
    background: rgba(255,215,0,0.25);
    color: #ffd700;
    font-weight: bold;
}

/* ── Bhajan list ── */
.wi-list {
    flex: 1;
    min-width: 0;
}

.wi-section-header {
    font-size: 1.5rem;
    color: #ffd700;
    padding: 8px 0 6px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255,215,0,0.2);
    position: sticky;
    top: 0;
    background: #000;
    z-index: 5;
}

.wi-letter-group {
    margin-bottom: 20px;
}

.wi-letter-label {
    font-size: 1.1rem;
    color: #ffd700;
    padding: 6px 0 4px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255,215,0,0.12);
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.wi-letter-label .count {
    font-size: 0.75rem;
    color: #666;
    font-weight: normal;
}

/* Bhajan row */
.wi-bhajan {
    display: flex;
    align-items: center;
    padding: 10px 14px;
    margin: 4px 0;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
    gap: 12px;
}

.wi-bhajan:hover {
    background: rgba(255,255,255,0.07);
    border-color: rgba(255,215,0,0.2);
    transform: translateX(3px);
}

.wi-bhajan-id {
    flex: 0 0 auto;
    background: rgba(255,215,0,0.2);
    color: #ffd700;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: bold;
    min-width: 50px;
    text-align: center;
}

.wi-bhajan-text {
    flex: 1;
    min-width: 0;
}

.wi-bhajan-line {
    font-size: 1.05rem;
    color: #eee;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wi-bhajan-transliterated {
    font-size: 0.82rem;
    color: #888;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 2px;
    font-style: italic;
}

.wi-bhajan-cat {
    flex: 0 0 auto;
    font-size: 0.72rem;
    color: #666;
    background: rgba(255,255,255,0.06);
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

/* ── Search results overlay ── */
.wi-search-results {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px 20px;
    display: none;
}

.wi-search-results.visible {
    display: block;
}

.wi-search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.wi-search-header h3 {
    color: #ffd700;
    font-size: 1.1rem;
}

.wi-search-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: #aaa;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.wi-search-close:hover {
    background: rgba(255,255,255,0.2);
    color: #fff;
}

/* ── Loading / empty states ── */
.wi-loading {
    text-align: center;
    padding: 60px 20px;
    color: #888;
    font-size: 1.05rem;
}

.wi-loading .spinner {
    display: inline-block;
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,215,0,0.2);
    border-top-color: #ffd700;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 14px;
}

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

.wi-empty {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

/* ── Back to categories button ── */
.wi-back {
    display: none;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: rgba(255,255,255,0.06);
    color: #ffd700;
    border: 1px solid rgba(255,215,0,0.2);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-bottom: 12px;
}

.wi-back.visible {
    display: inline-flex;
}

.wi-back:hover {
    background: rgba(255,215,0,0.12);
    border-color: #ffd700;
}

/* ── Responsive ── */
@media (max-width: 768px) {
    .wi-header h1 {
        font-size: 1.6rem;
    }

    .wi-controls {
        flex-direction: column;
    }

    .wi-search-wrap {
        width: 100%;
    }

    .wi-lang-selector {
        width: 100%;
        justify-content: center;
    }

    .wi-categories {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .wi-cat-card {
        padding: 12px 10px;
    }

    .wi-cat-icon {
        font-size: 1.5rem;
    }

    .wi-cat-name {
        font-size: 0.95rem;
    }

    .wi-main {
        flex-direction: column;
    }

    .wi-alpha {
        flex: none;
        position: static;
        display: flex;
        flex-wrap: wrap;
        gap: 3px;
        justify-content: center;
        max-height: none;
        padding: 8px;
    }

    .wi-alpha-btn {
        width: 36px;
        height: 34px;
        font-size: 0.85rem;
    }

    .wi-alpha-btn span {
        display: none;
    }

    .wi-bhajan {
        padding: 8px 10px;
        gap: 8px;
    }

    .wi-bhajan-cat {
        display: none;
    }
}

@media (max-width: 480px) {
    .wi-categories {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .wi-cat-card {
        padding: 10px 6px;
    }

    .wi-cat-icon {
        font-size: 1.3rem;
        margin-bottom: 4px;
    }

    .wi-cat-name {
        font-size: 0.8rem;
    }

    .wi-cat-count {
        font-size: 0.7rem;
    }
}
