/* ==========================================================================
   Mosque Digital Display CSS - Advanced Glassmorphic & Multitheme Layout
   ========================================================================== */

:root {
    /* Emerald Theme (Default - Dark) */
    --primary-color: #0d9488;
    --primary-glow: rgba(13, 148, 136, 0.4);
    --accent-color: #f59e0b;
    --accent-glow: rgba(245, 158, 11, 0.4);
    --bg-dark: #022c22;
    --bg-gradient: linear-gradient(135deg, #022c22 0%, #042f2e 50%, #064e3b 100%);
    
    /* UI Neutral Colors */
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.5);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-active-border: rgba(13, 148, 136, 0.6);
    --input-bg: rgba(15, 23, 42, 0.8);
    --input-border: rgba(255, 255, 255, 0.15);

    /* Fonts */
    --font-heading: 'Cairo', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    /* SVGs for dynamic backgrounds */
    --pattern-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0l40 40-40 40L0 40z' fill='%230f766e' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
    --pattern-geometric: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 0l10 20 20 10-20 10-10 20-10-20-20-10 20-10z' fill='%23eab308' fill-opacity='0.02'/%3E%3C/svg%3E");
    --pattern-stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100' viewBox='0 0 100 100'%3E%3Ccircle cx='10' cy='10' r='1' fill='%23ffffff' fill-opacity='0.15'/%3E%3Ccircle cx='50' cy='30' r='1.5' fill='%23ffffff' fill-opacity='0.25'/%3E%3Ccircle cx='90' cy='20' r='1' fill='%23ffffff' fill-opacity='0.1'/%3E%3Ccircle cx='30' cy='70' r='1.2' fill='%23ffffff' fill-opacity='0.2'/%3E%3Ccircle cx='70' cy='80' r='1.8' fill='%23ffffff' fill-opacity='0.3'/%3E%3C/svg%3E");
    
    --bg-pattern: var(--pattern-default);
}

/* ==========================================================================
   Theme Presets
   ========================================================================== */

