/* ============================================================
   Vazirmatn Font - Local (all weights, absolute URL paths)
   Place files in: public/css/fonts/vazirmatn/
   ============================================================ */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-300-normal.woff2') format('woff2');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF,
                   U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                   U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-400-normal.woff2') format('woff2'),
         url('/css/fonts/vazirmatn/vazirmatn-arabic-400-normal.woff') format('woff');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF,
                   U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                   U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-500-normal.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF,
                   U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                   U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff2') format('woff2'),
         url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff') format('woff');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF,
                   U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6,
                   U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122,
                   U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Bold alias */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff2') format('woff2'),
         url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff') format('woff');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Vazirmatn';
    src: url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff2') format('woff2'),
         url('/css/fonts/vazirmatn/vazirmatn-arabic-700-normal.woff') format('woff');
    font-weight: 800;
    font-style: normal;
    font-display: swap;
}

/* ============================================================
   CSS Variables
   ============================================================ */
:root {
    --primary: #2563EB;
    --primary-dark: #1D4ED8;
    --primary-light: #EFF6FF;
    --secondary: #64748B;
    --success: #10B981;
    --danger: #EF4444;
    --warning: #F59E0B;
    --info: #06B6D4;
    --bg: #F8FAFC;
    --surface: #FFFFFF;
    --surface-2: #F1F5F9;
    --border: #E2E8F0;
    --border-focus: #93C5FD;
    --text-primary: #0F172A;
    --text-secondary: #64748B;
    --text-muted: #94A3B8;
    --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 4px 6px -1px rgba(0,0,0,.07), 0 2px 4px -1px rgba(0,0,0,.04);
    --shadow-md: 0 10px 15px -3px rgba(0,0,0,.08), 0 4px 6px -2px rgba(0,0,0,.04);
    --shadow-lg: 0 20px 25px -5px rgba(0,0,0,.08), 0 10px 10px -5px rgba(0,0,0,.03);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --transition: all .2s cubic-bezier(.4,0,.2,1);
    --sidebar-w: 260px;
}

/* ============================================================
   Reset & Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-tap-highlight-color: transparent;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
    background: var(--bg);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    margin: 0;
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Force Vazirmatn everywhere - covers Bootstrap overrides */
*, *::before, *::after {
    font-family: inherit;
}

input, button, select, textarea, optgroup, option {
    font-family: 'Vazirmatn', 'Tahoma', sans-serif;
}

/* ============================================================
   Splash Screen
   ============================================================ */
#splash-screen {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity .5s ease, visibility .5s ease;
}

#splash-screen.hide {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.splash-logo {
    width: 160px;
    height: 160px;
    object-fit: contain;
    animation: splashPulse 1.5s ease-in-out infinite;
    /* no background, no shadow - clean logo */
    background: transparent;
}

.splash-logo-placeholder {
    width: 160px;
    height: 160px;
    /* removed: border-radius, gradient background, box-shadow */
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: splashPulse 1.5s ease-in-out infinite;
}

.splash-logo-placeholder i {
    font-size: 80px;
    color: rgba(255,255,255,.9);
}

.splash-brand {
    margin-top: 24px;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 1px;
    opacity: 0;
    animation: fadeInUp .6s ease .4s forwards;
}

.splash-tagline {
    color: rgba(255,255,255,.45);
    font-size: 14px;
    font-weight: 500;
    margin-top: 6px;
    opacity: 0;
    animation: fadeInUp .6s ease .6s forwards;
}

.splash-dots {
    position: absolute;
    bottom: 48px;
    display: flex;
    gap: 8px;
}

.splash-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,.25);
    animation: dotPulse 1.2s ease-in-out infinite;
}
.splash-dot:nth-child(2) { animation-delay: .2s; }
.splash-dot:nth-child(3) { animation-delay: .4s; }

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

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

@keyframes dotPulse {
    0%, 100% { background: rgba(255,255,255,.25); transform: scale(1); }
    50% { background: rgba(255,255,255,.8); transform: scale(1.3); }
}

