:root {
    --bg-body: #f3f7ff;
    --card-bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --primary: #3b82f6;
    --primary-2: #1e3a8a;
    --radius: 14px;
    --border-color: #111827;
    --border-width: 2px;
    --input-bg: #ffffff;
    --input-text: #0f172a;
    --input-border: #0f172a;
    --shadow-1: 0 6px 18px rgba(15, 23, 42, 0.08);
    --shadow-2: 0 12px 32px rgba(15, 23, 42, 0.10);
    --landing-grad-1: #1e3a8a;
    --landing-grad-2: #3b82f6;
    --table-head-bg: #1e3a8a;
    --table-head-text: #ffffff;
    --table-row-even: #e8f1ff;
    --table-row-odd: #ffffff;
    --table-border: #1e3a8a;
    --table-text: #0f172a;
    --chip-bg: #e0ecff;
    --chip-border: #3b82f6;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --info: #3b82f6;
    --notebook: #8b5cf6;
    --admin-primary: #4f46e5;
    --admin-secondary: #6366f1;
    --admin-success: #22c55e;
    --admin-warning: #f97316;
    --admin-danger: #ef4444;
    --admin-dark: #1e293b;
}

/* تم‌های رنگی */
body[data-theme="ocean"] {
    --bg-body: #f3f7ff;
    --card-bg: #ffffff;
    --text: #0f172a;
    --primary: #3b82f6;
    --primary-2: #1e40af;
}

body[data-theme="mint"] {
    --bg-body: #f1fbf8;
    --card-bg: #ffffff;
    --text: #0f172a;
    --primary: #10b981;
    --primary-2: #047857;
}

body[data-theme="royal"] {
    --bg-body: #f6f2ff;
    --card-bg: #ffffff;
    --text: #1e1b4b;
    --primary: #8b5cf6;
    --primary-2: #5b21b6;
}

body[data-theme="sunset"] {
    --bg-body: #fff6f0;
    --card-bg: #ffffff;
    --text: #1f2937;
    --primary: #f97316;
    --primary-2: #ea580c;
}

/* استایل‌های اصلی */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Vazir', sans-serif;
    background-color: var(--bg-body);
    color: var(--text);
    min-height: 100vh;
}

/* مودال موفقیت */
.success-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.success-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 350px;
    width: 90%;
    text-align: center;
    border: 3px solid var(--success);
}

.success-icon {
    font-size: 60px;
    color: var(--success);
    margin-bottom: 15px;
}

.success-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--success);
    margin-bottom: 10px;
}

.success-message {
    color: #4b5563;
    margin-bottom: 20px;
}

.success-close {
    background: var(--success);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-family: 'Vazir', sans-serif;
    font-weight: bold;
    cursor: pointer;
}

/* مودال ارور */
.error-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

.error-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    max-width: 350px;
    width: 90%;
    text-align: center;
    border: 3px solid var(--danger);
}

.error-icon {
    font-size: 50px;
    color: var(--danger);
    margin-bottom: 15px;
}

.error-title {
    font-size: 20px;
    font-weight: 900;
    color: var(--danger);
    margin-bottom: 10px;
}

.error-message {
    color: #4b5563;
    margin-bottom: 20px;
}

.error-close {
    background: var(--danger);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-family: 'Vazir', sans-serif;
    font-weight: bold;
    cursor: pointer;
}

/* صفحه لاگین */
#login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--landing-grad-1) 0%, var(--landing-grad-2) 100%);
    padding: 15px;
}

.login-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    padding: 30px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    max-width: 400px;
    width: 100%;
    color: white;
}

.login-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 25px;
    text-align: center;
}

.login-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: none;
    border-radius: 10px;
    font-family: 'Vazir', sans-serif;
    font-size: 16px;
}

.login-btn {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 10px;
    font-family: 'Vazir', sans-serif;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 12px;
}

.login-btn-primary {
    background: var(--primary);
    color: white;
}

.login-btn-secondary {
    background: rgba(255,255,255,0.2);
    color: white;
    border: 2px solid rgba(255,255,255,0.5);
}

.login-btn-register {
    background: var(--success);
    color: white;
}

.login-forgot {
    text-align: center;
    margin-top: 10px;
}

.login-forgot a {
    color: white;
    text-decoration: none;
}

/* صفحه فراموشی */
#forgot-page, #register-page {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--landing-grad-1) 0%, var(--landing-grad-2) 100%);
    padding: 15px;
}

.forgot-card, .register-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    padding: 30px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    max-width: 450px;
    width: 100%;
    color: white;
}

.forgot-title, .register-title {
    font-size: 24px;
    font-weight: 900;
    margin-bottom: 20px;
    text-align: center;
}

.forgot-input, .register-input {
    width: 100%;
    padding: 15px;
    margin-bottom: 15px;
    border: none;
    border-radius: 10px;
    font-family: 'Vazir', sans-serif;
    font-size: 16px;
}

