﻿/* ============================================================
   POSAssistant - Global Styles
   نسخه PWA - فقط Dark Mode
   نسخه بازسازی‌شده: مرتب‌سازی، حذف تکرار، تقویت PWA و موبایل
   ============================================================ */

/* ============================================================
   ۱. متغیرها (Variables)
   ============================================================ */
:root {
    /* رنگ‌های اصلی */
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --primary-light: #8a9cf0;
    --primary-gradient-start: #667eea;
    --primary-gradient-end: #764ba2;
    /* رنگ‌های متنی */
    --text-primary: #ffffff;
    --text-secondary: #e8e8e8;
    --text-muted: #a0a0b0;
    --text-disabled: #6c757d;
    /* رنگ‌های پس‌زمینه */
    --bg-body: #1a1a2e;
    --bg-card: #2d2d3d;
    --bg-card-header: #3d3d4d;
    --bg-input: #1a1a2e;
    --bg-hover: #3d3d4d;
    --bg-sidebar: #16213e;
    --bg-header: #2d3436;
    /* رنگ‌های مرزی */
    --border-color: #4d4d5d;
    --border-light: #3d3d4d;
    --border-dark: #2d2d3d;
    /* رنگ‌های وضعیت */
    --success-color: #28a745;
    --success-bg: #1a3a2a;
    --success-border: #2a5a3a;
    --success-text: #a0e0b0;
    --danger-color: #dc3545;
    --danger-bg: #3a1a1a;
    --danger-border: #5a2a2a;
    --danger-text: #f0a0a0;
    --warning-color: #ffc107;
    --warning-bg: #3a2a1a;
    --warning-border: #5a3a2a;
    --warning-text: #f0c8a0;
    --info-color: #17a2b8;
    --info-bg: #1a2a3a;
    --info-border: #2a4a5a;
    --info-text: #a0d0e0;
    /* سایه‌ها */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 15px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 50px rgba(0, 0, 0, 0.5);
    /* فاصله‌ها */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    /* شعاع گردی */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-round: 50%;
    /* فونت */
    --font-family: 'IRANSans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 0.65rem;
    --font-size-sm: 0.75rem;
    --font-size-md: 0.85rem;
    --font-size-lg: 1rem;
    --font-size-xl: 1.2rem;
    --font-size-xxl: 1.5rem;
    /* انتقال‌ها */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    /* Safe Area (PWA) */
    --safe-area-top: env(safe-area-inset-top, 0px);
    --safe-area-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-left: env(safe-area-inset-left, 0px);
    --safe-area-right: env(safe-area-inset-right, 0px);
    /* رنگ تم PWA — هماهنگ با manifest.json */
    --pwa-theme-color: #1a1a2e;
}

/* ============================================================
   ۲. ریست (Reset) + PWA viewport
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    height: 100%;
    -webkit-text-size-adjust: 100%;
}

html, body {
    font-family: var(--font-family);
    color: var(--text-primary);
    background: var(--bg-body);
    direction: rtl;
    width: 100%;
    /* ⚠️ overflow-x: hidden را از html و body بردارید.
       به‌جایش روی .page و .content بگذارید. */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    height: 100%;
    min-height: 100dvh; /* فقط به‌عنوان کف، نه سقف */
    overflow-y: auto; /* ← اسکرول اصلی روی body */
    overflow-x: hidden; /* ← افقی مخفی، عمودی آزاد */
}

#app {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* PWA: جلوگیری از pull-to-refresh فقط در standalone */
@media (display-mode: standalone) {
    body {
        overscroll-behavior-y: none;
    }
}

/* رفع مشکل iOS Safari — فقط در standalone */
@supports (-webkit-touch-callout: none) {
    body {
        min-height: -webkit-fill-available;
    }
}

#app {
    min-height: 100dvh;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ============================================================
   ۳. تایپوگرافی
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 1.8rem;
}

h2 {
    font-size: 1.5rem;
}

h3 {
    font-size: 1.3rem;
}

h4 {
    font-size: 1.1rem;
}

h5 {
    font-size: 1rem;
}

h6 {
    font-size: 0.9rem;
}

p {
    margin-bottom: 0.5rem;
}

a, .btn-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

    a:hover, .btn-link:hover {
        color: var(--primary-light);
        text-decoration: underline;
    }

/* ============================================================
   ۴. اسکرول‌بار
   ============================================================ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: rgba(102, 126, 234, 0.6);
    }

/* ============================================================
   ۵. کلاس‌های کمکی (Utility)
   ============================================================ */

/* ===== متن ===== */
.text-center {
    text-align: center !important;
}

.text-right {
    text-align: right !important;
}

.text-left {
    text-align: left !important;
}

.text-start {
    text-align: right !important;
}

.text-end {
    text-align: left !important;
}

.text-nowrap {
    white-space: nowrap !important;
}

.text-truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-muted {
    color: var(--text-muted) !important;
}

.text-white {
    color: var(--text-primary) !important;
}

.text-primary {
    color: var(--primary-color) !important;
}

.text-success {
    color: var(--success-color) !important;
}

.text-danger {
    color: var(--danger-color) !important;
}

.text-warning {
    color: var(--warning-color) !important;
}

.text-info {
    color: var(--info-color) !important;
}

.fw-bold {
    font-weight: 700 !important;
}

.fw-normal {
    font-weight: 400 !important;
}

.fst-italic {
    font-style: italic !important;
}

/* ===== اندازه فونت ===== */
.fs-xs {
    font-size: var(--font-size-xs) !important;
}

.fs-sm {
    font-size: var(--font-size-sm) !important;
}

.fs-md {
    font-size: var(--font-size-md) !important;
}

.fs-lg {
    font-size: var(--font-size-lg) !important;
}

