/* ============================================
   theme.css — سیستم متغیرهای نئومورفیک (روشن/تیره)
   ============================================ */

:root {
    --bg: #e9ece7;
    --text-main: #33402f;
    --text-muted: #7c8a75;
    --text-faint: #9aa896;

    --accent: #3f8f2f;
    --accent-2: #c99b2e;
    --accent-gradient: linear-gradient(155deg, #56a83f 0%, #2c6b20 100%);

    --shadow-light: #ffffff;
    --shadow-dark: #c6cbc0;
    --shadow-dark-soft: #cbd0c5;

    --surface: #e9ece7;
    --border-soft: rgba(255, 255, 255, 0.65);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 22px;

    --shadow-raised: -8px -8px 16px var(--shadow-light), 8px 8px 18px var(--shadow-dark);
    --shadow-raised-sm: -5px -5px 10px var(--shadow-light), 5px 5px 12px var(--shadow-dark);
    --shadow-pressed: inset 6px 6px 10px rgba(184, 190, 204, .45), inset -6px -6px 10px rgba(255, 255, 255, .95);
    --shadow-pressed-accent: inset 3px 3px 6px rgba(44, 107, 32, .35), inset -3px -3px 6px rgba(86, 168, 63, .25);

    --success: #2e7d32;
    --danger: #b23a2f;
}

[data-theme="dark"] {
    --bg: #191d16;
    --text-main: #dfe8d8;
    --text-muted: #93a08a;
    --text-faint: #6c7864;

    --accent: #62c94a;
    --accent-2: #d8b34a;
    --accent-gradient: linear-gradient(155deg, #6fd456 0%, #2f7a23 100%);

    --shadow-light: #23281f;
    --shadow-dark: #101310;
    --shadow-dark-soft: #0d0f0c;

    --surface: #191d16;
    --border-soft: rgba(255, 255, 255, 0.06);

    --shadow-raised: -8px -8px 16px var(--shadow-light), 8px 8px 18px var(--shadow-dark);
    --shadow-raised-sm: -5px -5px 10px var(--shadow-light), 5px 5px 12px var(--shadow-dark);
    --shadow-pressed: inset 6px 6px 10px rgba(0, 0, 0, .55), inset -6px -6px 10px rgba(255, 255, 255, .03);
    --shadow-pressed-accent: inset 3px 3px 6px rgba(0, 0, 0, .5), inset -3px -3px 6px rgba(98, 201, 74, .15);

    --success: #62c94a;
    --danger: #e2574a;
}

.pixel-font {
    font-family: "Press Start 2P", "Vazirmatn", "Poppins", sans-serif;
    letter-spacing: 0;
}

* { box-sizing: border-box; }

html {
    font-family: "Vazirmatn", "Poppins", sans-serif;
}

/* المان‌های فرم (button/input/select/textarea) به‌صورت پیش‌فرض فونت مرورگر رو می‌گیرن و
   از html ارث نمی‌برن؛ اینجا مجبورشون می‌کنیم فونت وزیرمتن رو بگیرن (مثل کارت‌های روش پرداخت) */
body,
button,
input,
select,
textarea,
optgroup,
option {
    font-family: inherit;
}

body {
    background: var(--bg);
    color: var(--text-main);
    margin: 0;
    min-height: 100vh;
    transition: background .35s ease, color .35s ease;
}

a { color: inherit; text-decoration: none; }

/* ---------- کامپوننت‌های عمومی نئومورفیک ---------- */

.surface {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-raised);
}

.surface-pressed {
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pressed);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    letter-spacing: .3px;
    color: var(--text-muted);
    background: var(--surface);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-raised-sm);
    padding: 12px 22px;
    transition: color .3s ease, background .3s ease, box-shadow .3s ease, transform .2s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: "";
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(115deg, transparent, rgba(255,255,255,.35), transparent);
    transform: skewX(-20deg);
    transition: left .6s ease;
}
.btn:hover::before { left: 130%; }

.btn:hover {
    transform: translateY(-2px);
    color: #f5e9c8;
    background: var(--accent-gradient);
    box-shadow: 0 10px 22px rgba(120, 10, 10, .3), -5px -5px 15px var(--shadow-light);
}

.btn:active {
    transform: translateY(0) scale(.97);
    box-shadow: var(--shadow-pressed-accent);
}

.btn-primary {
    color: #f5e9c8;
    background: var(--accent-gradient);
    box-shadow: var(--shadow-raised-sm);
}