/* --- Dark Themes --- */
.theme-kaaba {
    --primary-color: #d97706;
    --primary-glow: rgba(217, 119, 6, 0.4);
    --accent-color: #fbbf24;
    --accent-glow: rgba(251, 191, 36, 0.4);
    --bg-dark: #0f172a;
    --bg-gradient: linear-gradient(135deg, #090d16 0%, #111827 50%, #1f2937 100%);
    --card-active-border: rgba(217, 119, 6, 0.6);
}

.theme-royal {
    --primary-color: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.4);
    --accent-color: #e2e8f0;
    --accent-glow: rgba(226, 232, 240, 0.4);
    --bg-dark: #0f172a;
    --bg-gradient: linear-gradient(135deg, #030712 0%, #0b1528 50%, #1e1b4b 100%);
    --card-active-border: rgba(59, 130, 246, 0.6);
}

.theme-sunset {
    --primary-color: #ea580c;
    --primary-glow: rgba(234, 88, 12, 0.4);
    --accent-color: #fcd34d;
    --accent-glow: rgba(252, 211, 77, 0.4);
    --bg-dark: #1c1917;
    --bg-gradient: linear-gradient(135deg, #1c1917 0%, #292524 50%, #44403c 100%);
    --card-active-border: rgba(234, 88, 12, 0.6);
}

/* --- Bright / Light Themes --- */
.theme-ivory {
    --primary-color: #854d0e; /* Deep Gold */
    --primary-glow: rgba(133, 77, 14, 0.2);
    --accent-color: #1e3a8a; /* Navy Blue */
    --accent-glow: rgba(30, 58, 138, 0.2);
    --bg-dark: #fafaf9; /* Warm Ivory */
    --bg-gradient: linear-gradient(135deg, #fafaf9 0%, #f5f5f4 50%, #e7e5e4 100%);
    --text-main: #1c1917;
    --text-muted: #57534e;
    --card-bg: rgba(255, 255, 255, 0.82);
    --card-border: rgba(0, 0, 0, 0.08);
    --card-active-border: rgba(133, 77, 14, 0.6);
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: rgba(0, 0, 0, 0.15);
    --pattern-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0l40 40-40 40L0 40z' fill='%23854d0e' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.theme-amber {
    --primary-color: #b45309; /* Deep Amber */
    --primary-glow: rgba(180, 83, 9, 0.2);
    --accent-color: #78350f; /* Rust Brown */
    --accent-glow: rgba(120, 53, 15, 0.2);
    --bg-dark: #fef3c7; /* Bright Amber */
    --bg-gradient: linear-gradient(135deg, #fef3c7 0%, #fde68a 50%, #fcd34d 100%);
    --text-main: #78350f;
    --text-muted: #9a3412;
    --card-bg: rgba(255, 255, 255, 0.88);
    --card-border: rgba(180, 83, 9, 0.1);
    --card-active-border: rgba(180, 83, 9, 0.6);
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: rgba(0, 0, 0, 0.15);
    --pattern-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0l40 40-40 40L0 40z' fill='%23b45309' fill-opacity='0.04' fill-rule='evenodd'/%3E%3C/svg%3E");
}

.theme-mint {
    --primary-color: #0f766e; /* Teal */
    --primary-glow: rgba(15, 118, 110, 0.2);
    --accent-color: #115e59; /* Forest Mint */
    --accent-glow: rgba(17, 94, 89, 0.2);
    --bg-dark: #e6fffa; /* Minty White */
    --bg-gradient: linear-gradient(135deg, #e6fffa 0%, #ccfbf1 50%, #a7f3d0 100%);
    --text-main: #115e59;
    --text-muted: #0f766e;
    --card-bg: rgba(255, 255, 255, 0.85);
    --card-border: rgba(15, 118, 110, 0.1);
    --card-active-border: rgba(15, 118, 110, 0.6);
    --input-bg: rgba(255, 255, 255, 0.95);
    --input-border: rgba(0, 0, 0, 0.15);
    --pattern-default: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80' viewBox='0 0 80 80'%3E%3Cpath d='M40 0l40 40-40 40L0 40z' fill='%230f766e' fill-opacity='0.03' fill-rule='evenodd'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Global Reset & Layout
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    user-select: none;
}

body {
    background: var(--bg-dark);
    font-family: var(--font-body);
    color: var(--text-main);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    display: flex;
    flex-direction: column;
}

body.lang-ta, body.lang-ta * {
    font-family: 'Noto Sans Tamil', 'Inter', sans-serif !important;
}

/* Urgent Notification Banner styling */
.urgent-bar {
    position: relative;
    z-index: 500;
    height: 38px;
    background: linear-gradient(90deg, #dc2626 0%, #ef4444 50%, #dc2626 100%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(220, 38, 38, 0.4);
    animation: flashBorder 4s infinite;
}

.urgent-badge {
    background: white;
    color: #b91c1c;
    font-weight: 800;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    margin-right: 1.5rem;
    flex-shrink: 0;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.urgent-text {
    font-size: 1rem;
    font-weight: 700;
    color: white;
    white-space: nowrap;
    animation: urgentMarquee 25s linear infinite;
}

/* Main Display Container */
.display-container {
    width: 100%;
    flex-grow: 1;
    position: relative;
    background-image: var(--bg-gradient);
    background-size: cover;
    background-position: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem 3rem;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Background overlay patterns */
.display-container::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--bg-pattern);
    opacity: 0.8;
    pointer-events: none;
    z-index: 1;
    animation: bgPan 60s linear infinite alternate;
}

.bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    opacity: 0.85; /* Slight transparency so gradient/theme base colors can tint it subtly */
}

/* Top Bar Styling */
.top-bar {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: 1.1fr auto 1.1fr;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding-bottom: 1rem;
    animation: slideDownIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.mosque-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.mosque-logo {
    max-height: 55px;
    max-width: 100px;
    object-fit: contain;
    border-radius: 6px;
    background: rgba(255,255,255,0.05);
    padding: 2px;
}

.mosque-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.qibla-display {
    font-size: 0.95rem;
    color: var(--accent-color);
    font-weight: 600;
    text-shadow: 0 0 10px var(--accent-glow);
    margin-top: -2px;
}

.logo-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 0 10px var(--primary-glow));
}

.mosque-info h1 {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 1.8rem;
    letter-spacing: -0.5px;
    background: linear-gradient(120deg, var(--text-main) 60%, var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Clock Centralized */
.main-clock-container {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 0.5rem;
    background: rgba(15, 23, 42, 0.25);
    padding: 0.6rem 2.8rem;
    border-radius: 100px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.main-time {
    font-size: 5.5rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -2px;
    color: var(--text-main);
    text-shadow: 0 0 25px var(--primary-glow);
    animation: textGlowPulse 4s ease-in-out infinite;
}

.time-ampm {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--accent-color);
    text-transform: uppercase;
}

/* Dates & Weather Widget section */
.date-container {
    text-align: right;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    align-items: flex-end;
}

.weather-widget {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.15);
    padding: 0.15rem 0.6rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
    margin-bottom: 0.2rem;
}

.weather-temp {
    color: var(--text-main);
    font-weight: 700;
}

.hijri-date {
    font-family: var(--font-heading);
    font-size: 1.45rem;
    font-weight: 600;
    color: var(--accent-color);
    text-shadow: 0 0 15px var(--accent-glow);
}

.gregorian-date {
    font-size: 1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ==========================================================================
   Countdown & Slideshow Banner Sections
   ========================================================================== */
.banner-container {
    position: relative;
    z-index: 10;
    margin: 1.2rem 0;
    display: grid;
    grid-template-columns: 1fr 1.3fr;
    gap: 1.5rem;
    width: 100%;
}

.countdown-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    padding: 1rem 2rem;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.25rem;
    transition: all 0.3s ease;
    animation: breatheFloat 6s ease-in-out infinite;
}

.countdown-label {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.countdown-value {
    font-size: 2.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent-color);
    text-shadow: 0 0 15px var(--accent-glow);
}

/* Slideshow Card container */
.slideshow-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    padding: 1.2rem 2rem;
    border-radius: 18px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    position: relative;
    min-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    animation: breatheFloat 6s ease-in-out infinite;
    animation-delay: 2s; /* Alternate float with countdown card */
}

.slide {
    display: none;
    animation: slideFade 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    flex-direction: column;
    gap: 0.3rem;
}

.slide.active {
    display: flex;
}

.slide-label {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-color);
}

.slide-text {
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--text-main);
    font-style: italic;
}

.slide-flex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.slide-flex .slide-text {
    flex-grow: 1;
}

.qr-code-svg {
    border-radius: 6px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

/* ==========================================================================
   Prayer Times Grid
   ========================================================================== */
.prayer-grid {
    position: relative;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.2rem;
    flex-grow: 1;
    margin-bottom: 1.2rem;
    align-content: center;
    animation: fadeUpIn 1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.prayer-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(16px);
    border-radius: 18px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    gap: 1.2rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    position: relative;
    overflow: hidden;
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

.prayer-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    transition: all 0.3s ease;
}

.prayer-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 15px 45px rgba(0, 0, 0, 0.45);
}

.prayer-names {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.prayer-english {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.5px;
}

.prayer-arabic {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--text-muted);
}

.prayer-time-display {
    font-size: 2.3rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--text-main);
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.iqamah-time-display, .jummah-sessions-display {
    width: 100%;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.iqamah-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.iqamah-val {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-color);
}

/* Jummah session special layout inside card */
.jummah-sessions-display {
    gap: 0.25rem;
    padding: 0.4rem 0.6rem;
}

.jummah-session-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 0.8rem;
}

.j-sess-lbl {
    font-weight: 600;
    color: var(--text-muted);
}

.j-sess-val {
    font-weight: 700;
    color: var(--accent-color);
}

/* Active Highlight Card State */
.prayer-card.active {
    border-color: var(--card-active-border);
    animation: floatActiveCard 5s infinite ease-in-out;
    transform: scale(1.02);
}

/* For bright theme active card background adjustments */
.theme-ivory .prayer-card.active, .theme-amber .prayer-card.active, .theme-mint .prayer-card.active {
    animation: floatActiveCardBright 5s infinite ease-in-out;
    transform: scale(1.02);
}

.prayer-card.active::before {
    background: var(--primary-color);
}

.prayer-card.active .active-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--primary-color);
    box-shadow: 0 0 8px var(--primary-color);
    animation: pulse 1.8s infinite;
}

