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

:root {
    --bg-gradient: linear-gradient(135deg, #f0f4f3 0%, #e1ebe7 100%);
    --surface-color: rgba(255, 255, 255, 0.75);
    --surface-solid: #ffffff;
    --glass-border: rgba(255, 255, 255, 0.6);
    --primary-color: #4a7c64;
    --primary-gradient: linear-gradient(135deg, #5b9278 0%, #3e6b55 100%);
    --primary-hover: #3e6b55;
    --text-main: #2d3748;
    --text-muted: #64748b;
    --border-color: rgba(203, 213, 225, 0.5);
    --danger-color: #e11d48;
    --danger-bg: #ffe4e6;
    --success-color: #059669;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-soft: 0 10px 40px -10px rgba(74, 124, 100, 0.15);
    --shadow-hover: 0 15px 45px -5px rgba(74, 124, 100, 0.25);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body.dark-theme {
    --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    --surface-color: rgba(30, 41, 59, 0.7);
    --surface-solid: #1e293b;
    --glass-border: rgba(255, 255, 255, 0.05);
    --primary-color: #5eead4;
    --primary-gradient: linear-gradient(135deg, #2dd4bf 0%, #0d9488 100%);
    --primary-hover: #14b8a6;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: rgba(51, 65, 85, 0.6);
    --danger-color: #f87171;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --shadow-soft: 0 10px 40px -10px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 15px 45px -5px rgba(0, 0, 0, 0.7);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: 'Vazirmatn', sans-serif; }

body { background: var(--bg-gradient); background-attachment: fixed; color: var(--text-main); line-height: 1.6; min-height: 100vh; transition: var(--transition); }

.app-background { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; z-index: -1; overflow: hidden; pointer-events: none; }
.app-background::before, .app-background::after { content: ''; position: absolute; border-radius: 50%; filter: blur(80px); opacity: 0.4; }
.app-background::before { width: 400px; height: 400px; background: var(--primary-color); top: -100px; right: -100px; }
.app-background::after { width: 300px; height: 300px; background: #fbbf24; bottom: 10%; left: -50px; opacity: 0.15; }
body.dark-theme .app-background::after { background: #6366f1; opacity: 0.2; }

.glass-panel { background: var(--surface-color); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid var(--glass-border); box-shadow: var(--shadow-soft); }
.app-container { display: flex; min-height: 100vh; padding: 1rem; gap: 1rem; max-width: 1400px; margin: 0 auto; }

/* === Design System: Buttons === */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
    font-family: inherit; font-weight: 600; cursor: pointer;
    border: none; outline: none; border-radius: var(--radius-md);
    transition: var(--transition); user-select: none;
}
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.85rem; }
.btn-md { padding: 0.6rem 1.2rem; font-size: 1rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1.1rem; }
.full-width { width: 100%; }

.btn-primary { background: var(--primary-gradient); color: white; box-shadow: 0 4px 15px rgba(74, 124, 100, 0.3); }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(74, 124, 100, 0.4); }

.btn-secondary { background: var(--surface-solid); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-secondary:hover:not(:disabled) { border-color: var(--primary-color); color: var(--primary-color); }

.btn-danger { background: var(--danger-bg); color: var(--danger-color); }
.btn-danger:hover:not(:disabled) { background: #fecdd3; }
body.dark-theme .btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.2); }

.btn-icon { padding: 0.5rem; background: transparent; color: var(--text-muted); font-size: 1.3rem; border-radius: var(--radius-sm); border: none; }
.btn-icon:hover:not(:disabled) { background: var(--border-color); color: var(--primary-color); }
.btn-icon.danger:hover:not(:disabled) { background: var(--danger-bg); color: var(--danger-color); }

.pulse-btn { animation: softPulse 2s infinite; }
@keyframes softPulse { 0% { box-shadow: 0 0 0 0 rgba(74, 124, 100, 0.4); } 70% { box-shadow: 0 0 0 10px rgba(74, 124, 100, 0); } 100% { box-shadow: 0 0 0 0 rgba(74, 124, 100, 0); } }
/* ============================= */

/* Sidebar & Layout */
.sidebar { width: 280px; border-radius: var(--radius-lg); padding: 2rem 1.5rem; display: flex; flex-direction: column; transition: var(--transition); }
.brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 3.5rem; }
.brand-icon-wrapper { background: var(--primary-gradient); color: white; width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; border-radius: 14px; font-size: 1.5rem; box-shadow: 0 4px 15px rgba(74, 124, 100, 0.4); }
.brand h1 { font-size: 1.8rem; font-weight: 800; letter-spacing: -1px; }

.nav-menu { display: flex; flex-direction: column; gap: 0.5rem; }
.nav-item { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; border: none; background: transparent; color: var(--text-muted); font-size: 1.05rem; font-weight: 500; border-radius: var(--radius-md); cursor: pointer; transition: var(--transition); }
.nav-item i { font-size: 1.4rem; transition: transform 0.3s; }
.nav-item:hover { background: rgba(74, 124, 100, 0.08); color: var(--primary-color); padding-right: 1.5rem; }
.nav-item:hover i { transform: scale(1.1); }
.nav-item.active { background: var(--primary-color); color: white; box-shadow: 0 4px 15px rgba(74,124,100,0.3); }

.main-content { flex: 1; display: flex; flex-direction: column; gap: 1rem; }
.top-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; border-radius: var(--radius-lg); }
.menu-toggle { display: none; font-size: 1.8rem; color: var(--text-main); }
.header-info { display: flex; align-items: center; gap: 1.5rem; font-weight: 500; }
.time-badge { background: var(--bg-gradient); padding: 0.4rem 1rem; border-radius: 20px; display: flex; align-items: center; gap: 0.5rem; color: var(--primary-color); font-weight: 700; border: 1px solid var(--border-color); }

.page-section { display: none; padding: 1rem; animation: slideUpFade 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; opacity: 0; transform: translateY(15px); }
.page-section.active-section { display: block; }
@keyframes slideUpFade { to { opacity: 1; transform: translateY(0); } }

.section-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 2rem; }
.section-header h2 { font-size: 2rem; font-weight: 800; margin-bottom: 0.2rem; }
.welcome-section { margin-bottom: 2rem; padding-top: 1rem; }
.greeting-title { font-size: 2.5rem; font-weight: 800; margin-bottom: 0.5rem; display: flex; align-items: center; gap: 0.8rem; }
.greeting-subtitle { font-size: 1.1rem; color: var(--text-muted); }
.highlight-text { color: var(--primary-color); font-size: 1.3rem; }

/* Cards & Progress */
.card { padding: 1.5rem; border-radius: var(--radius-lg); transition: var(--transition); }
.card-header-icon { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.card-header-icon h3 { font-size: 1.2rem; font-weight: 700; }
.card-header-icon i { font-size: 1.8rem; opacity: 0.8; }
.dashboard-grid, .settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }

.progress-bar-container { width: 100%; height: 10px; background: rgba(0,0,0,0.05); border-radius: 20px; margin: 1rem 0; overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.1); }
body.dark-theme .progress-bar-container { background: rgba(255,255,255,0.05); }
.progress-bar { height: 100%; background: var(--primary-gradient); border-radius: 20px; transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1); }
.progress-text { font-weight: 500; font-size: 0.95rem; }

