@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,300;1,400;1,500;1,600;1,700;1,800&display=swap');

/* CSS Variables */
:root {
    --primary-color: #8b5a2b;
    --primary-dark: #6b4423;
    --accent-color: #d4af37;
    --background: #faf8f5;
    --surface: #ffffff;
    --surface-hover: #f5f2ed;
    --surface-dark: rgba(0, 0, 0, 0.8);
    --border: #e6ddd4;
    --border-light: #f0e8df;
    --text-primary: #2c2419;
    --text-secondary: #6b5b4a;
    --text-light: #f5f2ed;
    --shadow-lg: 0 10px 25px -5px rgba(139, 90, 43, 0.2), 0 4px 6px -4px rgba(139, 90, 43, 0.1);
    --shadow-dark: 0 4px 8px 0 rgba(0, 0, 0, 0.3);
    --radius: 0.5rem;
    --radius-lg: 1rem;
    --header-height: 130px;
}



body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.3;
    min-height: 100vh;
    padding-top: var(--header-height);
}

/* Background Image */
body::before {
    content: '';
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    height: calc(100% - var(--header-height));
    background-image: url('daf.webp');
    background-repeat: no-repeat;
    background-position: top center;
    background-attachment: fixed;
    background-size: cover;
    opacity: 0.3;
    z-index: -1;
}

/* Sticky Header */
.sticky-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--surface-dark);
    backdrop-filter: blur(10px);
    border-bottom: 2px solid var(--accent-color);
    box-shadow: var(--shadow-dark);
    z-index: 1000;
}

.sticky-header-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.header-row-1 {
    display: flex;
    align-items: center;
    padding-top: 0.25rem;
}

.header-row-2 {
    display: flex;
    align-items: center;
    padding-bottom: 0.15rem;
}

.logo-img {
    height: 50px;
}

.header-text {
    flex: 1;
    color: var(--text-light);
}

.header-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-light);
    margin: 0;
    line-height: 1.2;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.header-subtitle {
    font-size: 0.9rem;
    color: var(--accent-color);
    font-weight: 500;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Dropdowns */
.dropdown-container {
    display: flex;
    gap: 1rem;
}

.dropdown-group {
    display: flex;
    flex-direction: column;
}

.dropdown {
    padding: 0.375rem 1rem;
    border: 2px solid var(--border);
    border-radius: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.2;
    font-family: inherit;
    background: var(--surface);
    color: var(--text-primary);
    transition: all 0.2s ease;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.75rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-right: 3rem;
}

.dropdown:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.1);
}

.dropdown:disabled {
    background: var(--surface-hover);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Header Audio Section */
.header-audio-section {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    width: 100%;
    padding: 0.2rem 0;
    height: 60px;
}

.header-audio-section .player-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-shrink: 0;
    height: 100%;
}

.header-audio-section .control-btn {
    height: 48px;
    width: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
}

.header-audio-section .control-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.header-audio-section .control-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}

.header-audio-section .control-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

.header-audio-section .skip-label {
    font-size: 0.5rem;
    font-weight: 600;
    line-height: 1;
}

.header-audio-section .header-audio-player {
    display: flex;
    align-items: center;
    height: 100%;
}

.header-audio-section .header-audio-player audio {
    width: 300px;
    height: 40px;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    display: block;
    margin: 0;
    padding: 0;
    transform: translateY(-10px); 
}


/* Main Container */
.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: calc(100vh - var(--header-height));
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 2rem;
}

/* Card Styles */
.header-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
}

/* Controls Section */
.controls-section {
    margin-bottom: 2rem;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 2rem;
    justify-content: space-between;
}

.player-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem;
    flex-shrink: 0;
}

.control-btn {
    width: 45px;
    height: 45px;
    border: 2px solid var(--border);
    background: var(--surface);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    color: var(--text-primary);
    flex-direction: column;
    gap: 2px;
}

.skip-label {
    font-size: 0.55rem;
    font-weight: 600;
    line-height: 1;
}

.control-btn:hover {
    background: var(--surface-hover);
    transform: translateY(-1px);
}

.control-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    width: 55px;
    height: 55px;
    font-size: 1.4rem;
}

