/* CSS Custom Properties for Modern Islamic Theme */
:root {
    --bg-color: #071F14; /* Deep Forest Green */
    --surface-color: rgba(10, 27, 18, 0.7); /* Translucent Green */
    --surface-solid: #0A1B12;
    --primary-color: #E6C875; /* Elegant Gold */
    --primary-glow: rgba(230, 200, 117, 0.6);
    --text-main: #FFFFFF;
    --text-muted: #D1D8D4; /* Lighter muted text for better contrast */
    
    --success: #4CAF50;
    --danger: #F44336;

    --font-heading: 'Inter', sans-serif;
    --font-body: 'Inter', sans-serif;
    
    --radius-lg: 1.5vw;
    --radius-md: 1vw;
    --transition-slow: 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 0.4s ease;
}

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

html {
    /* 
      MAGIC STRICT SCALING: Using 'vw' locks every size strictly to the TV's width.
      This guarantees NO OVERLAP ever, as fonts shrink linearly with screens!
    */
    font-size: 0.9vw; 
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-body);
    width: 100vw;
    height: 100vh;
    overflow: hidden; /* No scrolling for TV display */
}

/* Background Canvas with Premium Image */
.background-canvas {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background-image: url('assets/bg-full.png'), linear-gradient(rgba(0,0,0,0.4), rgba(0,0,0,0.4));
    background-blend-mode: overlay;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* Utilities */
.text-gold { color: var(--primary-color); }
.text-green { color: var(--success); }
.text-red { color: var(--danger); }
.animate-pulse { animation: pulse 2s infinite; }

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Glassmorphism Panels */
.glass-panel {
    background: var(--surface-color);
    backdrop-filter: blur(24px) saturate(150%);
    -webkit-backdrop-filter: blur(24px) saturate(150%);
    border: 1px solid rgba(230, 200, 117, 0.2);
    border-radius: var(--radius-lg);
    box-shadow: 0 1.5vw 4vw rgba(0,0,0,0.6);
}

.app-container {
    width: 100%;
    height: 100%;
    position: relative;
    padding: 2rem;
}

.state-container {
    position: absolute;
    top: 2rem; bottom: 2rem;
    left: 2rem; right: 2rem;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    transform: scale(0.98);
}
.state-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: scale(1);
}

/* HEADER */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2.5rem;
    margin-bottom: 1.2rem;
    flex-shrink: 0;
    z-index: 10;
    position: relative;
}

/* Global Countdown Overlay */
.current-time-container {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}
.time-texts { text-align: right; }

.global-prayer-countdown {
    text-align: center;
    background: rgba(10, 27, 18, 0.5);
    padding: 1.2rem 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(230,200,117,0.3);
    box-shadow: inset 0 0 1vw rgba(0,0,0,0.5);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}
