/* 
 * Design System & Variables 
 */
:root {
    /* Colors */
    --color-primary: #decca2;
    /* Accent, highlights */
    --color-secondary: #b25538;
    /* Buttons, interactions */
    --color-base: #271f41;
    /* Dark background base */
    --color-base-dark: #1e1733;
    /* Darker shade for deeper contrast */
    --color-base-light: #342a52;
    /* Lighter shade for cards/ui */
    --color-text-main: #f5f5f5;
    /* White-ish text */
    --color-text-muted: #a0a0b0;
    /* Muted text */
    --color-overlay: rgba(39, 31, 65, 0.85);

    /* Typography */
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;

    /* Spacing */
    --spacing-xs: 0.5rem;
    /* 8px */
    --spacing-sm: 1rem;
    /* 16px */
    --spacing-md: 2rem;
    /* 32px */
    --spacing-lg: 4rem;
    /* 64px */
    --spacing-xl: 8rem;
    /* 128px */

    /* UI Elements */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --shadow-soft: 0 10px 30px -10px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 40px -15px rgba(0, 0, 0, 0.4);
    --transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--color-base);
    color: var(--color-text-main);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--color-primary);
}

button {
    cursor: pointer;
    font-family: var(--font-body);
    border: none;
    background: none;
}

a {
    color: inherit;
    text-decoration: none;
    transition: var(--transition);
}

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* Utilities */
.hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px);
}

/* 
 * Components 
 */

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--spacing-xs);
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.5;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    letter-spacing: 0.02em;
}

.btn-primary {
    background-color: var(--color-primary);
    color: var(--color-base);
    box-shadow: 0 4px 14px rgba(222, 204, 162, 0.2);
}

.btn-primary:hover {
    background-color: #e5d5b0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(222, 204, 162, 0.3);
}

