/**
 * ============================================================
 * HODA DESIGN SYSTEM (طراحی جامع سامانه معنوی و فرهنگی هُدی)
 * Dual-Mode Semantic Architecture: Obsidian Dark & Clean Light
 * High-Contrast Typography (WCAG AAA) & Cute Animated Floating Dock
 * ============================================================
 */

:root,
[data-theme="dark"] {
    /* Obsidian Dark Mode Palette */
    --hoda-canvas: #06080D;
    --hoda-bg: #0B0F15;
    --hoda-surface: #101621;
    --hoda-surface-elevated: rgba(20, 25, 34, 0.85);
    --hoda-surface-glass: rgba(16, 22, 33, 0.82);
    --hoda-surface-border: rgba(255, 255, 255, 0.08);
    --hoda-card-bg: rgba(19, 27, 38, 0.78);

    /* Antique Brushed Gold Accents */
    --hoda-gold: #D4B26F;
    --hoda-gold-light: #F1DDAF;
    --hoda-gold-dark: #BA944F;
    --hoda-gold-gradient: linear-gradient(135deg, #E0BE7B 0%, #BA944F 100%);
    --hoda-gold-glow: rgba(212, 178, 111, 0.4);
    --hoda-gold-dim: rgba(212, 178, 111, 0.15);

    /* Text Hierarchy */
    --hoda-text: #FFFFFF;
    --hoda-text-secondary: #CBD5E1;
    --hoda-text-muted: #94A3B8;
    --hoda-text-inverse: #0B0F15;

    /* Semantic Status */
    --hoda-emerald: #10B981;
    --hoda-amber: #FFA726;
    --hoda-danger: #EF4444;

    /* Floating Dock */
    --hoda-dock-bg: rgba(16, 22, 33, 0.94);
    --hoda-dock-border: rgba(255, 255, 255, 0.12);
    --hoda-dock-text: #64748B;
    --hoda-dock-active: #D4B26F;

    /* Shadows */
    --hoda-shadow-card: 0 4px 20px rgba(0, 0, 0, 0.4);
    --hoda-shadow-dock: 0 10px 35px rgba(0, 0, 0, 0.65), 0 0 15px rgba(212, 178, 111, 0.1);
}

[data-theme="light"] {
    /* Clean Light Mode Palette (Ultra-high contrast WCAG AAA) */
    --hoda-canvas: #E2E8F0;
    --hoda-bg: #F8FAFC;
    --hoda-surface: #FFFFFF;
    --hoda-surface-elevated: #FFFFFF;
    --hoda-surface-glass: rgba(255, 255, 255, 0.94);
    --hoda-surface-border: #CBD5E1;
    --hoda-card-bg: #FFFFFF;

    /* High-Contrast Warm Amber Gold for Light Mode */
    --hoda-gold: #B45309;
    --hoda-gold-light: #D97706;
    --hoda-gold-dark: #78350F;
    --hoda-gold-gradient: linear-gradient(135deg, #D97706 0%, #B45309 100%);
    --hoda-gold-glow: rgba(180, 83, 9, 0.3);
    --hoda-gold-dim: rgba(245, 158, 11, 0.15);

    /* Text Hierarchy */
    --hoda-text: #0F172A;
    --hoda-text-secondary: #334155;
    --hoda-text-muted: #475569;
    --hoda-text-inverse: #FFFFFF;

    /* Semantic Status */
    --hoda-emerald: #047857;
    --hoda-amber: #B45309;
    --hoda-danger: #B91C1C;

    /* Floating Dock */
    --hoda-dock-bg: rgba(255, 255, 255, 0.96);
    --hoda-dock-border: rgba(203, 213, 225, 0.9);
    --hoda-dock-text: #64748B;
    --hoda-dock-active: #B45309;

    /* Shadows */
    --hoda-shadow-card: 0 4px 16px rgba(0, 0, 0, 0.06);
    --hoda-shadow-dock: 0 10px 30px rgba(0, 0, 0, 0.12), 0 0 10px rgba(180, 83, 9, 0.08);
}

/* Base Metrics & Safe Area */
:root {
    --hoda-radius-sm: 10px;
    --hoda-radius-md: 16px;
    --hoda-radius-lg: 24px;
    --hoda-radius-xl: 32px;
    --hoda-radius-pill: 9999px;

    --z-base: 1;
    --z-header: 40;
    --z-dock: 50;
    --z-modal: 100;
    --z-toast: 120;

    --sat: env(safe-area-inset-top, 0px);
    --sab: env(safe-area-inset-bottom, 0px);
    --nav-height: 72px;
}

/* Reset & Persian Typography */
*, *::before, *::after, input, button, select, textarea {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-feature-settings: 'ss01' 1, 'ss02' 1 !important;
}

html, body {
    width: 100%;
    height: 100%;
    background-color: var(--hoda-canvas);
    color: var(--hoda-text);
    font-family: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, sans-serif !important;
    font-feature-settings: 'ss01' 1, 'ss02' 1 !important;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    direction: rtl;
    text-align: right;
    overflow-x: hidden;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Ensure .font-mono and numbers use Vazirmatn Persian digits with tabular spacing */
.font-mono, [class*="font-mono"], code, pre, kbd, samp {
    font-family: 'Vazirmatn', system-ui, monospace !important;
    font-feature-settings: 'ss01' 1, 'ss02' 1, 'tnum' 1 !important;
    font-variant-numeric: tabular-nums;
}

/* App Container Frame */
.app-container {
    width: 100%;
    max-width: 440px;
    height: 100dvh;
    margin: 0 auto;
    background-color: var(--hoda-bg);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.35);
}

@media (min-width: 640px) {
    .app-container {
        height: 94dvh;
        margin-top: 3dvh;
        border-radius: var(--hoda-radius-xl);
        border: 1px solid var(--hoda-surface-border);
    }
}

/* Scrollable Main Content */
.main-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + var(--sab) + 32px) !important;
    scrollbar-width: none;
}
.main-content::-webkit-scrollbar {
    display: none;
}