/* Shuruq Card tweaks */
.shuruq-card {
    background: rgba(15, 23, 42, 0.2);
}
.shuruq-card .prayer-time-display {
    color: var(--text-muted);
    font-size: 1.9rem;
}

/* ==========================================================================
   Bottom Marquee
   ========================================================================== */
.bottom-marquee {
    position: relative;
    z-index: 10;
    height: 46px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    border-radius: 12px;
    display: flex;
    align-items: center;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.theme-ivory .bottom-marquee, .theme-amber .bottom-marquee, .theme-mint .bottom-marquee {
    background: rgba(255, 255, 255, 0.7);
}

.ticker-wrap {
    width: 100%;
    overflow: hidden;
}

.ticker-content {
    display: inline-block;
    white-space: nowrap;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-main);
    padding-left: 100%;
    animation: marquee 35s linear infinite;
}

/* ==========================================================================
   Salah in Progress Dimmer Overlay
   ========================================================================== */
.salah-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000000; /* Pitch black for cinema dimming effect */
    z-index: 9999;
    display: none;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
}

.salah-overlay.open {
    display: flex;
}

.salah-overlay-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    max-width: 700px;
    padding: 3rem;
}

.salah-mosque-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: overlayIconPulse 2.5s infinite ease-in-out;
    filter: drop-shadow(0 0 20px rgba(13, 148, 136, 0.5));
}

