/**
 * Islamic Glassmorphism Theme — Miqotul Khoir TV
 *
 * Port dari lib/core/theme/islamic_colors.dart + islamic_typography.dart
 * Menggunakan Poppins font (Google Fonts CDN) dan color palette yang sama.
 */

/* =========================================================================
   CSS Variables — Islamic Color Palette
   ========================================================================= */
:root {
    /* Primary Colors — Teal */
    --deep-teal: #075B5E;
    --primary-teal: #0E9296;
    --light-teal: #1CC0C5;

    /* Accent Colors — Gold/Amber */
    --gold-amber: #D4A012;
    --light-gold: #E8C547;
    --warm-gold: #F5D060;

    /* Background Colors */
    --dark-background: #041E1E;
    --surface-dark: #082E2E;
    --surface-light: #0F4343;

    /* Text Colors */
    --text-primary: #F5F5F5;
    --text-secondary: #B0C9C6;
    --text-muted: #739A95;

    /* Glassmorphism */
    --glass-white: rgba(255, 255, 255, 0.10);
    --glass-border: rgba(255, 255, 255, 0.20);
    --glass-overlay: rgba(255, 255, 255, 0.05);

    /* State Colors */
    --success: #4CAF50;
    --error: #E53935;
    --warning: #FFA726;
    --info: #42A5F5;

    /* Prayer State Colors */
    --standby-color: #075B5E;
    --pre-adzan-color: #14706E;
    --adzan-color: #D4A012;
    --iqomah-color: #B8860B;
    --sholat-color: #075B5E;
}

/* =========================================================================
   Base Reset & Typography
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

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

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Poppins', sans-serif;
    background-color: var(--dark-background);
    color: var(--text-primary);
    overflow-x: hidden;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* =========================================================================
   Islamic Background (gradient + subtle pattern)
   ========================================================================= */
.islamic-background {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: linear-gradient(135deg, var(--dark-background) 0%, var(--surface-dark) 50%, var(--deep-teal) 100%);
    z-index: -1;
}

.islamic-background::after {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(14, 146, 150, 0.08) 0%, transparent 60%),
                radial-gradient(circle at 20% 80%, rgba(212, 160, 18, 0.05) 0%, transparent 60%);
}

/* =========================================================================
   Glassmorphism Card
   ========================================================================= */
.glass-card {
    background: var(--glass-white);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 24px;
}

.glass-card-sm {
    background: var(--glass-white);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 16px;
}

/* =========================================================================
   Typography Classes
   ========================================================================= */
.text-display {
    font-size: 72px;
    font-weight: 700;
    letter-spacing: -1px;
}

.text-heading {
    font-size: 32px;
    font-weight: 600;
}

.text-title {
    font-size: 24px;
    font-weight: 600;
}

.text-subtitle {
    font-size: 18px;
    font-weight: 500;
}

.text-body {
    font-size: 16px;
    font-weight: 400;
}

.text-caption {
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
}

.text-overline {
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
}

