/* ==========================================================================
   Personal Website & Comprehensive Habit Tracker Stylesheet
   Modern, Dark Mode & RTL First Design
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --font-sans: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    
    /* Light Mode Palette */
    --bg-page: #f8fafc;
    --bg-surface: #ffffff;
    --bg-surface-secondary: #f1f5f9;
    --bg-surface-hover: #e2e8f0;
    --border-color: #e2e8f0;
    --border-subtle: #cbd5e1;
    
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --primary-text: #3730a3;
    
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;
    
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 82px;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

.dark {
    /* Dark Mode Palette (Zinc / Slate Modern Aesthetic) */
    --bg-page: #0b0f19;
    --bg-surface: #111827;
    --bg-surface-secondary: #1a2234;
    --bg-surface-hover: #242e42;
    --border-color: #1f293d;
    --border-subtle: #2d3b55;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.15);
    --primary-text: #c7d2fe;
    
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.15);
    --warning: #f59e0b;
    --warning-light: rgba(245, 158, 11, 0.15);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.15);
    --info: #06b6d4;
    --info-light: rgba(6, 182, 212, 0.15);

    --shadow-sm: 0 1px 3px 0 rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 8px -1px rgb(0 0 0 / 0.4);
    --shadow-lg: 0 10px 20px -3px rgb(0 0 0 / 0.5);
    --shadow-xl: 0 20px 30px -5px rgb(0 0 0 / 0.6);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-sans);
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    direction: rtl;
    text-align: right;
    transition: background-color 0.25s ease, color 0.25s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-subtle);
    border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout Elements */
#app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styles */
#sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-surface);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
    z-index: 40;
    position: relative;
    user-select: none;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed-width);
}

#sidebar.collapsed .sidebar-text,
#sidebar.collapsed .sidebar-badge {
    display: none !important;
}

#sidebar.collapsed .sidebar-brand-name {
    display: none !important;
}

#sidebar.collapsed .nav-item {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

#sidebar.collapsed .user-info {
    display: none !important;
}

/* Navigation Items */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 16px;
    border-radius: 12px;
    color: var(--text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    position: relative;
    margin-bottom: 4px;
}

.nav-item:hover {
    background-color: var(--bg-surface-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background-color: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.nav-item.active svg {
    color: var(--primary);
}

/* Header & Main Container */
#main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow-y: auto;
}

#top-header {
    height: 70px;
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 30;
    backdrop-filter: blur(8px);
}

.content-container {
    padding: 28px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Cards & Surfaces */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.card:hover {
    border-color: var(--border-subtle);
}

/* Habit Card Special Styles */
.habit-card {
    position: relative;
    overflow: hidden;
}

.habit-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background-color: var(--habit-color, var(--primary));
    border-radius: 4px 0 0 4px;
}

/* Week Strip Mini Circles */
.day-dot {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    background-color: var(--bg-surface-secondary);
    color: var(--text-muted);
    border: 1px solid transparent;
}

.day-dot.completed {
    background-color: var(--habit-color, var(--success));
    color: #ffffff;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.day-dot.today {
    border-color: var(--primary);
}

/* Checkbox Toggle Button */
.check-toggle-btn {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    background-color: var(--bg-surface-secondary);
    border: 2px solid var(--border-color);
    color: transparent;
}

.check-toggle-btn:hover {
    transform: scale(1.06);
    border-color: var(--habit-color, var(--primary));
}

.check-toggle-btn.completed {
    background-color: var(--habit-color, var(--success));
    border-color: var(--habit-color, var(--success));
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
    transform: scale(1.02);
}

/* Heatmap Grid */
.heatmap-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    direction: ltr; /* Keeps chronological order left to right */
}

.heatmap-cell {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background-color: var(--bg-surface-secondary);
    transition: transform 0.15s ease;
    cursor: pointer;
}

.heatmap-cell:hover {
    transform: scale(1.3);
    z-index: 10;
}

.heatmap-cell.level-0 { background-color: var(--bg-surface-secondary); }
.heatmap-cell.level-1 { background-color: #a7f3d0; }
.heatmap-cell.level-2 { background-color: #34d399; }
.heatmap-cell.level-3 { background-color: #059669; }
.heatmap-cell.level-4 { background-color: #047857; }

.dark .heatmap-cell.level-1 { background-color: #064e3b; }
.dark .heatmap-cell.level-2 { background-color: #047857; }
.dark .heatmap-cell.level-3 { background-color: #10b981; }
.dark .heatmap-cell.level-4 { background-color: #34d399; }

/* Modal Backdrop */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    max-width: 580px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

/* Toast Notifications */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 24px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 14px 20px;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    pointer-events: auto;
    animation: slideUp 0.3s ease forwards;
}

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

/* Mobile Responsiveness */
@media (max-width: 900px) {
    #sidebar {
        position: fixed;
        right: 0;
        top: 0;
        bottom: 0;
        height: 100vh;
        transform: translateX(100%);
        box-shadow: var(--shadow-xl);
    }

    #sidebar.mobile-open {
        transform: translateX(0);
    }

    #sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        z-index: 35;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    #sidebar-overlay.active {
        opacity: 1;
        pointer-events: auto;
    }

    .content-container {
        padding: 16px;
    }

    #top-header {
        padding: 0 16px;
    }
}

/* Pulse animation for active streak */
@keyframes flameGlow {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.4)); }
    50% { transform: scale(1.1); filter: drop-shadow(0 0 6px rgba(245, 158, 11, 0.8)); }
}

.streak-flame {
    animation: flameGlow 2s infinite ease-in-out;
}

/* Weekly Class Calendar Day Columns */
.calendar-day-col {
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.calendar-day-col:hover {
    border-color: rgba(99, 102, 241, 0.5);
}

.calendar-day-col.today {
    border-color: rgba(99, 102, 241, 0.7);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* Status Badges */
.badge-held {
    background-color: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-frozen {
    background-color: rgba(14, 165, 233, 0.15);
    color: #0ea5e9;
    border: 1px solid rgba(14, 165, 233, 0.3);
}

.badge-burned {
    background-color: rgba(244, 63, 94, 0.15);
    color: #f43f5e;
    border: 1px solid rgba(244, 63, 94, 0.3);
}

.badge-cancelled-teacher {
    background-color: rgba(168, 85, 247, 0.15);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.3);
}

.badge-scheduled {
    background-color: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

/* ==========================================================================
   ADHD Task Management & AI Shimmer Animations
   ========================================================================== */
@keyframes aiShimmer {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.ai-shimmer-btn {
    background: linear-gradient(270deg, #4f46e5, #9333ea, #db2777, #4f46e5);
    background-size: 300% 300%;
    animation: aiShimmer 4s ease infinite;
}

/* Micro-step checklist hover and check transitions */
.micro-step-item {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.micro-step-item:hover {
    transform: translateX(-2px);
}

/* Pulse badge for ADHD AI */
@keyframes softPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.85; transform: scale(1.03); }
}

.adhd-pulse-badge {
    animation: softPulse 3s infinite ease-in-out;
}