.salah-overlay h2 {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 800;
    color: #f8fafc;
    margin-bottom: 0.25rem;
}

.mosque-text h1 {
    font-family: var(--font-heading);
    font-size: 1.8rem;
    font-weight: 800;
    margin: 0 0 0.1rem 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.qibla-display {
    font-size: 0.95rem;
    color: var(--text-muted);
    font-weight: 600;
}

.audio-visualizer {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    color: var(--accent-color);
}

.audio-visualizer span {
    display: inline-block;
    width: 3px;
    height: 10px;
    background: var(--accent-color);
    border-radius: 2px;
    animation: bounceAudio 1s ease-in-out infinite;
}

.audio-visualizer span:nth-child(1) { animation-delay: 0s; }
.audio-visualizer span:nth-child(2) { animation-delay: 0.2s; height: 14px; }
.audio-visualizer span:nth-child(3) { animation-delay: 0.4s; height: 8px; }
.audio-visualizer span:nth-child(4) { animation-delay: 0.1s; height: 16px; }
.audio-visualizer span:nth-child(5) { animation-delay: 0.3s; height: 12px; }

.audio-visualizer small {
    margin-left: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    animation: pulse 2s infinite;
}

@keyframes bounceAudio {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50% { transform: scaleY(1.2); opacity: 1; }
}

.salah-arabic {
    font-family: var(--font-heading);
    font-size: 2.2rem;
    font-weight: 600;
    color: var(--accent-color);
    margin-bottom: 1.5rem;
}

.salah-overlay p {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 2rem;
}

.salah-timer {
    font-size: 1.8rem;
    font-weight: 800;
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 0.5rem 2rem;
    border-radius: 100px;
    margin-bottom: 2rem;
    animation: pulseRedBorder 1.5s infinite;
}

.salah-dismiss-btn {
    background: rgba(255, 255, 255, 0.05);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.3;
    transition: all 0.3s ease;
}

.salah-dismiss-btn:hover {
    opacity: 1;
    background: rgba(239, 68, 68, 0.15);
    border-color: #ef4444;
}

/* ==========================================================================
   Settings Panel / Buttons
   ========================================================================== */
.settings-trigger {
    position: absolute;
    bottom: 75px;
    right: 15px;
    z-index: 1001;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    font-size: 1.3rem;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(8px);
    opacity: 0.1;
    transition: all 0.3s ease;
}

.display-container:hover .settings-trigger {
    opacity: 0.8;
}

.settings-trigger:hover {
    opacity: 1 !important;
    transform: rotate(45deg) scale(1.1);
    background: var(--primary-color);
    border-color: transparent;
    box-shadow: 0 0 15px var(--primary-glow);
}

.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(2, 6, 23, 0.8);
    backdrop-filter: blur(16px);
    z-index: 1000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}

.settings-overlay.open {
    display: flex;
}

.settings-modal-card {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    width: 100%;
    max-width: 820px;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: modalSlideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.theme-ivory .settings-modal-card, .theme-amber .settings-modal-card, .theme-mint .settings-modal-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15);
}

.modal-header {
    padding: 1.25rem 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-ivory .modal-header, .theme-amber .modal-header, .theme-mint .modal-header {
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.modal-header h2 {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-main);
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: var(--text-main);
}

/* Tab Navigation inside settings */
.settings-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0 1rem;
    overflow-x: auto;
}

.theme-ivory .settings-tabs, .theme-amber .settings-tabs, .theme-mint .settings-tabs {
    background: rgba(0, 0, 0, 0.03);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    padding: 0.9rem 1.25rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
}

.tab-btn.active {
    color: var(--primary-color);
}

.tab-btn.active::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 1.25rem;
    right: 1.25rem;
    height: 3px;
    background: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* Tab Panels */