/* Color utility classes */
.text-gold { color: var(--gold-amber); }
.text-teal { color: var(--primary-teal); }
.text-light-teal { color: var(--light-teal); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-white { color: var(--text-primary); }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.text-warning { color: var(--warning); }

/* =========================================================================
   Layout Utilities
   ========================================================================= */
.container {
    width: 100%;
    max-width: 1920px;
    margin: 0 auto;
    padding: 40px 5%;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.flex-center { justify-content: center; align-items: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-24 { gap: 24px; }
.gap-32 { gap: 32px; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.text-center { text-align: center; }
.relative { position: relative; }
.absolute { position: absolute; }
.hidden { display: none; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.p-16 { padding: 16px; }
.p-24 { padding: 24px; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    border: none;
    border-radius: 12px;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.btn-primary {
    background: var(--gold-amber);
    color: var(--dark-background);
}
.btn-primary:hover {
    background: var(--light-gold);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(212, 160, 18, 0.3);
}

.btn-secondary {
    background: var(--glass-white);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

.btn-outline {
    background: transparent;
    color: var(--gold-amber);
    border: 2px solid var(--gold-amber);
}
.btn-outline:hover {
    background: rgba(212, 160, 18, 0.1);
}

.btn-sm {
    padding: 8px 20px;
    font-size: 14px;
    border-radius: 8px;
}

.btn-lg {
    padding: 16px 48px;
    font-size: 18px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================================================
   Form Elements
   ========================================================================= */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text-primary);
    font-family: 'Poppins', sans-serif;
    font-size: 15px;
    transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(14, 146, 150, 0.2);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23739A95' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-check input[type="checkbox"] {
    width: 20px; height: 20px;
    accent-color: var(--primary-teal);
    cursor: pointer;
}

.form-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.form-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.form-toggle .slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--surface-light);
    border-radius: 28px;
    transition: 0.3s;
}

.form-toggle .slider::before {
    content: '';
    position: absolute;
    height: 22px; width: 22px;
    left: 3px; bottom: 3px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: 0.3s;
}

.form-toggle input:checked + .slider {
    background: var(--primary-teal);
}

.form-toggle input:checked + .slider::before {
    transform: translateX(24px);
    background: var(--text-primary);
}

/* =========================================================================
   Prayer Card Row
   ========================================================================= */
.prayer-cards-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.prayer-card {
    background: var(--glass-white);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 16px 24px;
    text-align: center;
    min-width: 120px;
    flex: 1;
    max-width: 180px;
    transition: all 0.3s ease;
}

.prayer-card.active {
    background: rgba(212, 160, 18, 0.15);
    border-color: var(--gold-amber);
}

.prayer-card.next {
    background: rgba(14, 146, 150, 0.15);
    border-color: var(--primary-teal);
}

.prayer-card .prayer-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.prayer-card .prayer-time {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

/* =========================================================================
   Digital Clock
   ========================================================================= */
.digital-clock {
    font-size: 96px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 2px;
    text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

.digital-clock-sm {
    font-size: 48px;
    font-weight: 600;
}

/* =========================================================================
   Countdown Timer
   ========================================================================= */
.countdown {
    font-size: 64px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.countdown-label {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* =========================================================================
   Progress Bar
   ========================================================================= */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-light);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 1s linear;
}

.progress-bar-fill.gold { background: var(--gold-amber); }
.progress-bar-fill.teal { background: var(--primary-teal); }

/* =========================================================================
   Running Text (Marquee)
   ========================================================================= */
.running-text-container {
    width: 100%;
    overflow: hidden;
    background: var(--glass-overlay);
    border-radius: 8px;
    padding: 10px 0;
}

.running-text {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 30s linear infinite;
    font-size: 16px;
    color: var(--text-secondary);
}

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

/* =========================================================================
   Splash Page
   ========================================================================= */
.splash-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 32px;
}

.splash-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--glass-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    border: 2px solid var(--glass-border);
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: var(--surface-light);
    border-radius: 2px;
    overflow: hidden;
}

.splash-loader::after {
    content: '';
    display: block;
    width: 40%;
    height: 100%;
    background: var(--gold-amber);
    border-radius: 2px;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

/* =========================================================================
   Setup Wizard
   ========================================================================= */
.wizard-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.step-indicator {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 40px;
}

.step-dot {
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--surface-light);
    transition: all 0.3s ease;
}

.step-dot.active {
    background: var(--gold-amber);
    box-shadow: 0 0 8px rgba(212, 160, 18, 0.4);
}

.step-dot.completed {
    background: var(--primary-teal);
}

.wizard-step {
    flex: 1;
    display: none;
    flex-direction: column;
    gap: 24px;
}

.wizard-step.active {
    display: flex;
}

.wizard-nav {
    display: flex;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 32px;
}

/* =========================================================================
   Settings Page
   ========================================================================= */
.settings-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 32px 24px;
}

.settings-section {
    margin-bottom: 32px;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--gold-amber);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--glass-border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--glass-overlay);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row-label {
    font-size: 15px;
    color: var(--text-secondary);
}

.settings-row-value {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stepper control */
.stepper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.stepper-btn {
    width: 36px; height: 36px;
    border-radius: 8px;
    background: var(--surface-light);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.stepper-btn:hover {
    background: var(--primary-teal);
}

.stepper-value {
    font-size: 16px;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

/* =========================================================================
   Main Display Layouts
   ========================================================================= */
.display-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 5%;
    gap: 24px;
    transition: opacity 0.5s ease;
}

/* Standby layout */
.standby-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    width: 100%;
}

.standby-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

/* Adzan / Pre-Adzan / Iqomah / Sholat layouts */
.state-banner {
    text-align: center;
    padding: 32px;
}

.state-banner-title {
    font-size: 28px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 8px;
}

.state-banner-prayer {
    font-size: 48px;
    font-weight: 700;
}

/* Midnight standby */
.midnight-layout {
    background: #000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

/* Wisdom Quote */
.wisdom-layout {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 10%;
    text-align: center;
    gap: 24px;
}

.wisdom-text {
    font-size: 28px;
    font-weight: 500;
    line-height: 1.6;
    color: var(--text-primary);
    max-width: 900px;
}

.wisdom-reference {
    font-size: 16px;
    font-weight: 500;
    color: var(--gold-amber);
}

.wisdom-badge {
    display: inline-block;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wisdom-badge.quran {
    background: rgba(14, 146, 150, 0.2);
    color: var(--light-teal);
    border: 1px solid rgba(14, 146, 150, 0.3);
}

.wisdom-badge.hadith {
    background: rgba(212, 160, 18, 0.2);
    color: var(--light-gold);
    border: 1px solid rgba(212, 160, 18, 0.3);
}

/* Treasury info */
.treasury-card {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}

.treasury-item {
    flex: 1;
    min-width: 150px;
    text-align: center;
}

/* =========================================================================
   Settings Icon (floating)
   ========================================================================= */
.settings-fab {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--glass-white);
    border: 1px solid var(--glass-border);
    color: var(--text-primary);
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.settings-fab.visible {
    opacity: 1;
}

.settings-fab:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* =========================================================================
   Responsive (for non-TV screens)
   ========================================================================= */
@media (max-width: 768px) {
    .digital-clock { font-size: 56px; }
    .countdown { font-size: 40px; }
    .text-display { font-size: 48px; }
    .text-heading { font-size: 24px; }
    .prayer-card { min-width: 80px; padding: 12px 16px; }
    .prayer-card .prayer-time { font-size: 18px; }
    .wisdom-text { font-size: 20px; }
    .container { padding: 24px 4%; }
}

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

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

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.fade-in { animation: fadeIn 0.5s ease forwards; }
.pulse { animation: pulse 2s ease-in-out infinite; }
.blink { animation: blink 1s step-end infinite; }

/* Colon blink for clock */
.clock-colon {
    animation: blink 1s step-end infinite;
}