.btn-secondary {
    background-color: var(--color-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #c76142;
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
}

.btn-outline:hover {
    background-color: rgba(222, 204, 162, 0.1);
}

.btn-icon-only {
    padding: 8px;
    border-radius: 50%;
    transition: var(--transition);
    color: var(--color-text-muted);
}

.btn-icon-only:hover {
    color: var(--color-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

/* 
 * Hero Section 
 */
@keyframes gradientRotate {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.hero-section {
    position: relative;
    height: 90vh;
    min-height: 600px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: linear-gradient(-45deg, #342a52, var(--color-base), #1e1733, #2a1f42);
    background-size: 400% 400%;
    animation: gradientRotate 15s ease infinite;
    overflow: hidden;
}

.hero-actions {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: var(--spacing-sm);
    flex-wrap: nowrap;
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 800px;
}

.hero-content img {
    max-height: 170px;
    width: auto;
    margin-bottom: var(--spacing-md);
}

.eyebrow {
    display: block;
    font-family: var(--font-body);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    font-size: 0.875rem;
    color: var(--color-secondary);
    margin-bottom: var(--spacing-sm);
    font-weight: 600;
}

.display-title {
    font-size: 3.5rem;
    margin-bottom: var(--spacing-md);
    color: var(--color-primary);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hero-description {
    font-size: 1.125rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-lg);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* 
 * Teachings Section 
 */
.teachings-section {
    padding: var(--spacing-xl) 0;
    background-color: var(--color-base);
}

.section-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-xs);
}

.section-header p {
    color: var(--color-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    font-size: 0.875rem;
}

.teachings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--spacing-md);
}

.teaching-card {
    background-color: rgba(52, 42, 82, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.teaching-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: rgba(222, 204, 162, 0.2);
}

.teaching-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background-color: var(--color-secondary);
    opacity: 0;
    transition: var(--transition);
}

.teaching-card:hover::before {
    opacity: 1;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: var(--spacing-xs);
    color: white;
}

.card-description {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    margin-bottom: var(--spacing-md);
    flex-grow: 1;
}

.card-actions {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: space-between;
    align-items: center;
    padding-top: var(--spacing-sm);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.action-group-right {
    display: flex;
    gap: var(--spacing-xs);
}

/* Custom Audio Player & Card Meta */
.card-meta {
    margin-bottom: 1rem;
    font-size: 0.8rem;
    color: var(--color-text-muted);
}
.meta-label {
    font-weight: 600;
    color: var(--color-primary);
}
.meta-divider { margin: 0 4px; }
.status-coming-soon {
    font-size: 0.8rem;
    color: var(--color-text-muted);
    display: inline-flex;
    align-items: center;
}

.audio-player-container {
    display: flex;
    flex-direction: column;
    width: 100%;
    background-color: black;
}

.audio-controls-wrapper {
    width: 100%;
    padding: 15px;
    background-color: var(--color-base-dark);
}

.audio-player { 
    width: 100%; 
}

.speaker-image-wrapper {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: black;
    overflow: hidden;
}

.placeholder-wrapper {
    background-color: var(--color-base);
    aspect-ratio: 1 / 1;
}

.audio-speaker-img {
    width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    border: none;
}

.audio-icon {
    font-size: 5rem;
    color: var(--color-primary);
    margin: 0;
}

/* Auth Modal Styles */
.auth-modal-container {
    max-width: 450px !important;
}
.auth-content {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-md);
}
.auth-header { margin-bottom: var(--spacing-md); }
.auth-header i { font-size: 3rem; color: var(--color-primary); margin-bottom: 1rem; display: block; }
.auth-header h3 { margin-bottom: 0.5rem; font-size: 1.5rem; color: var(--color-primary); }
.auth-header p { color: var(--color-text-muted); font-size: 0.95rem; }
.form-group { margin-bottom: 1rem; }
.auth-form input {
    width: 100%;
    padding: 14px;
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
    color: white;
    font-family: var(--font-body);
    font-size: 1rem;
    transition: var(--transition);
}
.auth-form input:focus {
    outline: none;
    border-color: var(--color-primary);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 2px rgba(222, 204, 162, 0.2);
}
.btn-full { width: 100%; justify-content: center; position: relative; }
.auth-error {
    background: rgba(178, 85, 56, 0.1);
    color: #ff8a65;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 1rem;
    text-align: left;
    border: 1px solid rgba(178, 85, 56, 0.2);
}
.auth-error i { font-size: 1.2rem; flex-shrink: 0; margin-top: 2px; }
.spinner {
    height: 20px; width: 20px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s infinite linear;
    position: absolute;
    right: 20px;
}
@keyframes spin { 100% { transform: rotate(360deg); } }

/* 
 * Video Modal 
 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    padding: var(--spacing-sm);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    overflow-y: auto;
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-container {
    position: relative;
    width: 95%;
    max-width: 1000px;
    margin: auto; /* Fixes centering without causing top cropping */
    background-color: var(--color-base-dark);
    border-radius: var(--radius-md);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    overflow: visible;
    transform: scale(0.95);
    transition: transform 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.modal.active .modal-container {
    transform: scale(1);
}

.video-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%;
    /* 16:9 Aspect Ratio */
    background-color: black;
    overflow: hidden;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.video-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}

.video-placeholder i {
    font-size: 4rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
    opacity: 0.8;
}

.modal-content {
    padding: var(--spacing-md);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* Modal Controls (Share & Close) */
.modal-controls {
    position: absolute;
    top: 0;
    right: -60px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 100;
}

.modal-btn {
    width: 44px;
    height: 44px;
    background: var(--color-base);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.modal-btn i {
    font-size: 1.25rem;
}

.modal-btn:hover {
    background: var(--color-secondary);
    transform: scale(1.1);
    color: white;
}

.modal-share:hover {
    background: var(--color-primary);
    color: var(--color-base);
}

/* Adjust for mobile and tablet - Separated Close Button */
@media (max-width: 1100px) {
    .modal-container {
        transform: none !important; /* Allows fixed to anchor to screen */
        margin-top: 75px; /* Safely pushes modal down away from fixed button */
    }

    .modal-controls {
        position: fixed; /* Fix to the viewport, fully separated from modal */
        right: 16px;
        top: 16px;
        flex-direction: row;
        gap: 8px;
        z-index: 2500;
        background: var(--color-base-dark);
        border-radius: 50px;
        padding: 4px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.8);
        border: 1px solid rgba(255,255,255,0.1);
    }

    .modal-btn {
        width: 36px;
        height: 36px;
        background: rgba(255,255,255,0.05);
    }
}

/* Audio Modal Specific Styles (Desktop) */
@media (min-width: 769px) {
    .modal-container.audio-mode {
        max-width: 650px; /* Reduce width for audio */
    }
    
    .modal-container.audio-mode .video-wrapper {
        padding-bottom: 0;
        height: 300px; /* Fixed height for audio player */
    }
}

/* 
 * Footer 
 */
.site-footer {
    background-color: var(--color-base-dark);
    padding: var(--spacing-lg) 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--spacing-md);
}

.footer-brand .brand-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    color: var(--color-primary);
    display: block;
    margin-bottom: var(--spacing-xs);
}

.footer-brand p {
    color: var(--color-text-muted);
    font-size: 0.875rem;
}

.footer-nav {
    display: flex;
    gap: var(--spacing-md);
}

.footer-nav a {
    color: var(--color-text-muted);
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
}

.footer-nav a i {
    color: var(--color-primary);
    font-size: 1.1rem;
}

.footer-nav a:hover {
    color: var(--color-primary);
}

/* 
 * Toast 
 */
.toast {
    position: fixed;
    bottom: var(--spacing-md);
    right: var(--spacing-md);
    background-color: var(--color-primary);
    color: var(--color-base);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-hover);
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    z-index: 2000;
    transition: all 0.3s ease;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .display-title {
        font-size: 2.5rem;
    }

    .hero-section {
        height: auto;
        padding: var(--spacing-xl) 0;
    }

    .hero-actions {
        flex-direction: column;
        width: 100%;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }

    .footer-nav {
        flex-direction: column;
        align-items: center;
        gap: var(--spacing-sm);
        width: 100%;
    }
}

/* 
 * Day Groups 
 */
.day-section {
    margin-bottom: var(--spacing-lg);
}

.day-header {
    font-size: 1.75rem;
    color: var(--color-secondary);
    margin-bottom: var(--spacing-sm);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: inline-block;
    width: 100%;
    margin-top: var(--spacing-md);
}

.session-header {
    font-size: 1.25rem;
    color: var(--color-primary);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.95;
    font-family: var(--font-heading);
}

.session-header i {
    font-size: 1.5rem;
}

.evening-spacing {
    margin-top: var(--spacing-lg);
}

/* Audio Modal Specific Styles (All Devices) */
.modal-container.audio-mode {
    max-width: 450px;
}

/* Fully reset the 16:9 ghost box — this is the source of the blank space */
.modal-container.audio-mode .video-wrapper {
    position: static !important;   /* Kill the relative positioning context */
    padding-bottom: 0 !important;  /* Kill the 56.25% aspect-ratio hack */
    height: auto !important;       /* Let children define height naturally */
    margin: 0 !important;
    overflow: visible;
}

/* Zero out all padding/margin between image and title */
.modal-container.audio-mode .modal-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

.modal-container.audio-mode #modal-title {
    margin-top: 8px;
}