.settings-content {
    padding: 1.5rem 2rem;
    overflow-y: auto;
    flex-grow: 1;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-subtitle {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.settings-divider {
    border: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 0.25rem 0;
}

.theme-ivory .settings-divider, .theme-amber .settings-divider, .theme-mint .settings-divider {
    background: rgba(0, 0, 0, 0.08);
}

.tab-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
}

/* Form Styling */
.form-row {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.iqamah-settings-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.75rem;
}

/* Handle iqamah grid labels layout for mobile aspect ratio */
@media (max-width: 640px) {
    .iqamah-settings-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

input, select, textarea {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    color: var(--text-main);
    padding: 0.65rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s ease;
}

.theme-ivory input, .theme-ivory select, .theme-ivory textarea,
.theme-amber input, .theme-amber select, .theme-amber textarea,
.theme-mint input, .theme-mint select, .theme-mint textarea {
    color: #1c1917;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-glow);
}

textarea {
    resize: none;
}

input[type="color"] {
    padding: 0;
    height: 38px;
    width: 100%;
    border-radius: 8px;
    cursor: pointer;
}
input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}
input[type="color"]::-webkit-color-swatch {
    border: none;
    border-radius: 7px;
}

.ticker-preview-box {
    margin-top: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.theme-ivory .ticker-preview-box, .theme-amber .ticker-preview-box, .theme-mint .ticker-preview-box {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
}

.ticker-preview-box strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 0.4rem;
    font-size: 0.8rem;
}

.preview-marquee {
    overflow: hidden;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.1);
    padding: 0.4rem;
    border-radius: 4px;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Modal Footer */
.modal-footer {
    padding: 1.25rem 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 640px) {
    .settings-overlay {
        padding: 1rem;
    }
    .form-group-row {
        grid-template-columns: 1fr;
    }
    .modal-footer {
        flex-direction: column;
        justify-content: center;
        text-align: center;
    }
    .modal-footer > div {
        flex-direction: column;
        width: 100%;
    }
    .modal-footer button {
        width: 100%;
    }
}

.theme-ivory .modal-footer, .theme-amber .modal-footer, .theme-mint .modal-footer {
    border-top-color: rgba(0, 0, 0, 0.08);
}

.attribution {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.attribution:hover {
    color: var(--accent-color);
    text-shadow: 0 0 8px var(--accent-glow);
}

.btn {
    padding: 0.65rem 1.25rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: var(--primary-color);
    filter: brightness(0.9);
    box-shadow: 0 0 12px var(--primary-glow);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-ivory .btn-secondary, .theme-amber .btn-secondary, .theme-mint .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #1c1917;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
}

/* ==========================================================================
   Animations
   ========================================================================== */
@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(13, 148, 136, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 8px rgba(13, 148, 136, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(13, 148, 136, 0);
    }
}

@keyframes marquee {
    0% {
        transform: translate3d(0, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

@keyframes urgentMarquee {
    0% {
        transform: translate3d(20%, 0, 0);
    }
    100% {
        transform: translate3d(-100%, 0, 0);
    }
}

@keyframes slideFade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes overlayIconPulse {
    0% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(13, 148, 136, 0.3));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 25px rgba(13, 148, 136, 0.7));
    }
    100% {
        transform: scale(1);
        filter: drop-shadow(0 0 10px rgba(13, 148, 136, 0.3));
    }
}

@keyframes pulseRedBorder {
    0% {
        border-color: rgba(239, 68, 68, 0.3);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
    50% {
        border-color: rgba(239, 68, 68, 0.7);
        box-shadow: 0 0 15px 2px rgba(239, 68, 68, 0.4);
    }
    100% {
        border-color: rgba(239, 68, 68, 0.3);
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.2);
    }
}

@keyframes activeGlowPulse {
    0%, 100% {
        border-color: var(--card-active-border);
        box-shadow: 0 0 30px var(--primary-glow);
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.7) 0%, rgba(13, 148, 136, 0.12) 100%);
    }
    50% {
        border-color: rgba(255, 255, 255, 0.3);
        box-shadow: 0 0 45px var(--primary-glow), inset 0 0 15px var(--primary-glow);
        background: linear-gradient(180deg, rgba(15, 23, 42, 0.75) 0%, rgba(13, 148, 136, 0.18) 100%);
    }
}

@keyframes activeGlowPulseBright {
    0%, 100% {
        border-color: var(--card-active-border);
        box-shadow: 0 0 20px var(--primary-glow);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.95) 0%, rgba(13, 148, 136, 0.03) 100%);
    }
    50% {
        border-color: rgba(0, 0, 0, 0.2);
        box-shadow: 0 0 35px var(--primary-glow), inset 0 0 10px rgba(13, 148, 136, 0.05);
        background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(13, 148, 136, 0.08) 100%);
    }
}