.control-btn.primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Audio Player */
.header-audio-player {
    margin-top: 1.5rem;
}

.header-audio-player audio {
    width: 100%;
    height: 60px;
    border-radius: var(--radius);
}

/* Text Section */
.text-section {
    margin-top: 2rem;
    border-top: 1px solid var(--border);
    padding-top: 1.5rem;
}

.text-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.text-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.text-loading {
    color: var(--primary-color);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Language Toggle */
.language-toggle {
    display: flex;
    background: var(--surface);
    border: 2px solid var(--border-light);
    border-radius: var(--radius);
    overflow: hidden;
}

.lang-btn {
    padding: 0.5rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-right: 1px solid var(--border-light);
}

.lang-btn:last-child {
    border-right: none;
}

.lang-btn:hover:not(.active) {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.lang-btn.active {
    background: var(--primary-color);
    color: white;
}

.lang-btn.active:hover {
    background: var(--primary-dark);
}

/* Text Content */
.text-content {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    line-height: 1.8;
    font-size: 1rem;
    margin: 0;
    color: var(--text-secondary);
}

.text-content.loaded {
    color: var(--text-primary);
    font-style: normal;
    text-align: left;
}

.text-content[dir="rtl"] {
    text-align: right;
}

.text-content[dir="ltr"] {
    text-align: left;
}

/* Text Attribution */
.text-attribution {
    display: flex;
    align-items: flex-start;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-light);
    font-size: 0.875rem;
    color: #666;
    gap: 0.75rem;
    direction: ltr;
    text-align: left;
}

.text-attribution img {
    height: 4em;
    width: auto;
    flex-shrink: 0;
    border-radius: 4px;
}

.text-attribution span {
    flex: 1;
    line-height: 1.4;
}

.text-attribution a {
    color: var(--primary-color);
    text-decoration: none;
}

.text-attribution a:hover {
    text-decoration: underline;
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    background: var(--surface);
    padding: 2rem;
    border-radius: var(--radius-lg);
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.loading-spinner i {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.loading-spinner p {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Footer */
.footer {
    text-align: center;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    color: #7e2302;
    font-size: 0.875rem;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    :root {
        --header-height: 180px;
    }
    
    .sticky-header-content {
        flex-direction: column;
        justify-content: center;
        padding: 1rem;
        gap: 0.5rem;
    }
    
    .header-row-1 {
        flex-direction: row;
        align-items: center;
        gap: 0.75rem;
        text-align: left;
        width: 100%;
        flex-wrap: wrap;
    }
    
    .header-row-2 {
        width: 100%;
        padding: 0.25rem 0;
    }
    
    .header-logo {
        order: 1;
    }
    
    .header-text {
        order: 2;
        text-align: left;
    }
    
    .header-dropdowns {
        order: 3;
        width: 100%;
        margin-top: 0.5rem;
        flex-basis: 100%;
    }
    
    .dropdown-container {
        justify-content: right;
        gap: 1rem;
        margin: 0 auto;
    }
    
    .header-title {
        font-size: 1.5rem;
        margin-bottom: 0.25rem;
    }
    
    .header-subtitle {
        font-size: 0.9rem;
    }
    
    .logo-img {
        height: 40px;
    }
    
    .header-audio-section {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0.25rem 0;
    }
    
    .header-audio-section .player-controls {
        gap: 0.75rem;
    }
    
    .header-audio-section .control-btn {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .header-audio-section .control-btn.primary {
        width: 45px;
        height: 45px;
        font-size: 1.1rem;
    }
    
    .header-audio-section .skip-label {
        font-size: 0.45rem;
    }
    
    .header-audio-section .header-audio-player audio {
        height: 45px;
    }
    
    .container {
        padding: 1rem;
    }

    .main-content {
        padding-top: 0;
    }

    .header-card {
        padding: 1.5rem;
        margin: 0 -1rem;
        border-radius: 0;
    }

    .text-content {
        padding: 1rem;
        font-size: 0.9rem;
        margin: 0 -1.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Focus Accessibility */
.dropdown:focus,
.control-btn:focus,
.lang-btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}