.fs-xl {
    font-size: var(--font-size-xl) !important;
}

.fs-1 {
    font-size: 1.5rem !important;
}

.fs-2 {
    font-size: 1.4rem !important;
}

.fs-3 {
    font-size: 1.3rem !important;
}

.fs-4 {
    font-size: 1.1rem !important;
}

.fs-5 {
    font-size: 1rem !important;
}

.fs-6 {
    font-size: 0.85rem !important;
}

/* ===== Display ===== */
.d-none {
    display: none !important;
}

.d-block {
    display: block !important;
}

.d-inline {
    display: inline !important;
}

.d-inline-block {
    display: inline-block !important;
}

.d-flex {
    display: flex !important;
}

.d-inline-flex {
    display: inline-flex !important;
}

.d-grid {
    display: grid !important;
}

/* ===== Flex ===== */
.flex-row {
    flex-direction: row !important;
}

.flex-column {
    flex-direction: column !important;
}

.flex-wrap {
    flex-wrap: wrap !important;
}

.flex-nowrap {
    flex-wrap: nowrap !important;
}

.flex-grow-1 {
    flex-grow: 1 !important;
}

.flex-shrink-0 {
    flex-shrink: 0 !important;
}

.align-items-start {
    align-items: flex-start !important;
}

.align-items-center {
    align-items: center !important;
}

.align-items-end {
    align-items: flex-end !important;
}

.align-items-stretch {
    align-items: stretch !important;
}

.justify-content-start {
    justify-content: flex-start !important;
}

.justify-content-center {
    justify-content: center !important;
}

.justify-content-end {
    justify-content: flex-end !important;
}

.justify-content-between {
    justify-content: space-between !important;
}

.justify-content-around {
    justify-content: space-around !important;
}

/* ===== Gap ===== */
.gap-0 {
    gap: 0 !important;
}

.gap-1 {
    gap: var(--spacing-xs) !important;
}

.gap-2 {
    gap: var(--spacing-sm) !important;
}

.gap-3 {
    gap: var(--spacing-md) !important;
}

.gap-4 {
    gap: var(--spacing-lg) !important;
}

.gap-5 {
    gap: var(--spacing-xl) !important;
}

/* ===== Width / Height ===== */
.w-100 {
    width: 100% !important;
}

.w-auto {
    width: auto !important;
}

.h-100 {
    height: 100% !important;
}

.h-auto {
    height: auto !important;
}

.mw-100 {
    max-width: 100% !important;
}

.mh-100 {
    max-height: 100% !important;
}

/* ===== Margin ===== */
.m-0 {
    margin: 0 !important;
}

.m-1 {
    margin: var(--spacing-xs) !important;
}

.m-2 {
    margin: var(--spacing-sm) !important;
}

.m-3 {
    margin: var(--spacing-md) !important;
}

.m-4 {
    margin: var(--spacing-lg) !important;
}

.m-5 {
    margin: var(--spacing-xl) !important;
}

.m-auto {
    margin: auto !important;
}

.mt-0 {
    margin-top: 0 !important;
}

.mt-1 {
    margin-top: var(--spacing-xs) !important;
}

.mt-2 {
    margin-top: var(--spacing-sm) !important;
}

.mt-3 {
    margin-top: var(--spacing-md) !important;
}

.mt-4 {
    margin-top: var(--spacing-lg) !important;
}

.mt-5 {
    margin-top: var(--spacing-xl) !important;
}

.mb-0 {
    margin-bottom: 0 !important;
}

.mb-1 {
    margin-bottom: var(--spacing-xs) !important;
}

.mb-2 {
    margin-bottom: var(--spacing-sm) !important;
}

.mb-3 {
    margin-bottom: var(--spacing-md) !important;
}

.mb-4 {
    margin-bottom: var(--spacing-lg) !important;
}

.mb-5 {
    margin-bottom: var(--spacing-xl) !important;
}

.ms-0 {
    margin-right: 0 !important;
}

.ms-1 {
    margin-right: var(--spacing-xs) !important;
}

.ms-2 {
    margin-right: var(--spacing-sm) !important;
}

.ms-3 {
    margin-right: var(--spacing-md) !important;
}

.ms-4 {
    margin-right: var(--spacing-lg) !important;
}

.ms-5 {
    margin-right: var(--spacing-xl) !important;
}

.me-0 {
    margin-left: 0 !important;
}

.me-1 {
    margin-left: var(--spacing-xs) !important;
}

.me-2 {
    margin-left: var(--spacing-sm) !important;
}

.me-3 {
    margin-left: var(--spacing-md) !important;
}

.me-4 {
    margin-left: var(--spacing-lg) !important;
}

.me-5 {
    margin-left: var(--spacing-xl) !important;
}