@keyframes flashBorder {
    0%, 100% {
        border-bottom-color: rgba(255, 255, 255, 0.15);
    }
    50% {
        border-bottom-color: rgba(253, 224, 71, 0.7); /* Flash soft gold edge */
    }
}

/* ==========================================================================
   Responsive Adaptations
   ========================================================================== */
@media (max-aspect-ratio: 1.2/1) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .display-container {
        height: auto;
        min-height: 100vh;
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .top-bar {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        text-align: center;
        justify-items: center;
    }
    
    .mosque-info {
        flex-direction: column;
    }
    
    .date-container {
        text-align: center;
        align-items: center;
    }
    
    .banner-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .prayer-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
}

@media (max-width: 768px) {
    .prayer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .prayer-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Advanced Feature Modes (Focus & Sleep)
   ========================================================================== */

/* Focus Mode: Hides distractions during Adhan to end of Salah */
body.focus-mode-active .slideshow-container,
body.focus-mode-active .weather-widget,
body.focus-mode-active .ticker-container,
body.focus-mode-active .urgent-bar {
    display: none !important;
}

body.focus-mode-active .main-content {
    align-items: center;
    justify-content: center;
}

body.focus-mode-active .banner-container {
    transform: scale(1.1);
    margin-top: 5rem;
}

/* Sleep Mode (Screensaver): Activates at night to prevent burn-in */
body.sleep-mode-active::before {
    content: "";
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #000 !important;
    z-index: 9000;
}

/* In sleep mode, only show the clock, dim it, and float it to prevent burn-in */
body.sleep-mode-active .top-bar {
    position: fixed;
    z-index: 9001;
    width: 100%;
    justify-content: center;
    top: 50%;
    transform: translateY(-50%);
    animation: screensaverFloat 30s infinite alternate ease-in-out;
}

body.sleep-mode-active .weather-widget,
body.sleep-mode-active .date-container {
    display: none !important;
}

body.sleep-mode-active .main-clock {
    color: #444 !important; /* Very dim grey */
    text-shadow: none !important;
    font-size: 8rem;
}

@keyframes screensaverFloat {
    0% { transform: translate(-10%, -50%); }
    25% { transform: translate(10%, -30%); }
    50% { transform: translate(5%, -70%); }
    75% { transform: translate(-15%, -40%); }
    100% { transform: translate(0, -60%); }
}

/* ==========================================================================
   Live UI Animations & Effects
   ========================================================================== */
@keyframes bgPan {
    0% { background-position: 0 0; }
    100% { background-position: 150px 150px; }
}

@keyframes textGlowPulse {
    0% { text-shadow: 0 0 15px var(--primary-glow); }
    50% { text-shadow: 0 0 35px var(--primary-color), 0 0 15px var(--primary-glow); }
    100% { text-shadow: 0 0 15px var(--primary-glow); }
}

@keyframes slideDownIn {
    0% { opacity: 0; transform: translateY(-30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes fadeUpIn {
    0% { opacity: 0; transform: translateY(30px); }
    100% { opacity: 1; transform: translateY(0); }
}

@keyframes floatActiveCard {
    0% { border-color: var(--card-active-border); transform: scale(1.02) translateY(0); box-shadow: 0 0 20px var(--primary-glow); }
    50% { border-color: var(--primary-color); transform: scale(1.04) translateY(-4px); box-shadow: 0 0 40px var(--primary-glow); }
    100% { border-color: var(--card-active-border); transform: scale(1.02) translateY(0); box-shadow: 0 0 20px var(--primary-glow); }
}

@keyframes floatActiveCardBright {
    0% { border-color: var(--card-active-border); transform: scale(1.02) translateY(0); box-shadow: 0 0 20px rgba(0,0,0,0.1); }
    50% { border-color: var(--primary-color); transform: scale(1.04) translateY(-4px); box-shadow: 0 0 30px rgba(0,0,0,0.2); }
    100% { border-color: var(--card-active-border); transform: scale(1.02) translateY(0); box-shadow: 0 0 20px rgba(0,0,0,0.1); }
}

@keyframes scaleUpIn {
    0% { opacity: 0; transform: scale(0.85); }
    100% { opacity: 1; transform: scale(1); }
}

@keyframes breatheFloat {
    0% { transform: translateY(0); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
    50% { transform: translateY(-5px); box-shadow: 0 16px 50px rgba(0,0,0,0.4); }
    100% { transform: translateY(0); box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
}