.register-rules {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    font-size: 13px;
}

.rule-title {
    font-weight: bold;
    margin-bottom: 10px;
    color: #fbbf24;
}

.rule-item {
    margin-bottom: 8px;
    padding-right: 20px;
    position: relative;
}

.rule-item::before {
    content: "•";
    position: absolute;
    right: 5px;
    color: var(--danger);
}

.rule-example {
    color: #fbbf24;
    font-family: monospace;
    background: rgba(0,0,0,0.2);
    padding: 2px 5px;
    border-radius: 4px;
}

/* صفحه خوش‌آمدگویی */
#landing-page {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--landing-grad-1) 0%, var(--landing-grad-2) 100%);
    color: white;
    padding: 15px;
    position: relative;
}

.landing-header {
    position: absolute;
    top: 15px;
    left: 15px;
    right: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.theme-picker-landing {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255,255,255,0.2);
    backdrop-filter: blur(10px);
    padding: 8px 12px;
    border-radius: 40px;
}

.theme-picker-landing select {
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    font-family: 'Vazir', sans-serif;
    padding: 5px 8px;
    border-radius: 30px;
}

.logout-btn-landing {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 40px;
    font-family: 'Vazir', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}

.landing-card {
    background: rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(12px);
    padding: 30px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    max-width: 500px;
    width: 100%;
    text-align: center;
}

.landing-icon {
    font-size: 60px;
    margin-bottom: 15px;
    color: #fbbf24;
}

.landing-title {
    font-size: 22px;
    font-weight: 900;
    margin-bottom: 10px;
}

.landing-subtitle {
    font-size: 14px;
    margin-bottom: 25px;
    opacity: 0.9;
}

.landing-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 12px;
    border: none;
    border-radius: 50px;
    font-family: 'Vazir';
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
}

.btn-enter {
    background: #ffffff;
    color: var(--landing-grad-1);
}

.btn-calc {
    background: rgba(0, 0, 0, 0.3);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.5);
}

/* مودال ماشین حساب */
#calc-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.calc-box {
    background: var(--card-bg);
    padding: 25px 20px;
    border-radius: 15px;
    width: 100%;
    max-width: 400px;
    border: 3px solid var(--primary);
    position: relative;
    color: var(--text);
}

.close-modal {
    position: absolute;
    left: 15px;
    top: 15px;
    font-size: 20px;
    cursor: pointer;
    color: var(--danger);
}

.calc-result-box {
    background: var(--chip-bg);
    padding: 15px;
    border-radius: 8px;
    border: 2px dashed var(--primary);
    margin-top: 20px;
}

.calc-result-item {
    margin: 10px 0;
    font-size: 14px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
}

/* برنامه اصلی */
#main-app-container {
    display: none;
    padding: 15px;
    max-width: 1200px;
    margin: 0 auto;
}

.container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.header-panel {
    background: var(--card-bg);
    padding: 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-2);
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 20px;
    border: 2px solid var(--primary);
}

@media (min-width: 768px) {
    .header-panel {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
}

.header-title {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-title h1 {
    margin: 0;
    font-size: 18px;
}

.btn-back {
    background: var(--danger);
    color: white;
    padding: 8px 15px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Vazir';
    display: flex;
    align-items: center;
    gap: 5px;
}

.theme-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--chip-bg);
    padding: 8px 12px;
    border-radius: 999px;
    border: 2px solid var(--chip-border);
}

.theme-picker select {
    background: transparent;
    border: none;
    color: var(--text);
    font-weight: 700;
    font-family: 'Vazir';
    cursor: pointer;
    outline: none;
}

/* فرم */
.form-card {
    background: var(--card-bg);
    padding: 20px 15px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
    margin-bottom: 20px;
    border: 1px solid #cbd5e1;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

@media (min-width: 640px) {
    .form-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 992px) {
    .form-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.input-group {
    display: flex;
    flex-direction: column;
}

.input-group label {
    margin-bottom: 5px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text);
}

.input-group input,
.input-group select {
    padding: 12px;
    border: 2px solid var(--input-border);
    border-radius: 8px;
    font-family: 'Vazir';
    background: var(--input-bg);
    color: var(--input-text);
    font-size: 14px;
    width: 100%;
}

.input-group input:focus,
.input-group select:focus {
    border-color: var(--primary);
    outline: none;
}

.action-bar {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px dashed #cbd5e1;
}

@media (min-width: 640px) {
    .action-bar {
        flex-direction: row;
        justify-content: flex-end;
    }
}

.btn {
    padding: 12px 18px;
    border: none;
    border-radius: 8px;
    font-family: 'Vazir';
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 14px;
    width: 100%;
}

@media (min-width: 640px) {
    .btn {
        width: auto;
    }
}

.btn-add {
    background: var(--success);
    color: white;
}

.btn-reset {
    background: #d1d5db;
    color: #000;
}