.mx-0 {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

.mx-1 {
    margin-right: var(--spacing-xs) !important;
    margin-left: var(--spacing-xs) !important;
}

.mx-2 {
    margin-right: var(--spacing-sm) !important;
    margin-left: var(--spacing-sm) !important;
}

.mx-3 {
    margin-right: var(--spacing-md) !important;
    margin-left: var(--spacing-md) !important;
}

.mx-auto {
    margin-right: auto !important;
    margin-left: auto !important;
}

.my-0 {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.my-1 {
    margin-top: var(--spacing-xs) !important;
    margin-bottom: var(--spacing-xs) !important;
}

.my-2 {
    margin-top: var(--spacing-sm) !important;
    margin-bottom: var(--spacing-sm) !important;
}

.my-3 {
    margin-top: var(--spacing-md) !important;
    margin-bottom: var(--spacing-md) !important;
}

/* ===== Padding ===== */
.p-0 {
    padding: 0 !important;
}

.p-1 {
    padding: var(--spacing-xs) !important;
}

.p-2 {
    padding: var(--spacing-sm) !important;
}

.p-3 {
    padding: var(--spacing-md) !important;
}

.p-4 {
    padding: var(--spacing-lg) !important;
}

.p-5 {
    padding: var(--spacing-xl) !important;
}

.pt-0 {
    padding-top: 0 !important;
}

.pt-1 {
    padding-top: var(--spacing-xs) !important;
}

.pt-2 {
    padding-top: var(--spacing-sm) !important;
}

.pt-3 {
    padding-top: var(--spacing-md) !important;
}

.pt-4 {
    padding-top: var(--spacing-lg) !important;
}

.pb-0 {
    padding-bottom: 0 !important;
}

.pb-1 {
    padding-bottom: var(--spacing-xs) !important;
}

.pb-2 {
    padding-bottom: var(--spacing-sm) !important;
}

.pb-3 {
    padding-bottom: var(--spacing-md) !important;
}

.pb-4 {
    padding-bottom: var(--spacing-lg) !important;
}

.ps-0 {
    padding-right: 0 !important;
}

.ps-1 {
    padding-right: var(--spacing-xs) !important;
}

.ps-2 {
    padding-right: var(--spacing-sm) !important;
}

.ps-3 {
    padding-right: var(--spacing-md) !important;
}

.ps-4 {
    padding-right: var(--spacing-lg) !important;
}

.ps-5 {
    padding-right: var(--spacing-xl) !important;
}

.pe-0 {
    padding-left: 0 !important;
}

.pe-1 {
    padding-left: var(--spacing-xs) !important;
}

.pe-2 {
    padding-left: var(--spacing-sm) !important;
}

.pe-3 {
    padding-left: var(--spacing-md) !important;
}

.pe-4 {
    padding-left: var(--spacing-lg) !important;
}

.pe-5 {
    padding-left: var(--spacing-xl) !important;
}

.px-0 {
    padding-right: 0 !important;
    padding-left: 0 !important;
}

.px-1 {
    padding-right: var(--spacing-xs) !important;
    padding-left: var(--spacing-xs) !important;
}

.px-2 {
    padding-right: var(--spacing-sm) !important;
    padding-left: var(--spacing-sm) !important;
}

.px-3 {
    padding-right: var(--spacing-md) !important;
    padding-left: var(--spacing-md) !important;
}

.px-4 {
    padding-right: var(--spacing-lg) !important;
    padding-left: var(--spacing-lg) !important;
}

.px-5 {
    padding-right: var(--spacing-xl) !important;
    padding-left: var(--spacing-xl) !important;
}

.py-0 {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

.py-1 {
    padding-top: var(--spacing-xs) !important;
    padding-bottom: var(--spacing-xs) !important;
}

.py-2 {
    padding-top: var(--spacing-sm) !important;
    padding-bottom: var(--spacing-sm) !important;
}

.py-3 {
    padding-top: var(--spacing-md) !important;
    padding-bottom: var(--spacing-md) !important;
}

.py-4 {
    padding-top: var(--spacing-lg) !important;
    padding-bottom: var(--spacing-lg) !important;
}

.py-5 {
    padding-top: var(--spacing-xl) !important;
    padding-bottom: var(--spacing-xl) !important;
}

/* ===== Position ===== */
.position-relative {
    position: relative !important;
}

.position-absolute {
    position: absolute !important;
}

.position-fixed {
    position: fixed !important;
}

.position-sticky {
    position: sticky !important;
}

.top-0 {
    top: 0 !important;
}

.bottom-0 {
    bottom: 0 !important;
}

.start-0 {
    right: 0 !important;
}

.end-0 {
    left: 0 !important;
}

/* ===== Border ===== */
.border {
    border: 1px solid var(--border-color) !important;
}

.border-0 {
    border: 0 !important;
}

.border-top {
    border-top: 1px solid var(--border-color) !important;
}

.border-bottom {
    border-bottom: 1px solid var(--border-color) !important;
}

.border-start {
    border-right: 1px solid var(--border-color) !important;
}

.border-end {
    border-left: 1px solid var(--border-color) !important;
}

.rounded {
    border-radius: var(--radius-md) !important;
}

.rounded-sm {
    border-radius: var(--radius-sm) !important;
}

.rounded-lg {
    border-radius: var(--radius-lg) !important;
}

.rounded-circle {
    border-radius: var(--radius-round) !important;
}

.rounded-0 {
    border-radius: 0 !important;
}

/* ===== Background ===== */
.bg-transparent {
    background: transparent !important;
}

.bg-dark {
    background: var(--bg-input) !important;
}

.bg-card {
    background: var(--bg-card) !important;
}

.bg-primary {
    background: var(--primary-color) !important;
    color: #ffffff !important;
}

.bg-success {
    background: var(--success-color) !important;
    color: #ffffff !important;
}

.bg-danger {
    background: var(--danger-color) !important;
    color: #ffffff !important;
}

.bg-warning {
    background: var(--warning-color) !important;
    color: #1a1a2e !important;
}

.bg-info {
    background: var(--info-color) !important;
    color: #ffffff !important;
}

/* ===== Shadow ===== */
.shadow-sm {
    box-shadow: var(--shadow-sm) !important;
}

.shadow {
    box-shadow: var(--shadow-md) !important;
}

.shadow-lg {
    box-shadow: var(--shadow-lg) !important;
}

.shadow-none {
    box-shadow: none !important;
}

/* ============================================================
   ۶. Grid (Bootstrap-like)
   ============================================================ */
.container {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

.container-fluid {
    width: 100%;
    padding-right: var(--spacing-md);
    padding-left: var(--spacing-md);
    margin-right: auto;
    margin-left: auto;
}

.row {
    display: flex;
    flex-wrap: wrap;
    margin-right: -0.5rem;
    margin-left: -0.5rem;
}

    .row > * {
        padding-right: 0.5rem;
        padding-left: 0.5rem;
        width: 100%;
    }

.g-0 {
    margin: 0;
}

    .g-0 > * {
        padding: 0;
    }

.g-1 {
    margin: -0.125rem;
}

    .g-1 > * {
        padding: 0.125rem;
    }

.g-2 {
    margin: -0.25rem;
}

    .g-2 > * {
        padding: 0.25rem;
    }

.g-3 {
    margin: -0.5rem;
}

    .g-3 > * {
        padding: 0.5rem;
    }

.col-1 {
    flex: 0 0 auto;
    width: 8.33333333%;
}

.col-2 {
    flex: 0 0 auto;
    width: 16.66666667%;
}

.col-3 {
    flex: 0 0 auto;
    width: 25%;
}

.col-4 {
    flex: 0 0 auto;
    width: 33.33333333%;
}

.col-5 {
    flex: 0 0 auto;
    width: 41.66666667%;
}

.col-6 {
    flex: 0 0 auto;
    width: 50%;
}

.col-7 {
    flex: 0 0 auto;
    width: 58.33333333%;
}

.col-8 {
    flex: 0 0 auto;
    width: 66.66666667%;
}

.col-9 {
    flex: 0 0 auto;
    width: 75%;
}

.col-10 {
    flex: 0 0 auto;
    width: 83.33333333%;
}

.col-11 {
    flex: 0 0 auto;
    width: 91.66666667%;
}

.col-12 {
    flex: 0 0 auto;
    width: 100%;
}

@media (min-width: 768px) {
    .col-md-1 {
        flex: 0 0 auto;
        width: 8.33333333%;
    }

    .col-md-2 {
        flex: 0 0 auto;
        width: 16.66666667%;
    }

    .col-md-3 {
        flex: 0 0 auto;
        width: 25%;
    }

    .col-md-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-md-5 {
        flex: 0 0 auto;
        width: 41.66666667%;
    }

    .col-md-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-md-7 {
        flex: 0 0 auto;
        width: 58.33333333%;
    }

    .col-md-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }

    .col-md-9 {
        flex: 0 0 auto;
        width: 75%;
    }

    .col-md-10 {
        flex: 0 0 auto;
        width: 83.33333333%;
    }

    .col-md-12 {
        flex: 0 0 auto;
        width: 100%;
    }
}

@media (min-width: 992px) {
    .col-lg-1 {
        flex: 0 0 auto;
        width: 8.33333333%;
    }

    .col-lg-2 {
        flex: 0 0 auto;
        width: 16.66666667%;
    }

    .col-lg-3 {
        flex: 0 0 auto;
        width: 25%;
    }

    .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }

    .col-lg-5 {
        flex: 0 0 auto;
        width: 41.66666667%;
    }

    .col-lg-6 {
        flex: 0 0 auto;
        width: 50%;
    }

    .col-lg-7 {
        flex: 0 0 auto;
        width: 58.33333333%;
    }

    .col-lg-8 {
        flex: 0 0 auto;
        width: 66.66666667%;
    }

    .col-lg-9 {
        flex: 0 0 auto;
        width: 75%;
    }

    .col-lg-12 {
        flex: 0 0 auto;
        width: 100%;
    }
}

/* ============================================================
   ۷. دکمه‌ها (Buttons)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    padding: 0.5rem 1rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    line-height: 1.5;
    min-height: 44px;
    min-width: 44px;
    user-select: none;
    touch-action: manipulation;
    font-family: var(--font-family);
    white-space: nowrap;
}

    .btn:active {
        transform: scale(0.97);
    }

    .btn:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none !important;
    }

.btn-primary {
    background: #667eea;
    border: 1px solid #667eea;
    color: #ffffff;
}

    .btn-primary:hover:not(:disabled) {
        background: #5a6fd8;
        border-color: #5a6fd8;
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    }

.btn-success {
    background: #28a745;
    border: 1px solid #28a745;
    color: #ffffff;
}

    .btn-success:hover:not(:disabled) {
        background: #218838;
        border-color: #1e7e34;
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
    }

.btn-danger {
    background: #dc3545;
    border: 1px solid #dc3545;
    color: #ffffff;
}

    .btn-danger:hover:not(:disabled) {
        background: #c82333;
        border-color: #bd2130;
        color: #ffffff;
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(220, 53, 69, 0.3);
    }

.btn-warning {
    background: #ffc107;
    border: 1px solid #ffc107;
    color: #1a1a2e;
}

    .btn-warning:hover:not(:disabled) {
        background: #e0a800;
        border-color: #d39e00;
        color: #1a1a2e;
    }

.btn-secondary {
    background: #3d3d4d;
    border: 1px solid #4d4d5d;
    color: #c0c0d0;
}

    .btn-secondary:hover:not(:disabled) {
        background: #4d4d5d;
        border-color: #5d5d6d;
        color: #ffffff;
    }

.btn-outline-primary {
    background: transparent;
    border: 1px solid #4a5a8a;
    color: #8a9cf0;
}

    .btn-outline-primary:hover:not(:disabled) {
        background: #667eea;
        border-color: #667eea;
        color: #ffffff;
    }

.btn-outline-secondary {
    background: transparent;
    border: 1px solid #4d4d5d;
    color: #b0b0c0;
}

    .btn-outline-secondary:hover:not(:disabled) {
        background: #4d4d5d;
        border-color: #5d5d6d;
        color: #ffffff;
    }

.btn-outline-danger {
    background: transparent;
    border: 1px solid #8a4a4a;
    color: #f0a0a0;
}

    .btn-outline-danger:hover:not(:disabled) {
        background: #dc3545;
        border-color: #dc3545;
        color: #ffffff;
    }

.btn-outline-success {
    background: transparent;
    border: 1px solid #2a5a3a;
    color: #a0e0b0;
}

    .btn-outline-success:hover:not(:disabled) {
        background: #28a745;
        border-color: #28a745;
        color: #ffffff;
    }

/* Sizes */
.btn-sm {
    padding: 0.15rem 0.4rem;
    font-size: var(--font-size-sm);
    min-height: 32px;
    min-width: 32px;
    border-radius: var(--radius-md);
}

.btn-lg {
    padding: 0.3rem 0.6rem;
    font-size: var(--font-size-lg);
    min-height: 48px;
    border-radius: var(--radius-lg);
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    padding: 0.3rem;
    min-width: 38px;
    min-height: 38px;
    border-radius: var(--radius-md);
}

/* روی دستگاه‌های لمسی، hover را غیرفعال کن تا گیر نکند */
@media (hover: none) {
    .btn:hover:not(:disabled) {
        transform: none;
        box-shadow: none;
    }
}

/* ============================================================
   ۸. فرم‌ها (Forms)
   ============================================================ */
.form-group {
    margin-bottom: var(--spacing-md);
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-family: var(--font-family);
    min-height: 44px;
    outline: none;
}

    .form-control:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    }

    .form-control::placeholder {
        color: var(--text-muted);
        opacity: 1;
    }

    .form-control:disabled,
    .form-control[readonly] {
        background: var(--bg-card);
        opacity: 0.7;
        cursor: not-allowed;
    }

.form-control-lg {
    padding: 0.4rem 0.8rem;
    font-size: var(--font-size-lg);
    min-height: 48px;
    border-radius: var(--radius-lg);
}

.form-control-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-size-sm);
    min-height: 34px;
    border-radius: var(--radius-sm);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-lg);
    background-color: var(--bg-input);
    color: var(--text-secondary);
    font-family: var(--font-family);
    min-height: 44px;
    cursor: pointer;
    transition: border-color var(--transition-fast);
    outline: none;
}

    .form-select:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
    }

    .form-select option {
        background-color: var(--bg-card);
        color: var(--text-secondary);
    }