/* ============================================================
   Auth Pages
   ============================================================ */
.auth-wrapper {
    min-height: 100vh;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.auth-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
    animation: cardEnter .4s cubic-bezier(.34,1.56,.64,1);
}

@keyframes cardEnter {
    from { opacity: 0; transform: translateY(20px) scale(.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-img {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    object-fit: contain;
}

.auth-logo-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(37,99,235,.3);
}

.auth-logo-placeholder i {
    font-size: 32px;
    color: #fff;
}

.auth-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    text-align: center;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 13px;
    text-align: center;
    margin-bottom: 32px;
}

/* Auth Steps */
.auth-step { display: none; }
.auth-step.active { display: block; animation: stepEnter .3s ease; }

@keyframes stepEnter {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* Form Controls */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    height: 50px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 15px;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
    outline: none;
    direction: ltr;
    text-align: center;
    letter-spacing: 2px;
}

.form-control.rtl-input {
    direction: rtl;
    text-align: right;
    letter-spacing: 0;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-control::placeholder {
    color: var(--text-muted);
    letter-spacing: 0;
}

.form-control.is-invalid {
    border-color: var(--danger);
    box-shadow: 0 0 0 3px rgba(239,68,68,.1);
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger);
    margin-top: 6px;
    display: none;
}
.form-control.is-invalid + .invalid-feedback { display: block; }

/* OTP Input */
.otp-wrapper {
    display: flex;
    flex-direction: row;          /* explicit LTR order */
    direction: ltr;               /* force LTR: box 1 on left → box 6 on right */
    gap: 10px;
    justify-content: center;
    margin-bottom: 8px;
}

.otp-input {
    width: 52px;
    height: 60px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 22px;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
    outline: none;
    direction: ltr;
    caret-color: var(--primary);
}

.otp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: var(--primary-light);
}

.otp-input.filled {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary-dark);
}