.countdown-label-small { font-size: 1.5rem; font-weight: 600; color: #fff; }
.header-countdown {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 20px var(--primary-glow);
    margin-top: 0.5rem;
}

/* Mosque Info & Logo */
.mosque-header-left {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}
.mosque-logo-wrapper {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 50%; /* Lingkaran elegan */
    background: #ffffff; /* Contrast canvas for logos */
    box-shadow: 0 0 1.5vw rgba(230, 200, 117, 0.4);
    border: 3px solid var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    flex-shrink: 0;
}
.mosque-logo-img {
    width: 85%;
    height: 85%;
    object-fit: contain;
}

.mosque-name { font-size: 3.5rem; font-weight: 800; margin-bottom: 0.5rem; }
.mosque-address { font-size: 1.6rem; color: var(--text-muted); }

.main-time { font-size: 5rem; font-weight: 800; color: var(--primary-color); line-height: 1; }
.main-date { font-size: 1.6rem; color: var(--text-muted); margin-top: 0.5rem; }
.hijri-date { font-size: 1.6rem; font-weight: 600; margin-top: 0.2rem; }

/* Slideshow Mechanism */
.slideshow-container {
    flex: 1;
    position: relative;
}
.slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    opacity: 0; visibility: hidden;
    transition: opacity var(--transition-slow);
    display: flex;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.slide.active { opacity: 1; visibility: visible; }

/* =========================================================
   PRAYER REDESIGN (Cards + Mosque Background)
   ========================================================= */
.slide-prayer-redesign {
    flex-direction: column;
    justify-content: center;
    position: relative;
    background: transparent; /* Rely on inner bg */
}

.prayer-bg-img {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Subtle overlay integrated with global background */
    background: radial-gradient(circle at center, transparent 0%, rgba(0,0,0,0.3) 100%);
    z-index: 1;
}

.prayer-overlay {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    /* Balanced gradient so text and cards pop out */
    background: linear-gradient(180deg, rgba(0,0,0,0.2) 0%, rgba(0,0,0,0) 50%, rgba(0,0,0,0.7) 100%);
    z-index: 2;
}

/* Prayer Cards Row */
.prayer-cards-container {
    position: absolute;
    bottom: 2rem;
    left: 2rem; right: 2rem;
    display: flex;
    flex-direction: row; /* Horizontal Cards */
    justify-content: space-between;
    gap: 1.5rem;
    z-index: 3;
}

.prayer-card {
    flex: 1;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    padding: 2rem 0.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid rgba(255,255,255,0.1);
    transition: all 0.5s ease;
    box-shadow: 0 0.8vw 2.5vw rgba(0,0,0,0.5);
    min-height: 12rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.prayer-card-name { font-size: 2.3rem; color: #fff; margin-bottom: 0.5rem; font-weight: 600; text-shadow: 0 2px 4px rgba(0,0,0,0.5); }
.prayer-card-time { font-size: 4rem; font-weight: 800; color: #fff; text-shadow: 0 4px 10px rgba(0,0,0,0.6); }

/* Inactive Cards Default Colors (Themed with high transparency and blur) */
.card-subuh { background: rgba(30, 40, 70, 0.5); }
.card-syuruq { background: rgba(80, 50, 20, 0.5); }
.card-dzuhur { background: rgba(20, 60, 80, 0.5); }
.card-ashar { background: rgba(80, 40, 20, 0.5); }
.card-maghrib { background: rgba(60, 20, 40, 0.5); }
.card-isya { background: rgba(15, 20, 40, 0.5); }

/* Highlight active/upcoming prayer card */
.prayer-card.highlight {
    transform: translateY(-1rem); /* Lift it up */
    background: rgba(15, 38, 26, 0.85); /* Solid focus */
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(230, 200, 117, 0.3);
}

.prayer-card.highlight .prayer-card-name,
.prayer-card.highlight .prayer-card-time {
    color: var(--primary-color);
    text-shadow: 0 0 10px var(--primary-glow);
}

/* =========================================================
   MEDIA & FINANCE SLIDES
   ========================================================= */
.media-container, .finance-container {
    width: 100%; height: 100%;
}
.media-container img {
    width: 100%; height: 100%; object-fit: cover;
}
.media-overlay {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.9) 0%, rgba(0,0,0,0.4) 60%, transparent 100%);
    padding: 4rem 3rem 2.5rem;
}
.media-overlay h2 { font-size: 3.5rem; color: var(--primary-color); margin-bottom: 1rem; }
.media-overlay p { font-size: 2rem; }

.finance-container { padding: 2rem 3rem; display: flex; flex-direction: column; height: 100%; border-radius: var(--radius-lg); }
.finance-header { display: flex; flex-direction: column; align-items: flex-start; gap: 1.5rem; margin-bottom: 2rem; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 1.5rem; }
.finance-header h2 { font-size: 4rem; font-weight: 800; margin-bottom: 0; color: var(--primary-color); text-transform: uppercase; letter-spacing: 2px; text-shadow: 0 0 15px var(--primary-glow); }
.finance-period { font-size: 2.2rem; color: #fff; font-weight: 600; background: rgba(230,200,117,0.15); padding: 0.5rem 2rem; border-radius: 50px; border: 1px solid rgba(230,200,117,0.4); }

.finance-grid { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 2rem; flex: 1; min-height: 0; }
.finance-card { 
    background: rgba(10, 27, 18, 0.5); 
    border: 1px solid rgba(255,255,255,0.15); 
    border-radius: var(--radius-lg); 
    padding: 1.5rem 2rem; 
    display: flex; 
    flex-direction: column; 
    justify-content: center; 
    align-items: center; 
    text-align: center;
    backdrop-filter: blur(15px); 
    box-shadow: 0 1vw 2.5vw rgba(0,0,0,0.5); 
    position: relative;
    overflow: hidden;
}
.finance-card::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at top, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}
.finance-card h4 { font-size: 1.8rem; color: #fff; margin-bottom: 0.8rem; text-transform: uppercase; letter-spacing: 3px; font-weight: 600; opacity: 0.9; }
.finance-card .amount { font-size: 4rem; font-weight: 800; color: #fff; line-height: 1; text-shadow: 0 4px 10px rgba(0,0,0,0.6); font-variant-numeric: tabular-nums; white-space: nowrap; }
.finance-card.total { background: rgba(230,200,117,0.12); border: 1px solid rgba(230,200,117,0.4); transform: scale(1.02); }
.finance-card.total h4 { color: var(--primary-color); font-size: 2rem; }
.finance-card.total .amount { color: var(--primary-color); text-shadow: 0 0 25px var(--primary-glow); font-size: 5rem; white-space: nowrap; }

/* Progress Bar */
.progress-bar { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; margin-top: 2rem; flex-shrink: 0; overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--primary-color); transition: width linear; }

/* =========================================================
   ADZAN & SHALAT Focus States
   ========================================================= */
.focus-container {
    display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
    background: var(--surface-solid); border-radius: var(--radius-lg); border: 2px solid rgba(230, 200, 117, 0.2); padding: 4rem;
    box-shadow: inset 0 0 15vw rgba(0,0,0,0.8);
}
.adzan-header h2 { font-size: 2.5rem; font-weight: 800; margin-bottom: 1.5rem; }
.iqomah-label { font-size: 6rem; font-weight: 800; color: var(--primary-color); text-transform: uppercase; letter-spacing: 4px; }
.massive-countdown { font-size: 19vw; font-weight: 800; line-height: 1; color: var(--primary-color); text-shadow: 0 0 60px var(--primary-glow); font-variant-numeric: tabular-nums; margin: 1rem 0; }
.adzan-footer p { font-size: 3.5rem; color: var(--text-muted); margin-top: 1rem; }

.minimal { background: #030a06; border: none; }
.shalat-circle { width: 15vw; height: 15vw; border-radius: 50%; background: radial-gradient(circle, rgba(230,200,117,0.15) 0%, transparent 70%); animation: pulse 4s infinite alternate; margin-bottom: 3rem; }
#state-shalat h2 { font-size: 5rem; color: var(--text-muted); margin-bottom: 2rem; }
.massive-text { font-size: 9rem; font-weight: 800; color: var(--primary-color); margin-bottom: 3rem; }
.subtle-text { font-size: 2.2rem; color: rgba(255,255,255,0.4); max-width: 80%; }

/* =========================================================
   MEDIA FULLSCREEN (media-active mode)
   ========================================================= */
#app.media-active {
    padding: 0;
}

#app.media-active #state-normal {
    top: 0; left: 0; right: 0; bottom: 0;
}

#app.media-active .main-header {
    position: fixed !important;
    top: 1.5rem !important;
    right: 2rem !important;
    bottom: auto !important;
    left: auto !important;
    width: auto !important;
    z-index: 200 !important;
    padding: 0.6rem 2.2rem !important;
    background: rgba(5, 20, 12, 0.85) !important;
    border: 1px solid rgba(230, 200, 117, 0.35) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    display: flex !important;
    gap: 1.8rem !important;
    justify-content: center !important;
    align-items: center !important;
    border-radius: 100px !important;
    box-shadow: 0 4px 30px rgba(0,0,0,0.7), 0 0 20px rgba(230,200,117,0.1) !important;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
    margin: 0 !important;
}

#app.media-active .mosque-header-left {
    display: none !important;
}