/* ===== Input Group ===== */
.input-group {
    display: flex;
    align-items: stretch;
    width: 100%;
}

    .input-group > .form-control {
        flex: 1 1 auto;
        min-width: 0;
    }

.input-group-text {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.3rem 0.6rem;
    background: var(--bg-card-header);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    font-size: var(--font-size-lg);
    min-height: 44px;
    white-space: nowrap;
}

.input-group > .input-group-text:first-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    border-left: none;
}

.input-group > .input-group-text:last-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    border-right: none;
}

.input-group > .form-control:not(:first-child):not(:last-child) {
    border-radius: 0;
}

.input-group > .form-control:first-child {
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.input-group > .form-control:last-child {
    border-radius: var(--radius-md) 0 0 var(--radius-md);
}

/* ===== Form Text / Divider / Meta ===== */
.form-text {
    display: block;
    margin-top: var(--spacing-xs);
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--spacing-sm) 0;
}

.meta-item {
    display: inline-block;
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    background: var(--bg-card-header);
    padding: 0.05rem 0.5rem;
    border-radius: var(--radius-sm);
}

/* ===== Form Check ===== */
.form-check {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-sm);
}

.form-check-input {
    width: 1.2rem;
    height: 1.2rem;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
}

label {
    color: var(--text-primary) !important;
    font-weight: 600;
    font-size: 0.85rem;
    display: block;
    margin-bottom: 0.25rem;
}