.otp-input.error {
    border-color: var(--danger);
    background: #FEF2F2;
    animation: shake .3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    75% { transform: translateX(4px); }
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 50px;
    padding: 0 24px;
    border-radius: var(--radius-sm);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    text-decoration: none;
    -webkit-user-select: none;
    user-select: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.btn-primary:hover { background: var(--primary-dark); box-shadow: 0 6px 20px rgba(37,99,235,.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(37,99,235,.3); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--border);
}
.btn-outline:hover { border-color: var(--primary); background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    height: auto;
    padding: 6px 12px;
}
.btn-ghost:hover { color: var(--primary); background: var(--primary-light); border-radius: var(--radius-sm); }

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-w-full { width: 100%; }

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Spinner inside button */
.btn-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}
.btn.loading .btn-spinner { display: block; }
.btn.loading .btn-text { opacity: 0; position: absolute; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Mobile hint */
.mobile-display {
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

.mobile-display span {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    direction: ltr;
    letter-spacing: 1px;
}

.mobile-display a {
    font-size: 12px;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

/* Countdown timer */
.otp-timer {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 16px;
}

.otp-timer .time-value {
    color: var(--primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.otp-timer .resend-link {
    color: var(--primary);
    cursor: pointer;
    font-weight: 600;
    text-decoration: none;
}
.otp-timer .resend-link:hover { text-decoration: underline; }

/* Divider */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 20px 0;
    color: var(--text-muted);
    font-size: 12px;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

/* Alert messages */
.alert-msg {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
    animation: fadeIn .2s ease;
}
.alert-msg.show { display: flex; align-items: center; gap: 10px; }
.alert-msg.alert-error { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; }
.alert-msg.alert-success { background: #F0FDF4; color: #166534; border: 1px solid #BBF7D0; }
.alert-msg.alert-warning { background: #FFFBEB; color: #92400E; border: 1px solid #FDE68A; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Lock state */
.lock-box {
    text-align: center;
    padding: 16px;
    background: #FEF2F2;
    border-radius: var(--radius);
    border: 1px solid #FECACA;
}
.lock-box i { font-size: 36px; color: var(--danger); margin-bottom: 10px; display: block; }
.lock-box p { color: #991B1B; font-size: 13px; margin: 0; }
.lock-countdown { font-size: 22px; font-weight: 700; color: var(--danger); margin: 8px 0; }

/* ============================================================
   Dashboard Layout
   ============================================================ */
.dash-wrapper { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 200;
    transition: transform .3s cubic-bezier(.4,0,.2,1);
    overflow-y: auto;
    box-shadow: var(--shadow);
    /* on mobile: leave room for bottom toolbar */
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 0));
}
@media (min-width: 992px) {
    .sidebar { padding-bottom: 0; }
}

.sidebar-header {
    padding: 24px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    object-fit: contain;
}

.sidebar-logo-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sidebar-logo-placeholder i { font-size: 18px; color: #fff; }

.sidebar-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}
.sidebar-version {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
}

/* Nav */
.sidebar-nav {
    padding: 16px 12px;
    flex: 1;
}

.nav-section-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px;
    margin: 16px 0 8px;
}
.nav-section-label:first-child { margin-top: 0; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    border: none;
    background: transparent;
    width: 100%;
    text-align: right;
}

.nav-item i { font-size: 18px; flex-shrink: 0; }

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

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

.nav-item .nav-badge {
    margin-right: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 20px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 12px;
    border-top: 1px solid var(--border);
}

/* Sidebar backdrop */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 199;
    backdrop-filter: blur(2px);
}
.sidebar-backdrop.show { display: block; }

/* Main Content */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-w);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: margin-right .3s cubic-bezier(.4,0,.2,1);
}

/* Topbar */
.topbar {
    height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.topbar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 20px;
    transition: var(--transition);
}
.topbar-toggle:hover { background: var(--surface-2); color: var(--primary); }

.topbar-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.topbar-btn {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 18px;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
}
.topbar-btn:hover { background: var(--primary-light); color: var(--primary); }

.topbar-btn .badge-dot {
    position: absolute;
    top: 6px;
    left: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* User menu */
.user-menu {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    position: relative;
}
.user-menu:hover { background: var(--surface-2); }

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}

.user-info { text-align: right; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* Page Content */
.page-content {
    padding: 28px 24px;
    flex: 1;
}

.page-header {
    margin-bottom: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header-info { }
.page-header-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}
.page-header-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
}

/* Cards */
.card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.card-header {
    padding: 18px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--primary); font-size: 18px; }

.card-body { padding: 20px; }

/* Stat Cards */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #EFF6FF; color: var(--primary); }
.stat-icon.green { background: #F0FDF4; color: var(--success); }
.stat-icon.orange { background: #FFFBEB; color: var(--warning); }
.stat-icon.purple { background: #F5F3FF; color: #7C3AED; }
.stat-icon.red { background: #FEF2F2; color: var(--danger); }
.stat-icon.cyan { background: #ECFEFF; color: var(--info); }

.stat-info { flex: 1; }
.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 4px;
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 12px; color: var(--text-secondary); }
.stat-change {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    margin-top: 6px;
    display: inline-block;
}
.stat-change.up { background: #F0FDF4; color: var(--success); }
.stat-change.down { background: #FEF2F2; color: var(--danger); }

/* Welcome Banner */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, #4F46E5 100%);
    border-radius: var(--radius-lg);
    padding: 28px 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
    margin-bottom: 24px;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -60px;
    left: -60px;
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: 100px;
    width: 150px;
    height: 150px;
    border-radius: 50%;
    background: rgba(255,255,255,.05);
}

.welcome-title { font-size: 20px; font-weight: 700; margin: 0 0 6px; }
.welcome-subtitle { font-size: 13px; opacity: .8; margin: 0; }
.welcome-emoji { font-size: 48px; position: relative; z-index: 1; }

/* Profile card in sidebar */
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    margin-bottom: 4px;
}
.sidebar-user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, #7C3AED 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.sidebar-user-mobile { font-size: 11px; color: var(--text-muted); direction: ltr; }

/* Online indicator */
.online-dot {
    width: 8px;
    height: 8px;
    background: var(--success);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(16,185,129,.2);
}

/* Utility */
.text-muted { color: var(--text-muted) !important; }
.text-primary-c { color: var(--primary) !important; }
.text-success-c { color: var(--success) !important; }
.text-danger-c { color: var(--danger) !important; }
.fw-600 { font-weight: 600; }

/* Loading overlay */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,.85);
    backdrop-filter: blur(4px);
    z-index: 9998;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.loading-text { font-size: 13px; color: var(--text-secondary); font-weight: 500; }

/* PWA install prompt */
.pwa-install-prompt {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0)); /* above toolbar on mobile */
    left: 16px;
    right: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow-lg);
    display: none;   /* shown via JS: el.style.display='flex' then .show */
    align-items: center;
    gap: 12px;
    z-index: 600;
    transform: translateY(20px);
    opacity: 0;
    transition: transform .35s cubic-bezier(.34,1.56,.64,1), opacity .3s ease;
    max-width: 500px;
    margin: 0 auto;
}
.pwa-install-prompt.show {
    transform: translateY(0);
    opacity: 1;
}
@media (min-width: 992px) {
    .pwa-install-prompt {
        bottom: 24px;
        left: auto;
        right: 24px;
        width: 340px;
    }
}

.pwa-install-icon { font-size: 28px; flex-shrink: 0; }
.pwa-install-text { flex: 1; }
.pwa-install-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 0 2px; }
.pwa-install-subtitle { font-size: 11px; color: var(--text-secondary); margin: 0; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(100%);
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-lg);
    }
    .main-content { margin-right: 0 !important; }
    .topbar-toggle { display: flex; }
    .page-content { padding: 20px 16px; }
    .auth-card { padding: 32px 24px; }
}