#app.media-active .mosque-address,
#app.media-active .mosque-logo-wrapper,
#app.media-active .hijri-date,
#app.media-active .main-date,
#app.media-active .time-texts br {
    display: none !important;
}

#app.media-active .mosque-name {
    display: none !important;
}

#app.media-active .current-time-container {
    gap: 2rem !important;
}

#app.media-active .main-time {
    font-size: 4.2rem !important;
    color: var(--primary-color) !important;
    text-shadow: 0 0 20px var(--primary-glow) !important;
}

#app.media-active .global-prayer-countdown {
    padding: 0.4rem 1.6rem !important;
    background: rgba(230, 200, 117, 0.1) !important;
    border-radius: 50px !important;
    border: 1px solid rgba(230, 200, 117, 0.25) !important;
}

#app.media-active .countdown-label-small {
    font-size: 1.6rem !important;
}

#app.media-active .header-countdown {
    font-size: 4.2rem !important;
    display: block !important;
    margin-top: 0 !important;
    text-shadow: 0 0 20px var(--primary-glow) !important;
}

/* Expansion of slideshow to actual fullscreen */
#app.media-active .slideshow-container {
    position: fixed;
    top: 0; left: 0; 
    width: 100vw; height: 100vh;
    z-index: 10;
}

#app.media-active .slide-dynamic-media {
    border-radius: 0; /* Remove rounded corners in fullscreen */
    width: 100vw; height: 100vh;
}