/* ============================================================
   ۹. کارت (Card)
   ============================================================ */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--transition-normal);
    color: var(--text-secondary);
}

    .card:hover {
        box-shadow: var(--shadow-md);
    }

.card-header {
    padding: 0.7rem 1rem;
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    font-weight: 600;
    font-size: var(--font-size-md);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-body {
    padding: 1rem;
}

.card-footer {
    padding: 0.7rem 1rem;
    background: var(--bg-card-header);
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* ============================================================
   ۱۰. Badge
   ============================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-xs);
    font-weight: 600;
    line-height: 1.5;
    white-space: nowrap;
}

.badge-primary {
    background: #667eea;
    color: #ffffff;
}

.badge-success {
    background: #28a745;
    color: #ffffff;
}

.badge-danger {
    background: #dc3545;
    color: #ffffff;
}

.badge-warning {
    background: #ffc107;
    color: #1a1a2e;
}

.badge-info {
    background: #17a2b8;
    color: #ffffff;
}

.badge-secondary {
    background: #6c757d;
    color: #ffffff;
}

/* ============================================================
   ۱۱. Alert
   ============================================================ */
.alert {
    padding: 0.7rem 0.9rem;
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    border: 1px solid transparent;
    font-size: var(--font-size-md);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    animation: fadeIn 0.2s ease;
}

.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
    border-color: var(--success-border);
}

.alert-danger {
    background: var(--danger-bg);
    color: var(--danger-text);
    border-color: var(--danger-border);
}

.alert-warning {
    background: var(--warning-bg);
    color: var(--warning-text);
    border-color: var(--warning-border);
}

.alert-info {
    background: var(--info-bg);
    color: var(--info-text);
    border-color: var(--info-border);
}

.alert-sm {
    padding: 0.4rem 0.6rem;
    font-size: var(--font-size-sm);
}

/* ============================================================
   ۱۲. Table + Responsive
   ============================================================ */