@media (max-width: 575.98px) {
    .otp-wrapper { gap: 8px; }
    .otp-input { width: 46px; height: 54px; font-size: 20px; }
    .welcome-banner { padding: 20px; }
    .welcome-emoji { font-size: 36px; }
    .stat-value { font-size: 20px; }
}

/* ============================================================
   Mechanic Dashboard - Additional Styles
   ============================================================ */

/* ── Score Banner ── */
.score-banner {
    background: linear-gradient(135deg, #1D4ED8 0%, #7C3AED 50%, #DB2777 100%);
    border-radius: var(--radius-xl);
    padding: 32px;
    color: #fff;
    position: relative;
    overflow: hidden;
    text-align: center;
}
.score-banner::before {
    content:'';position:absolute;top:-80px;right:-80px;
    width:250px;height:250px;border-radius:50%;
    background:rgba(255,255,255,.07);
}
.score-banner::after {
    content:'';position:absolute;bottom:-60px;left:-60px;
    width:200px;height:200px;border-radius:50%;
    background:rgba(255,255,255,.05);
}
.score-banner-value {
    font-size: 56px;
    font-weight: 800;
    line-height: 1;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 12px rgba(0,0,0,.2);
}
.score-banner-label {
    font-size: 16px;
    opacity: .85;
    margin-top: 8px;
    position: relative;
    z-index: 1;
}
.score-meta {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}
.score-meta-item {
    text-align: center;
}
.score-meta-item span:first-child {
    display: block;
    font-size: 24px;
    font-weight: 700;
}
.score-meta-item span:last-child {
    font-size: 17px;
    opacity: .7;
}

/* ── Plan Cards ── */
.plan-card {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.plan-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.plan-card.can-redeem { border-color: var(--success); }
.plan-card-img {
    width: 100%; height: 160px;
    object-fit: cover;
    background: var(--surface-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 48px; color: var(--text-muted);
}
.plan-card-img img { width:100%; height:100%; object-fit:cover; }
.plan-card-body {
    padding: 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.plan-score-badge {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--primary-light); color: var(--primary);
    font-size: 13px; font-weight: 700;
    padding: 4px 12px; border-radius: 20px;
    margin-bottom: 10px;
}
.plan-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.plan-desc { font-size: 12px; color: var(--text-secondary); flex: 1; line-height: 1.8; }
.plan-footer { margin-top: 14px; }

/* ── Score Log Items ── */
.log-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
}
.log-item:last-child { border-bottom: none; }
.log-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; flex-shrink: 0;
}
.log-icon.earned  { background: #F0FDF4; color: var(--success); }
.log-icon.spent   { background: #FEF2F2; color: var(--danger); }
.log-info { flex: 1; }
.log-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.log-date  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.log-score { font-size: 16px; font-weight: 700; }
.log-score.earned { color: var(--success); }
.log-score.spent  { color: var(--danger); }

/* ── Request Status Badges ── */
.req-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
}
.req-badge.blue   { background: var(--primary-light); color: var(--primary); }
.req-badge.orange { background: #FFFBEB; color: var(--warning); }
.req-badge.green  { background: #F0FDF4; color: var(--success); }
.req-badge.red    { background: #FEF2F2; color: var(--danger); }
.req-badge.gray   { background: var(--surface-2); color: var(--text-secondary); }

/* ── Tabs ── */
.app-tabs {
    display: flex;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
    overflow-x: auto;
}
.app-tab {
    flex: 1;
    min-width: max-content;
    padding: 9px 16px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}
.app-tab.active {
    background: var(--surface);
    color: var(--primary);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* ── Modal ── */
.app-modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    opacity: 0; visibility: hidden;
    transition: opacity .25s ease, visibility .25s ease;
}
.app-modal-overlay.open { opacity: 1; visibility: visible; }
.app-modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%; max-width: 440px;
    max-height: 90vh; overflow-y: auto;
    transform: translateY(20px) scale(.97);
    transition: transform .25s cubic-bezier(.34,1.56,.64,1);
    box-shadow: var(--shadow-lg);
}
.app-modal-overlay.open .app-modal { transform: none; }
.app-modal-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px;
}
.app-modal-title {
    font-size: 17px; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 10px;
}
.app-modal-title i { color: var(--primary); font-size: 22px; }
.app-modal-close {
    width: 36px; height: 36px;
    background: var(--surface-2); border: none; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--text-secondary); transition: var(--transition);
}
.app-modal-close:hover { background: #FEF2F2; color: var(--danger); }


.modal-close {
    width: 36px; height: 36px;
    background: var(--surface-2); border: none; border-radius: 50%;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: var(--text-secondary); transition: var(--transition);
}
.modal-close:hover { background: #FEF2F2; color: var(--danger); }

/* ── Code Input ── */
.code-input-big {
    width: 100%; height: 64px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: 6px;
    direction: ltr;
    transition: var(--transition);
    outline: none;
    font-family: 'Vazirmatn', sans-serif;
}
.code-input-big:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
    background: var(--primary-light);
}

/* ── Success Result Box ── */
.result-box {
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    animation: cardEnter .3s ease;
}
.result-box.success { background: #F0FDF4; border: 1.5px solid #86EFAC; }
.result-box.error   { background: #FEF2F2; border: 1.5px solid #FECACA; }
.result-box.warning { background: #FFFBEB; border: 1.5px solid #FDE68A; }
.result-box i       { font-size: 40px; margin-bottom: 10px; display: block; }
.result-box.success i { color: var(--success); }
.result-box.error   i { color: var(--danger); }
.result-box.warning i { color: var(--warning); }
.result-box h4 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.result-box p  { font-size: 13px; margin: 0; }

/* ── Warranty Detail Row ── */
.warranty-row {
    display: flex; align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.warranty-row:last-child { border-bottom: none; }
.warranty-row label { color: var(--text-secondary); width: 140px; flex-shrink: 0; }
.warranty-row span  { font-weight: 600; color: var(--text-primary); flex: 1; }

/* ── Banner Carousel ── */
.banner-carousel {
    border-radius: var(--radius-lg);
    overflow: hidden;
    position: relative;
    aspect-ratio: 16/9;
    background: var(--surface-2);
    margin-bottom: 24px;
}
.banner-carousel .carousel-inner { height: 100%; }
.banner-carousel .carousel-item  { height: 100%; }
.banner-carousel img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.banner-carousel .carousel-indicators button {
    width: 8px; height: 8px; border-radius: 50%;
    border: none; background: rgba(255,255,255,.5);
}
.banner-carousel .carousel-indicators button.active { background: #fff; }
.banner-carousel .carousel-control-prev,
.banner-carousel .carousel-control-next {
    width: 44px; height: 44px;
    background: rgba(0,0,0,.3); border-radius: 50%;
    top: 50%; transform: translateY(-50%);
    margin: 0 12px;
}

/* ── Dashboard Action Cards ── */
.action-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex; flex-direction: column;
    align-items: center; text-align: center;
    gap: 12px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow-sm);
}
.action-card:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    color: inherit;
}
.action-card-icon {
    width: 56px; height: 56px; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.action-card-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.action-card-desc  { font-size: 13px; color: var(--text-secondary); }

/* ── Profile Form ── */
.select-searchable {
    width: 100%; height: 50px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0 16px;
    font-family: 'Vazirmatn', sans-serif;
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    transition: var(--transition);
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath fill='%2364748B' d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 36px;
}
.select-searchable:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* ── Ticker score display in topbar ── */
.topbar-score {
    display: flex; align-items: center; gap: 6px;
    background: var(--primary-light); color: var(--primary);
    padding: 6px 14px; border-radius: 20px;
    font-size: 13px; font-weight: 700; cursor: pointer;
    text-decoration: none; transition: var(--transition);
}
.topbar-score:hover { background: var(--primary); color: #fff; }
.topbar-score i { font-size: 16px; }

@media (max-width: 575.98px) {
    .score-banner-value { font-size: 40px; }
    .score-meta { gap: 20px; }
    .plan-card-img { height: 130px; }
    .app-modal { padding: 20px 16px; }
    .code-input-big { font-size: 22px; letter-spacing: 4px; }
}

/* ============================================================
   Bottom Toolbar (PWA mobile nav)
   ============================================================ */
.bottom-toolbar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 64px;
    background: var(--surface);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    z-index: 300;
    box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    /* Safe area for iPhone notch */
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(64px + env(safe-area-inset-bottom, 0));
}

.toolbar-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 500;
    padding: 8px 4px;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    font-family: 'Vazirmatn', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

.toolbar-item i {
    font-size: 22px;
    transition: var(--transition);
    display: block;
}

.toolbar-item:hover {
    color: var(--primary);
}

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

.toolbar-item.active i {
    transform: translateY(-2px);
}

/* Active indicator dot */
.toolbar-item.active::after {
    content: '';
    position: absolute;
    bottom: 6px;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--primary);
}

/* Center action button (special) */
.toolbar-item.toolbar-action {
    color: #fff;
}

.toolbar-action-wrap {
    width: 52px; height: 52px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary), #7C3AED);
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 16px rgba(37,99,235,.35);
    transition: var(--transition);
    margin-bottom: 2px;
}

.toolbar-item.toolbar-action:hover .toolbar-action-wrap,
.toolbar-item.toolbar-action.active .toolbar-action-wrap {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(37,99,235,.45);
}

.toolbar-item.toolbar-action i {
    font-size: 24px;
    transform: none !important;
}

.toolbar-item.toolbar-action span {
    font-size: 9px;
    color: var(--text-muted);
}

.toolbar-item.toolbar-action::after { display: none; }

/* Push page content up on mobile so toolbar doesn't cover it */
@media (max-width: 991.98px) {
    .main-content .page-content {
        padding-bottom: calc(72px + env(safe-area-inset-bottom, 0));
    }
}

/* Hide toolbar on desktop (sidebar is enough) */
@media (min-width: 992px) {
    .bottom-toolbar { display: none; }
}
