:root {
    --bg-color: #FFFFFF; /* Reines Weiß */
    --text-primary: #2C2A29;
    --text-accent: #CFAE76; /* Edles Beige/Gold */
    --text-muted: rgba(44, 42, 41, 0.4);
    
    --font-ui: 'Montserrat', sans-serif;
    --font-arabic: 'Amiri', serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-ui);
    overflow: hidden; /* No scrolling, it's an app-like UI */
    height: 100vh;
    width: 100vw;
}

/* Background Pattern */
.bg-pattern {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    opacity: 0.03;
    color: var(--text-primary);
    font-family: var(--font-arabic);
    font-size: 2rem;
    line-height: 2.5;
    word-break: break-all;
    user-select: none;
    overflow: hidden;
    text-align: justify;
    padding: 2rem;
}

/* Massive Center Calligraphy */
#bg-calligraphy-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: -1;
    pointer-events: none;
}

#bg-calligraphy {
    font-family: var(--font-arabic);
    font-size: clamp(8rem, 20vw, 30rem);
    color: var(--text-accent);
    line-height: 1;
    white-space: nowrap;
    text-shadow: 0 20px 50px rgba(142, 35, 35, 0.1);
}

/* Pulsing effect */
@keyframes continuous-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.pulse {
    animation: continuous-pulse 4s ease-in-out infinite;
}

/* Layout Grid */
.grid-layout {
    display: grid;
    grid-template-columns: 1fr 2fr 1fr;
    height: 100vh;
    padding: 5vh 5vw;
    pointer-events: none; /* Let clicks pass through center space */
}

/* Left Panel */
.left-panel {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.info-content {
    max-width: 400px;
}

.id-badge {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-accent);
    margin-bottom: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: 2px solid var(--text-accent);
    border-radius: 50%;
}

.title-with-audio {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.transliteration {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    text-transform: uppercase;
    margin: 0;
}

.play-btn {
    background: var(--text-accent);
    color: var(--bg-color);
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.3s;
    outline: none;
}

.play-btn:hover {
    transform: scale(1.1);
    background: var(--text-primary);
}

.play-btn svg {
    margin-left: 3px; /* visual center for play icon */
}

.translation {
    font-size: 1.25rem;
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.explanation {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-primary);
}

/* Right Panel List */
.right-panel {
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-end;
}

.names-list-container {
    height: 320px; /* 4 items * 80px each */
    position: relative;
    overflow: hidden;
    width: 300px;
    mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,1) 75%, rgba(0,0,0,0) 100%);
}

#names-nav-list {
    list-style: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
}

.name-item {
    height: 80px;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0.3;
    transform-origin: right center;
    border-right: 3px solid transparent;
}

.name-item:hover {
    opacity: 0.6;
}

.name-item.active {
    opacity: 1;
    font-weight: bold;
    border-right: 3px solid var(--text-accent);
}

.name-item.active .item-number {
    color: var(--text-accent);
}

.item-number {
    font-size: 0.9rem;
    font-weight: 800;
    margin-right: 1.5rem;
    color: var(--text-muted);
}

.item-translit {
    font-size: 1.2rem;
    flex-grow: 1;
}

.item-arabic {
    font-family: var(--font-arabic);
    font-size: 1.8rem;
    color: var(--text-accent);
}

/* Quick Search Button */
.quick-search-bar {
    width: 300px;
    margin-bottom: 2rem;
    display: flex;
    justify-content: flex-end;
}
.search-btn {
    background: transparent;
    border: 2px solid var(--text-accent);
    color: var(--text-accent);
    font-family: var(--font-ui);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}
.search-btn:hover {
    background: var(--text-accent);
    color: var(--bg-color);
}

/* Fullscreen Search Modal */
.search-modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 15vh;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}
.search-modal.open {
    opacity: 1;
    pointer-events: auto;
}
.search-modal-content {
    background: white;
    width: 600px;
    max-width: 90vw;
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 20px 60px rgba(0,0,0,0.08);
    position: relative;
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.search-modal.open .search-modal-content {
    transform: translateY(0);
}
.close-btn {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.close-btn:hover { color: var(--text-primary); }

.search-input-wrapper input {
    width: 100%;
    padding: 1.2rem;
    font-size: 1.2rem;
    font-family: var(--font-ui);
    border: 2px solid #EEE;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.3s;
    margin-bottom: 1rem;
}
.search-input-wrapper input:focus {
    border-color: var(--text-accent);
}

#search-results-list {
    list-style: none;
    max-height: 40vh;
    overflow-y: auto;
}
#search-results-list li {
    padding: 1rem;
    border-bottom: 1px solid #F5F5F5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background 0.2s;
}
#search-results-list li:hover {
    background: #FDFBF8;
}
#search-results-list .s-num {
    font-weight: 800; color: var(--text-accent);
}
#search-results-list .s-trans {
    font-weight: 700; flex-grow: 1; margin-left: 1rem;
}
#search-results-list .s-arab {
    font-family: var(--font-arabic); font-size: 1.5rem; color: var(--text-accent);
}

/* Mobile Responsiveness */
@media screen and (max-width: 900px) {
    body {
        overflow-y: auto; 
        height: 100%;
        min-height: 100vh;
    }

    .grid-layout {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        padding: 5vh 6vw 2vh 6vw; /* Added safe top padding for mobile */
        gap: 2rem;
        justify-content: flex-start;
    }

    #bg-calligraphy-container {
        top: -2vh; /* Shifted less drastically to avoid the top text box */
    }

    #bg-calligraphy {
        font-size: clamp(4rem, 20vw, 9rem); /* Scaled down slightly to fit perfectly between top and bottom panels */
    }

    .left-panel {
        margin-top: 0; /* Removed extra top margin */
        z-index: 10;
        margin-bottom: 1rem;
    }

    .info-content {
        max-width: 100%;
        background: rgba(255, 255, 255, 0.85); 
        padding: 1.2rem;
        border-radius: 12px;
        backdrop-filter: blur(5px);
    }

    .transliteration {
        font-size: 2rem;
    }

    .translation {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .explanation {
        font-size: 0.95rem;
    }

    .center-panel {
        display: none; 
    }

    .right-panel {
        align-items: flex-start; 
        margin-top: 0; 
        padding-bottom: 5vh;
        width: 100%;
        z-index: 10;
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
    }

    .quick-search-bar {
        width: 100%;
        justify-content: flex-start;
        margin-bottom: 1rem;
    }

    .names-list-container {
        width: 100%;
        height: 240px; /* Fixed height is required because the ul is position:absolute inside it */
    }

    .name-item {
        padding: 0;
        border-right: none;
        border-left: 3px solid transparent;
        padding-left: 1rem;
        transform-origin: left center;
        height: 80px;
    }

    .name-item.active {
        border-right: none;
        border-left: 3px solid var(--text-accent);
    }
}