#app.media-active .slide-dynamic-media img,
#app.media-active .slide-dynamic-media video {
    border-radius: 0;
    object-fit: contain !important;
}

#app.media-active .progress-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    margin: 0;
    height: 8px;
    z-index: 201;
    border-radius: 0;
    background: rgba(0,0,0,0.3);
}

#app.media-active .progress-fill {
    border-radius: 0;
}

/* DEBUG UI Hide */
#app.media-active #debug-panel { opacity: 0; }

/* Refresh Button Styles */
.btn-refresh {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: var(--surface-solid);
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 999;
    transition: all 0.3s ease;
    box-shadow: 0 0.5vw 1.5vw rgba(0,0,0,0.5);
    opacity: 0.3; /* Subtle by default */
}

.btn-refresh:hover {
    opacity: 1;
    transform: rotate(180deg) scale(1.1);
    background: var(--primary-color);
    color: var(--bg-color);
    box-shadow: 0 0 20px var(--primary-glow);
}

.btn-refresh svg {
    width: 2rem;
    height: 2rem;
}

.btn-refresh.loading {
    animation: spin 1s linear infinite;
}

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

/* --- PREMIUM IQOMAH STATE CSS --- */
.iqomah-timer-card { background: #092314; border: 0.3vh solid #234c32; border-radius: 3vh; padding: 5vh 5vw; box-shadow: 0 2vh 4vh rgba(0,0,0,0.7); margin-bottom: 2vh; position: relative; width: 90%; max-width: 1700px; box-sizing: border-box; }
.iqomah-top-header { color: #fff; font-size: 2.8vh; font-weight: 600; letter-spacing: 4px; margin-bottom: 2vh; }
.iqomah-top-header .ornament { color: #E6C875; margin: 0 1vw; font-size: 2.2vh; }
.iqomah-label-container { display: flex; align-items: center; justify-content: center; margin-bottom: 1vh; }
.ornament-line-left, .ornament-line-right { height: 1px; background: linear-gradient(90deg, transparent, #E6C875); flex: 1; max-width: 15vw; }
.ornament-line-right { background: linear-gradient(270deg, transparent, #E6C875); }
.iqomah-label { font-size: 7vh; font-weight: 800; color: #fff; letter-spacing: 6px; margin: 0 3vw; text-shadow: 0 0.5vh 1.5vh rgba(0,0,0,0.5); }
.timer-display { position: relative; margin-bottom: 2vh; }
.timer-labels { display: flex; align-items: center; justify-content: space-between; margin-top: -1.5vh; padding: 0 10vw; }
.label-line-left, .label-line-right { height: 2px; background: rgba(230, 200, 117, 0.4); flex: 1; }
.label-text { font-size: 2.5vh; color: #E6C875; letter-spacing: 3px; margin: 0 4vw; font-weight: 700; }
#state-adzan .massive-countdown { font-size: 45vh; line-height: 0.9; margin: 0; padding: 0; color: #E6C875; text-shadow: 0 0 5vh rgba(230, 200, 117, 0.3); }
.iqomah-message-card { background: #fdfaf0; border-radius: 3vh; display: flex; align-items: stretch; width: 85%; max-width: 1600px; padding: 3vh 3vw; box-shadow: 0 1.5vh 3vh rgba(0,0,0,0.5); text-align: left; margin-top: -6vh; z-index: 5; position: relative; border: 0.4vh solid #e2d1a3; box-sizing: border-box; }
.msg-icon-box { background: #092314; border-radius: 50%; width: 13vh; height: 13vh; display: flex; align-items: center; justify-content: center; border: 0.3vh solid #E6C875; margin-right: 2vw; flex-shrink: 0; }
.msg-icon-box svg { width: 6vh; height: 6vh; }
.msg-content { flex: 2; display: flex; flex-direction: column; justify-content: center; padding-right: 2vw; }
#iqomah-message-title { font-size: 3.5vh; color: #092314; font-weight: 800; margin: 0 0 1vh 0; line-height: 1.2; }
#iqomah-message-subtitle { font-size: 2.3vh; color: #333; margin: 0; line-height: 1.5; font-weight: 600; }
.msg-divider { width: 0.3vh; background: #e2d1a3; margin: 0 1.5vw; flex-shrink: 0; }
.msg-quote-box { flex: 1.5; display: flex; align-items: flex-start; padding-left: 1.5vw; }
.quote-icon { font-size: 7vh; color: #092314; line-height: 1; margin-right: 1vw; font-family: serif; margin-top: -1vh; }
#iqomah-message-quote { font-size: 2.1vh; color: #444; font-style: italic; margin: 0; line-height: 1.5; margin-top: 1.5vh; font-weight: 600; }

/* --- SLIDE JUMAT INFO --- */
.jumat-info-container {
    background: #fdfbf7; /* Cream Beige */
    color: #0a1f11;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 0.4vh solid #d4af37; /* Gold border */
}
.jumat-info-container .jumat-header {
    text-align: center;
    margin-bottom: 5vh;
}
.jumat-info-container h2 {
    font-size: 8vh;
    color: #1a4f2d; /* Green */
    font-weight: 900;
    margin: 0 0 1vh 0;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.jumat-info-container .jumat-date {
    font-size: 3vh;
    color: #d4af37; /* Gold */
    font-weight: 700;
    background: #1a4f2d;
    padding: 1vh 3vw;
    border-radius: 5vh;
    display: inline-block;
}
.jumat-info-container .jumat-content {
    display: flex;
    gap: 4vw;
    width: 90%;
    max-width: 1400px;
}
.jumat-info-container .jumat-khatib-box {
    background: #1a4f2d;
    color: white;
    border-radius: 3vh;
    padding: 6vh 4vw;
    text-align: center;
    flex: 1.5;
    border: 0.3vh solid #d4af37;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 1vh 3vh rgba(0,0,0,0.1);
}
.jumat-info-container .jumat-khatib-box h3 {
    margin: 0 0 2vh 0;
    font-size: 3.5vh;
    color: #fdfbf7;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
}
.jumat-info-container .khatib-name {
    font-size: 6.5vh;
    font-weight: 900;
    line-height: 1.2;
    color: #d4af37;
}

.jumat-info-container .jumat-side-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3vh;
    justify-content: center;
}

.jumat-info-container .petugas-card {
    background: white;
    border-radius: 2vh;
    padding: 3vh 3vw;
    border-left: 1vw solid #d4af37;
    box-shadow: 0 1vh 2vh rgba(0,0,0,0.05);
}
.jumat-info-container .petugas-card h4 {
    margin: 0 0 1vh 0;
    font-size: 2.2vh;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.jumat-info-container .petugas-name-small {
    font-size: 4vh;
    font-weight: 800;
    color: #1a4f2d;
}
.jumat-info-container .jumat-time-small {
    font-size: 4.5vh;
    font-weight: 900;
    color: #1a4f2d;
}