.field {
    position: relative;
    margin-bottom: 16px;
}

.field i {
    position: absolute;
    left: 16px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    transition: color .3s ease;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    height: 46px;
    padding: 0 16px 0 42px;
    border: none;
    outline: none;
    background: var(--surface);
    color: var(--text-main);
    font-family: inherit;
    font-size: 14px;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-pressed);
    transition: box-shadow .35s ease, transform .35s ease;
}

.field textarea { height: auto; padding: 14px 16px 14px 42px; min-height: 110px; }

.field input:focus,
.field select:focus,
.field textarea:focus {
    box-shadow: var(--shadow-pressed-accent);
}
.field input:focus + i, .field:focus-within i { color: var(--accent); }

/* toggle switch (theme + remember-me) */
.switch {
    position: relative;
    width: 42px; height: 22px;
    border-radius: 20px;
    background: var(--surface);
    box-shadow: var(--shadow-pressed);
    cursor: pointer;
    flex-shrink: 0;
}
.switch::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: 1px 1px 3px rgba(0,0,0,.25);
    transition: left .25s ease, background .25s ease;
}
.switch.on { box-shadow: var(--shadow-pressed-accent); }
.switch.on::after { left: 22px; background: var(--accent); }

/* ---------- تاگل روز/شب هدر ---------- */
.theme-toggle {
    position: relative;
    width: 58px;
    height: 30px;
    border-radius: 30px;
    border: none;
    padding: 0;
    cursor: pointer;
    box-shadow: 0 0 0 1px var(--border-soft) inset, var(--shadow-raised-sm);
    background: linear-gradient(100deg, #a9d3e8 0%, #5e9fd6 100%);
    overflow: hidden;
    transition: background 0.6s ease, box-shadow 0.3s ease;
    flex-shrink: 0;
}
.theme-toggle.on {
    background: linear-gradient(100deg, #12123f 0%, #2c2f60 100%);
}
.theme-toggle::after { content: none; }

.tt-stars {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
}
.theme-toggle.on .tt-stars { opacity: 1; }
.tt-stars span {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    animation: ttTwinkle 2.4s ease-in-out infinite;
}
.tt-stars span:nth-child(1) { top: 6px;  left: 10px; animation-delay: 0s; }
.tt-stars span:nth-child(2) { top: 14px; left: 18px; animation-delay: .3s; }
.tt-stars span:nth-child(3) { top: 21px; left: 9px;  animation-delay: .9s; }
.tt-stars span:nth-child(4) { top: 8px;  left: 22px; animation-delay: 1.3s; }
.tt-stars span:nth-child(5) { top: 18px; left: 26px; animation-delay: .6s; }
.tt-stars span:nth-child(6) { top: 5px;  left: 17px; animation-delay: 1.7s; }
@keyframes ttTwinkle {
    0%, 100% { opacity: .2; }
    50% { opacity: 1; }
}

.tt-knob {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: radial-gradient(circle at 32% 30%, #fff6c8, #ffe98a 60%, #f7d55c 100%);
    box-shadow: 0 0 10px 2px rgba(255, 233, 138, .8);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: left .45s cubic-bezier(.65, -.1, .25, 1.15), background .5s ease, box-shadow .5s ease;
    z-index: 2;
}
.theme-toggle.on .tt-knob {
    left: 31px;
    background: radial-gradient(circle at 32% 30%, #ffffff, #f4f4f4 60%, #e7e9f5 100%);
    box-shadow: 0 0 10px 3px rgba(190, 200, 255, .65);
}

.tt-icon {
    position: absolute;
    font-size: 12px;
    transition: opacity .35s ease, transform .35s ease;
}
.tt-sun { color: #e8a010; opacity: 1; transform: scale(1) rotate(0deg); }
.tt-moon { color: #5a5f9e; opacity: 0; transform: scale(.4) rotate(-90deg); }
.theme-toggle.on .tt-sun { opacity: 0; transform: scale(.4) rotate(90deg); }
.theme-toggle.on .tt-moon { opacity: 1; transform: scale(1) rotate(0deg); }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    color: #fff;
    background: var(--accent-gradient);
}

.card {
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-raised);
    padding: 20px;
    transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); }

.alert {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    box-shadow: var(--shadow-raised-sm);
}
.alert-success { border-right: 4px solid var(--success); }
.alert-error { border-right: 4px solid var(--danger); }