/* Cards & Glassmorphic Surfaces */
.glass-panel {
    background: var(--hoda-card-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--hoda-surface-border);
    border-radius: var(--hoda-radius-lg);
    box-shadow: var(--hoda-shadow-card);
    transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.glass-gold-panel {
    background: linear-gradient(145deg, var(--hoda-surface-elevated) 0%, var(--hoda-surface) 100%);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1.5px solid var(--hoda-gold);
    border-radius: var(--hoda-radius-lg);
    box-shadow: 0 8px 28px var(--hoda-gold-glow);
}

/* ============================================================
   LIGHT MODE CONTRAST OVERRIDES (WCAG AAA PERFECT CONTRAST)
   ============================================================ */
[data-theme="light"] .text-white:not(.force-white):not(#tasbihCountDisplay):not(.tasbih-count),
[data-theme="light"] h1:not(.force-white),
[data-theme="light"] h2:not(.force-white),
[data-theme="light"] h3:not(.force-white),
[data-theme="light"] h4:not(.force-white) {
    color: #0F172A !important;
}

[data-theme="light"] .text-slate-300,
[data-theme="light"] .text-slate-200 {
    color: #334155 !important;
}

[data-theme="light"] .text-slate-400 {
    color: #475569 !important;
}

[data-theme="light"] .bg-white\/5,
[data-theme="light"] .bg-white\/10 {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

[data-theme="light"] .border-white\/5,
[data-theme="light"] .border-white\/10,
[data-theme="light"] .border-white\/15,
[data-theme="light"] .border-white\/20,
[data-theme="light"] .border-white\/30 {
    border-color: rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] input,
[data-theme="light"] select {
    background-color: #F1F5F9 !important;
    color: #0F172A !important;
    border-color: #CBD5E1 !important;
}

[data-theme="light"] input::placeholder {
    color: #94A3B8 !important;
}

/* Specific Dark Containers and Icons that must ALWAYS retain white text */
#tasbihCountDisplay,
.tasbih-count,
.force-white,
.force-white *,
.header-action-icon,
[data-theme="light"] #tasbihCountDisplay,
[data-theme="light"] .tasbih-count,
[data-theme="light"] .force-white,
[data-theme="light"] .force-white *,
[data-theme="light"] .header-action-icon {
    color: #FFFFFF !important;
}




/* ============================================================
   CUTE ANIMATED FLOATING BOTTOM DOCK
   ============================================================ */
.cute-dock-wrapper {
    position: absolute;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 14px;
    right: 14px;
    z-index: 50;
}

.cute-dock {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 8px 12px;
    background: var(--hoda-dock-bg);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid var(--hoda-dock-border);
    border-radius: var(--hoda-radius-pill);
    box-shadow: var(--hoda-shadow-dock);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cute-dock-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 10px;
    border-radius: var(--hoda-radius-pill);
    color: var(--hoda-dock-text);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    user-select: none;
}

.cute-dock-item i,
.cute-dock-item svg {
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), color 0.25s ease;
}

.cute-dock-item span {
    transition: color 0.25s ease, transform 0.25s ease, font-weight 0.25s ease;
}

/* Cute Active Bounce & Glow */
.cute-dock-item.active {
    color: var(--hoda-dock-active) !important;
    font-weight: 800;
    transform: translateY(-5px);
    background: var(--hoda-gold-dim);
}

.cute-dock-item.active i,
.cute-dock-item.active svg {
    color: var(--hoda-dock-active) !important;
    animation: cuteIconBounce 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes cuteIconBounce {
    0% { transform: scale(0.7) rotate(-12deg); }
    50% { transform: scale(1.35) rotate(8deg); }
    75% { transform: scale(0.95) rotate(-3deg); }
    100% { transform: scale(1.1) rotate(0deg); }
}

.cute-dock-indicator {
    position: absolute;
    top: 2px;
    width: 18px;
    height: 3px;
    border-radius: 9999px;
    background: var(--hoda-gold-gradient);
    box-shadow: 0 2px 8px var(--hoda-gold-glow);
    opacity: 0;
    transform: scaleX(0.2);
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cute-dock-item.active .cute-dock-indicator {
    opacity: 1;
    transform: scaleX(1);
}

/* Cute Tap Ripple / Press Effect */
.cute-dock-item:active {
    transform: scale(0.88);
}

.ripple-btn {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.ripple-btn:active {
    transform: scale(0.95);
}

/* ============================================================
   CALENDAR & TODAY CELL GLOW KEYFRAMES
   ============================================================ */
@keyframes todayGlowPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(212, 178, 111, 0.45), inset 0 0 0 1px rgba(212, 178, 111, 0.7);
    }
    50% {
        box-shadow: 0 0 14px 4px rgba(212, 178, 111, 0.22), inset 0 0 0 1.5px rgba(212, 178, 111, 1);
    }
}

.today-cell-glow {
    animation: todayGlowPulse 2.4s infinite ease-in-out;
}

[data-theme="light"] .today-cell-glow {
    animation: todayGlowPulseLight 2.4s infinite ease-in-out;
}

@keyframes todayGlowPulseLight {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(180, 83, 9, 0.35), inset 0 0 0 1px rgba(180, 83, 9, 0.6);
    }
    50% {
        box-shadow: 0 0 12px 3px rgba(180, 83, 9, 0.18), inset 0 0 0 1.5px rgba(180, 83, 9, 0.9);
    }
}

/* ============================================================
   CUSTOM COMPACT SCROLLBAR & NO-SCROLLBAR
   ============================================================ */
.hoda-scrollbar::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}
.hoda-scrollbar::-webkit-scrollbar-track {
    background: transparent;
}
.hoda-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(212, 178, 111, 0.3);
    border-radius: 4px;
}
.hoda-scrollbar::-webkit-scrollbar-thumb:hover {
    background: rgba(212, 178, 111, 0.6);
}
[data-theme="light"] .hoda-scrollbar::-webkit-scrollbar-thumb {
    background: rgba(180, 83, 9, 0.3);
}