.table {
    width: 100%;
    border-collapse: collapse;
    color: var(--text-secondary);
}

    .table th,
    .table td {
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border-color);
        text-align: right;
    }

    .table th {
        background: var(--bg-card-header);
        color: var(--text-primary);
        font-weight: 600;
        font-size: var(--font-size-sm);
    }

    .table tr:hover {
        background: rgba(255, 255, 255, 0.03);
    }

/* Wrapper اختیاری — برای جدول‌های عریض در موبایل */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ============================================================
   ۱۳. Modal
   ============================================================ */
.modal {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    overflow: hidden;
    outline: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

    .modal.show {
        display: flex !important;
        align-items: center;
        justify-content: center;
    }

.modal-dialog {
    margin: 0.5rem;
    width: calc(100% - 1rem);
    max-width: 500px;
    position: relative;
}

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    color: var(--text-secondary);
    overflow: hidden;
}

.modal-header {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.modal-body {
    padding: 1rem;
}

.modal-footer {
    padding: 0.6rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: var(--spacing-sm);
}

.btn-close {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

    .btn-close:hover {
        background: rgba(255, 255, 255, 0.1);
        color: var(--text-primary);
    }

.btn-close-white {
    filter: invert(1) grayscale(100%) brightness(200%);
}

/* ============================================================
   ۱۴. Spinner
   ============================================================ */
.spinner-border {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    vertical-align: text-bottom;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: var(--radius-round);
    animation: spin 0.75s linear infinite;
}

.spinner-border-sm {
    width: 0.9rem;
    height: 0.9rem;
    border-width: 2px;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
    border-width: 4px;
}

/* ============================================================
   ۱۵. List Group
   ============================================================ */
.list-group {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    overflow: hidden;
}

.list-group-flush {
    border-radius: 0;
}

.list-group-item {
    padding: 0.5rem 0.6rem;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-light);
    color: var(--text-secondary);
    border-radius: 0;
}

    .list-group-item:last-child {
        border-bottom: none;
    }

/* ============================================================
   ۱۶. Layout (MainLayout)
   ============================================================ */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow-x: hidden; /* ← اضافه شد: جلوگیری از اسکرول افقی در کل layout */
}

.sidebar {
    width: 280px;
    flex-shrink: 0;
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    height: 100vh;
    position: sticky;
    top: 0;
    overflow-y: auto;
    z-index: 10;
}

main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* ← مهم: اجازه می‌دهد در flexbox اسکرول شود */
    min-height: 100dvh;
    background: var(--bg-body);
    width: 100%;
}

.content {
    flex: 1;
    padding: 1.5rem;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    background: var(--bg-body);
}