/* Dashboard Lists (Tasks & Habits) */
.task-list-minimal { list-style: none; display: flex; flex-direction: column; gap: 0.5rem; }
.minimal-task-item { display: flex; align-items: center; gap: 0.8rem; padding: 0.8rem; border-radius: var(--radius-md); background: var(--surface-solid); border: 1px solid transparent; transition: var(--transition); }
.minimal-task-item:hover { border-color: var(--border-color); box-shadow: var(--shadow-sm); }
.minimal-task-item.completed span { text-decoration: line-through; color: var(--text-muted); opacity: 0.7; }
.badge-habit { font-size: 0.7rem; padding: 0.2rem 0.5rem; background: #dcfce7; color: #166534; border-radius: 10px; font-weight: bold; margin-right: auto; }
body.dark-theme .badge-habit { background: rgba(22, 101, 52, 0.3); color: #86efac; }

/* Dashboard Monthly Report */
.monthly-report-card { grid-column: 1 / -1; margin-top: 0.5rem; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.report-item { background: var(--surface-solid); padding: 1.2rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; text-align: center; }
.report-label { color: var(--text-muted); font-size: 0.9rem; font-weight: 600; }
.report-value { color: var(--primary-color); font-size: 1.5rem; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Planner Tasks List */
.tasks-list { display: flex; flex-direction: column; gap: 1rem; }
.task-item { display: flex; align-items: center; justify-content: space-between; background: var(--surface-solid); padding: 1.2rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); box-shadow: 0 2px 10px rgba(0,0,0,0.02); transition: var(--transition); animation: fadeInTask 0.3s ease forwards; }
@keyframes fadeInTask { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
.task-item:hover { transform: scale(1.01) translateY(-2px); box-shadow: var(--shadow-soft); border-color: var(--primary-color); }
.task-info { display: flex; align-items: center; gap: 1rem; flex: 1; cursor: pointer; }

/* Custom Checkbox */
.custom-checkbox { appearance: none; width: 24px; height: 24px; border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer; position: relative; transition: var(--transition); background: transparent; outline: none; flex-shrink: 0; }
.custom-checkbox:checked { background: var(--primary-color); border-color: var(--primary-color); animation: bounceCheck 0.3s; }
.custom-checkbox:checked::after { content: '✓'; position: absolute; color: white; font-size: 14px; font-weight: bold; top: 50%; left: 50%; transform: translate(-50%, -50%); }
@keyframes bounceCheck { 0% { transform: scale(1); } 50% { transform: scale(1.2); } 100% { transform: scale(1); } }

.task-item.completed .task-title { text-decoration: line-through; color: var(--text-muted); opacity: 0.6; }
.task-title { font-weight: 600; font-size: 1.05rem; transition: var(--transition); }
.task-badge { font-size: 0.75rem; padding: 0.3rem 0.8rem; background: var(--bg-gradient); border-radius: 20px; color: var(--text-muted); font-weight: 700; border: 1px solid var(--border-color); }
.task-badge.priority { background: #fffbeb; color: #d97706; border-color: #fef3c7; }
body.dark-theme .task-badge.priority { background: rgba(217, 119, 6, 0.2); border-color: transparent; }

.empty-state { text-align: center; color: var(--text-muted); padding: 3rem 2rem; background: var(--surface-solid); border-radius: var(--radius-lg); border: 1px dashed var(--border-color); }
.empty-icon { font-size: 3rem; color: var(--border-color); margin-bottom: 1rem; display: block; }

/* Timer Visuals */
.timer-container { text-align: center; max-width: 450px; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.timer-circle { width: 250px; height: 250px; border-radius: 50%; background: var(--surface-solid); display: flex; align-items: center; justify-content: center; margin: 2rem auto; box-shadow: inset 0 0 0 10px var(--bg-gradient), 0 10px 40px rgba(74,124,100,0.15); border: 2px solid rgba(74, 124, 100, 0.2); position: relative; }
.timer-display { font-size: 4.5rem; font-weight: 800; color: var(--primary-color); direction: ltr; font-variant-numeric: tabular-nums; letter-spacing: -2px; }
.timer-controls { display: flex; gap: 1rem; justify-content: center; width: 100%; margin-top: 2rem; }
.timer-modes { display: flex; gap: 0.5rem; background: var(--surface-solid); padding: 0.5rem; border-radius: 30px; box-shadow: var(--shadow-sm); }
.btn-mode { padding: 0.6rem 1.2rem; border: none; background: transparent; color: var(--text-muted); font-weight: 600; cursor: pointer; border-radius: 20px; transition: var(--transition); }
.btn-mode.active { background: var(--primary-color); color: white; }

/* Modals & Forms */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.4); backdrop-filter: blur(5px); display: flex; justify-content: center; align-items: center; opacity: 0; pointer-events: none; transition: var(--transition); z-index: 1000; }
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal { width: 90%; max-width: 450px; border-radius: var(--radius-lg); padding: 2rem; transform: scale(0.9); transition: var(--transition); }
.modal-overlay.active .modal { transform: scale(1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1.4rem; font-weight: 800; }
.form-group { margin-bottom: 1.5rem; }
.form-group input, .form-group select { width: 100%; padding: 0.8rem 1rem; border: 2px solid var(--border-color); border-radius: var(--radius-md); background: var(--surface-solid); color: var(--text-main); font-size: 1rem; transition: var(--transition); font-weight: 500; outline: none; }
.form-group input:focus, .form-group select:focus { border-color: var(--primary-color); box-shadow: 0 0 0 4px rgba(74, 124, 100, 0.1); }
.custom-check { display: flex; align-items: center; gap: 0.8rem; background: var(--bg-gradient); padding: 1rem; border-radius: var(--radius-md); cursor: pointer; }
.custom-check input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--primary-color); cursor: pointer; }
.custom-check label { cursor: pointer; font-weight: 600; font-size: 0.95rem; margin: 0; }

/* Date Navigator */
.date-navigator { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.8rem; }
.active-date-badge { background: var(--primary-gradient); color: white; padding: 0.4rem 1rem; border-radius: 20px; font-weight: 700; font-size: 0.95rem; box-shadow: var(--shadow-sm); }

/* Habits & Goals Cards */
.habit-card { display: flex; flex-direction: column; gap: 1rem; }
.habit-header { display: flex; justify-content: space-between; align-items: center; }
.habit-title { font-weight: 700; font-size: 1.1rem; }
.habit-stats { font-size: 0.85rem; color: var(--text-muted); }
.goal-item { display: flex; flex-direction: column; gap: 0.8rem; background: var(--surface-solid); padding: 1.2rem; border-radius: var(--radius-md); border: 1px solid var(--border-color); margin-bottom: 1rem; }
.goal-header { display: flex; justify-content: space-between; align-items: center; font-weight: 700; }
.goal-update-row { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.goal-update-row input { padding: 0.5rem; border: 1px solid var(--border-color); border-radius: var(--radius-sm); width: 80px; text-align: center; background: var(--bg-gradient); color: var(--text-main); }

@media (max-width: 768px) {
    .app-container { padding: 0.5rem; flex-direction: column; }
    .sidebar { position: fixed; right: -300px; top: 0; bottom: 0; z-index: 100; box-shadow: var(--shadow-hover); border-radius: 0; width: 280px; }
    .sidebar.open { right: 0; }
    .menu-toggle { display: block; }
    .top-header { border-radius: var(--radius-md); }
    .section-header { flex-direction: column; align-items: flex-start; gap: 1rem; }
    .pulse-btn { width: 100%; }
    .date-navigator { flex-wrap: wrap; }
}