.no-scrollbar::-webkit-scrollbar {
    display: none !important;
}
.no-scrollbar {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* ============================================================
   DAILY TASK MANAGER (TO-DO) STYLING & ANIMATIONS
   ============================================================ */
.task-item-done {
    text-decoration: line-through;
    opacity: 0.55;
    transition: all 0.3s ease;
}

.task-checkbox-custom {
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.task-checkbox-custom:active {
    transform: scale(0.85);
}

.task-enter-anim {
    animation: taskSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes taskSlideIn {
    0% {
        opacity: 0;
        transform: translateY(-8px) scale(0.98);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ============================================================
   GLASSMORPHIC MICRO-MODAL KEYFRAMES
   ============================================================ */
@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.95) translateY(6px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-enter-anim {
    animation: modalFadeIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ============================================================
   SYSTEM TOAST & NOTIFICATION NOTIFIER
   ============================================================ */
#appToast {
    z-index: var(--z-toast, 120);
    transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] #appToast {
    background-color: #FFFFFF !important;
    color: #0F172A !important;
    border: 1px solid #CBD5E1 !important;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.08) !important;
}

[data-theme="dark"] #appToast {
    background-color: rgba(16, 22, 33, 0.96) !important;
    color: #FFFFFF !important;
    border: 1px solid rgba(212, 178, 111, 0.3) !important;
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.65), 0 0 15px rgba(212, 178, 111, 0.1) !important;
}

/* ============================================================
   STUDIO MEDIA THUMBNAIL & AVATAR RESPONSIVE CONSTRAINTS
   Prevents oversized icons and avatars on mobile devices
   ============================================================ */
.studio-thumb-box {
    width: 64px !important;
    height: 64px !important;
    min-width: 64px !important;
    min-height: 64px !important;
    max-width: 64px !important;
    max-height: 64px !important;
    flex-shrink: 0 !important;
    overflow: hidden !important;
    border-radius: 1rem !important;
}

@media (min-width: 640px) {
    .studio-thumb-box {
        width: 80px !important;
        height: 80px !important;
        min-width: 80px !important;
        min-height: 80px !important;
        max-width: 80px !important;
        max-height: 80px !important;
    }
}

.studio-thumb-box img {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

.studio-thumb-box svg {
    width: 28px !important;
    height: 28px !important;
    max-width: 28px !important;
    max-height: 28px !important;
    flex-shrink: 0 !important;
    display: block !important;
}