/* ===== فوتر ===== */
.footer {
    flex-shrink: 0;
    background: linear-gradient(135deg, #0f0f1f 0%, #1a1a2e 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem 1.5rem;
    width: 100%;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-link {
    color: rgba(255, 255, 255, 0.5);
    text-decoration: none;
    transition: all 0.3s ease;
    font-weight: 500;
    letter-spacing: 0.3px;
}

    .footer-link:hover {
        color: rgba(255, 255, 255, 0.85);
        text-decoration: underline;
        text-decoration-color: rgba(102, 126, 234, 0.5);
        text-underline-offset: 3px;
    }

.footer-version {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.15rem 0.7rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    font-weight: 500;
    letter-spacing: 0.5px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ============================================================
   ۱۷. انیمیشن‌ها
   ============================================================ */
@keyframes fadeIn {
    0% {
        opacity: 0;
    }

    100% {
        opacity: 1;
    }
}

@keyframes slideUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    0% {
        opacity: 0;
        transform: translateY(-10px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* ============================================================
   ۱۸. ریسپانسیو — موبایل
   ============================================================ */
@media (max-width: 767.98px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        max-height: 60vh;
        overflow-y: auto;
    }

    .content {
        padding: 0.75rem;
    }

    .footer {
        padding: 0.6rem 1rem;
    }

    .footer-content {
        font-size: 0.65rem;
        flex-direction: column-reverse;
        gap: 0.4rem;
        text-align: center;
    }

    .footer-link {
        font-size: 0.65rem;
    }

    .footer-version {
        font-size: 0.5rem;
        padding: 0.1rem 0.5rem;
    }

    /* خوانایی بهتر متن روی موبایل */
    :root {
        --font-size-md: 0.9rem;
    }

    /* دکمه‌های کوچک در موبایل کمی بزرگ‌تر شوند */
    .btn-sm {
        min-height: 36px;
        min-width: 36px;
    }
}

@media (max-width: 480px) {
    .footer-content {
        font-size: 0.55rem;
    }

    .footer-link {
        font-size: 0.55rem;
    }

    .footer-version {
        font-size: 0.45rem;
        padding: 0.05rem 0.4rem;
    }

    .container {
        padding-right: 0.3rem;
        padding-left: 0.3rem;
    }
}

@media (min-width: 768px) {
    .page {
        flex-direction: row;
    }
}

@media (min-width: 1400px) {
    .content {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* ============================================================
   ۱۹. PWA — وضعیت standalone (نصب‌شده)
   ============================================================ */
@media (display-mode: standalone) {
    /* Safe Area فقط روی عناصر ساختاری اعمال شود، نه body */
    .sidebar {
        padding-top: env(safe-area-inset-top, 0px);
    }

    .footer {
        padding-bottom: calc(0.8rem + env(safe-area-inset-bottom, 0px));
    }

    /* حس بومی‌تر: متن قابل انتخاب فقط در محتوای اصلی */
    body {
        -webkit-user-select: none;
        user-select: none;
    }

    .content,
    input,
    textarea,
    select,
    .selectable,
    .receipt-section {
        -webkit-user-select: text;
        user-select: text;
    }
}

/* جلوگیری از pull-to-refresh در PWA — فقط در حالت standalone */
@media (display-mode: standalone) {
    html, body {
        overscroll-behavior-y: none;
    }
}

/* ============================================================
   ۲۰. Combo Box (Select) — قابل استفاده مجدد
   ============================================================ */
.form-select-custom {
    /* باکس مدل */
    display: block;
    box-sizing: border-box;
    width: 100%;
    /* ظاهر */
    padding: 0.55rem 2.2rem 0.55rem 0.75rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-family);
    font-size: var(--font-size-sm);
    line-height: 1.4;
    vertical-align: middle;
    /* تعامل */
    cursor: pointer;
    outline: none;
    min-height: 42px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    /* حذف فلش پیش‌فرض */
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    /* فلش سفارشی — سمت چپ برای RTL */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath fill='%23a0a0b0' d='M7 10L2 5h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 0.7rem center;
    background-size: 12px;
}

    .form-select-custom:hover:not(:disabled) {
        border-color: var(--primary-color);
    }

    .form-select-custom:focus {
        border-color: var(--primary-color);
        box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
    }

    .form-select-custom:disabled {
        opacity: 0.6;
        cursor: not-allowed;
    }

    .form-select-custom option {
        background: var(--bg-card);
        color: var(--text-secondary);
        padding: 0.5rem;
        font-family: var(--font-family);
        line-height: 1.4;
    }

        .form-select-custom option:checked {
            background: rgba(102, 126, 234, 0.2);
            color: var(--text-primary);
        }

/* سایزها — بعد از پایه تعریف شوند تا override کنند */
.form-select-sm {
    padding: 0.4rem 1.9rem 0.4rem 0.6rem;
    font-size: var(--font-size-xs);
    min-height: 34px;
    border-radius: var(--radius-sm);
}

.form-select-lg {
    padding: 0.7rem 2.4rem 0.7rem 0.9rem;
    font-size: var(--font-size-md);
    min-height: 48px;
    border-radius: var(--radius-md);
}

/* ============================================================
   ۲۱. Step05 — صفحه بازبینی نهایی (مرحله‌محور)
   ============================================================ */
.review-step .review-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

    .review-step .review-header h2 {
        color: var(--text-primary);
        margin-bottom: var(--spacing-xs);
    }

    .review-step .review-header p {
        color: var(--text-muted);
        font-size: var(--font-size-sm);
    }

.review-divider {
    border: none;
    border-top: 1px dashed var(--border-color);
    margin: var(--spacing-md) 0;
    opacity: 0.6;
}

.review-section {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

    .review-section:hover {
        box-shadow: var(--shadow-sm);
    }

.review-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
}

.review-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 700;
    color: var(--text-primary);
    font-size: var(--font-size-lg);
}

.review-section-icon {
    font-size: var(--font-size-xl);
}

.review-errors-box {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-md);
    margin: 0.75rem 1rem;
    padding: 0.6rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.review-error-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: var(--font-size-sm);
    color: var(--danger-text);
    padding: 0.25rem 0;
    border-bottom: 1px dashed var(--danger-border);
}

    .review-error-item:last-child {
        border-bottom: none;
    }

    .review-error-item .error-code {
        font-family: monospace;
        font-weight: 700;
        background: var(--danger-color);
        color: #ffffff;
        padding: 0.1rem 0.4rem;
        border-radius: var(--radius-sm);
        font-size: var(--font-size-xs);
        flex-shrink: 0;
    }

    .review-error-item .error-message {
        flex: 1;
    }

.review-section-body {
    padding: var(--spacing-md);
}

/* ─── info-grid ─── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-sm);
}

.info-item {
    display: flex;
    flex-direction: column;
    padding: 0.4rem 0.65rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

    .info-item:hover {
        border-color: var(--primary-color);
    }

    .info-item.highlight {
        background: var(--success-bg);
        border-color: var(--success-border);
    }

.info-label {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 0.2rem;
    font-weight: 500;
}

.info-value {
    font-size: var(--font-size-md);
    color: var(--text-primary);
    font-weight: 500;
    word-break: break-word;
}

/* ─── طرفین ─── */
.parties-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
}

.party-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
}

    .party-card.party-card-info {
        background: var(--info-bg);
        border-color: var(--info-border);
    }

.party-header {
    padding: 0.5rem 0.85rem;
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-md);
}

.party-icon {
    font-size: var(--font-size-lg);
}

.party-body {
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

/* ─── کارت‌های اقلام ─── */
.items-cards {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.item-review-card {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: box-shadow var(--transition-fast);
}

    .item-review-card:hover {
        box-shadow: var(--shadow-sm);
        border-color: var(--primary-color);
    }

.item-review-header {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.5rem 0.75rem;
    background: var(--bg-card-header);
    border-bottom: 1px solid var(--border-color);
}

.item-review-num {
    background: var(--primary-color);
    color: #ffffff;
    border-radius: var(--radius-round);
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-xs);
    font-weight: 700;
    flex-shrink: 0;
}

.item-review-title {
    flex: 1;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-review-code {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    flex-shrink: 0;
}

.item-review-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: var(--spacing-xs);
    padding: 0.5rem;
}

    .item-review-body .info-item {
        padding: 0.3rem 0.45rem;
    }

    .item-review-body .info-label {
        font-size: 0.6rem;
    }

    .item-review-body .info-value {
        font-size: var(--font-size-sm);
    }

    .item-review-body .info-item.item-total {
        background: var(--info-bg);
        border-color: var(--info-border);
    }

/* ─── خلاصه مالی ─── */
.summary-box {
    padding: var(--spacing-sm);
    background: var(--bg-card-header);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
}

/* ─── دکمه ارسال ─── */
.review-actions {
    margin-top: var(--spacing-lg);
    padding: var(--spacing-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
}

/* ─── ریسپانسیو Step05 ─── */
@media (max-width: 767.98px) {
    .info-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .parties-grid {
        grid-template-columns: 1fr;
    }

    .item-review-body {
        grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    }

    .review-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* ============================================================
   ۲۲. رسید صورتحساب (Step06) — نسخه نهایی یکپارچه
   ============================================================ */
.receipt-section {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.receipt-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.receipt-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--bg-input);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast);
}

    .receipt-item:hover {
        border-color: var(--primary-color);
    }

.receipt-icon {
    font-size: 1.4rem;
    flex-shrink: 0;
}

.receipt-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
    flex-shrink: 0;
}

.receipt-value {
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-right: auto;
    word-break: break-all;
}

/* چاپ: فقط کادر رسید */
@media print {
    body * {
        visibility: hidden;
    }

    #receipt-print-area,
    #receipt-print-area * {
        visibility: visible;
    }

    #receipt-print-area {
        position: absolute;
        top: 0;
        right: 0;
        left: 0;
        border: 2px solid #000;
        padding: 20px;
        background: #fff;
        color: #000;
    }

    .receipt-icon,
    .btn,
    .action-buttons,
    .review-errors-box,
    .alert {
        display: none !important;
    }

    .receipt-value {
        color: #000;
    }

    .receipt-label {
        color: #555;
    }

    body {
        background: #fff;
        color: #000;
    }
}

/* ============================================================
   ۲۳. مراحل پرش‌شده (Step Flow)
   ============================================================ */
.step-item.skipped {
    opacity: 0.5;
    cursor: not-allowed;
}

    .step-item.skipped .step-circle {
        background: var(--bg-card-header);
        color: var(--text-muted);
    }

    .step-item.skipped .step-title {
        text-decoration: line-through;
        color: var(--text-muted);
    }

/* ============================================================
   ۲۴. Timeline (تاریخچه فاکتور)
   ============================================================ */
.timeline {
    position: relative;
    padding: 20px 0;
    margin: 0;
}

    .timeline::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        right: 20px;
        width: 2px;
        background: var(--border-color);
    }

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-right: 50px;
}

    .timeline-item:last-child {
        margin-bottom: 0;
    }

    .timeline-item.current .timeline-panel {
        border-right: 3px solid var(--primary-color);
        background-color: rgba(102, 126, 234, 0.05);
    }

.timeline-badge {
    position: absolute;
    right: 11px;
    top: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    z-index: 1;
}

.timeline-panel {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition-fast);
}

    .timeline-panel:hover {
        box-shadow: var(--shadow-md);
    }

.timeline-heading {
    margin-bottom: 8px;
}

.timeline-title {
    margin-bottom: 5px;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    color: var(--text-primary);
}

    .timeline-title .badge {
        font-size: 0.65rem;
    }

.timeline-body {
    font-size: 0.75rem;
    color: var(--text-muted);
    word-break: break-all;
}

    .timeline-body .mono {
        font-family: 'Courier New', monospace;
        background: var(--bg-input);
        padding: 2px 6px;
        border-radius: var(--radius-sm);
        display: inline-block;
    }

/* ============================================================
   ۲۵. پنل پیام‌ها و خطاها (Page Messages)
   ============================================================ */
.page-messages-panel {
    animation: slideDown 0.25s ease;
    border-color: var(--border-color);
}

.page-messages-header {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-bottom: 1px solid var(--border-color);
    padding: 0.6rem 1rem;
}

.page-messages-title {
    font-weight: 700;
    font-size: var(--font-size-md);
    color: var(--text-primary);
}

.page-messages-body {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.page-messages-section {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.page-messages-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.page-messages-count {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-weight: 500;
}

.page-messages-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.page-messages-item {
    padding: 0.45rem 0.7rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    line-height: 1.6;
    border: 1px solid transparent;
    position: relative;
    padding-right: 1.8rem;
}

    .page-messages-item::before {
        content: '•';
        position: absolute;
        right: 0.7rem;
        top: 50%;
        transform: translateY(-50%);
        font-weight: 700;
        font-size: 1.1rem;
        line-height: 1;
    }

.page-messages-item-error {
    background: var(--danger-bg);
    border-color: var(--danger-border);
    color: var(--danger-text);
}

    .page-messages-item-error::before {
        color: var(--danger-color);
    }

.page-messages-item-info {
    background: var(--info-bg);
    border-color: var(--info-border);
    color: var(--info-text);
}

    .page-messages-item-info::before {
        color: var(--info-color);
    }

/* ============================================================
   ۲۶. Overlay سراسری Loading
   ============================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    animation: fadeIn 0.2s ease;
    cursor: wait;
}

.loading-box {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem 2rem;
    text-align: center;
    box-shadow: var(--shadow-xl);
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 180px;
}
/* ============================================================
   🎯 حل مشکل تراز کارت‌ها و محتوا در موبایل
   ============================================================ */

@media (max-width: 767.98px) {
    /* 1. حذف padding اضافی از content در موبایل */
    main {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .content {
        padding: 0.75rem !important; /* متقارن */
        margin: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

        /* 2. حذف px-4 اضافی روی article */
        .content.px-4 {
            padding: 0.75rem !important;
        }

    /* 3. اطمینان از تمام‌عرض بودن page */
    .page {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
    }

    /* 4. pنل نتایج */
    .results-panel {
        margin: 0 !important;
        padding: 0.5rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* 5. لیست کارت‌ها */
    .invoice-list {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .invoice-card {
        width: 100% !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* 6. هدر صفحه */
    .invoices-page {
        padding: 0.5rem !important;
        margin: 0 !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .page-header {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}
