/* ================================================
   سیستم حسابداری پیشرفته - استایل سفارشی
   ================================================ */

/* فونت وزیرمتن */
/* Generated by script */
@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Thin.woff2') format('woff2');
  font-weight: 100;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-ExtraLight.woff2') format('woff2');
  font-weight: 200;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Light.woff2') format('woff2');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-ExtraBold.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: Vazirmatn;
  src: url('fonts/webfonts/Vazirmatn-Black.woff2') format('woff2');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
    --primary: #1B2A4A;
    --primary-light: #2D4A7A;
    --primary-dark: #0F1A30;
    --accent: #0EA5E9;
    --accent-light: #38BDF8;
    --success: #10B981;
    --success-light: #34D399;
    --warning: #F59E0B;
    --warning-light: #FBBF24;
    --danger: #EF4444;
    --danger-light: #F87171;
    --bg: #F8FAFC;
    --bg-card: #FFFFFF;
    --text: #1E293B;
    --text-light: #64748B;
    --border: #E2E8F0;
    --sidebar-width: 260px;
    --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    max-width: 100vw;
}

body {
    font-family: 'Vazirmatn', Tahoma, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    direction: rtl;
    line-height: 1.7;
    font-size: 14px;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ---- انیمیشن‌ها ---- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

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

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

.fade-in {
    animation: fadeIn 0.4s ease-out;
}

.slide-in {
    animation: slideInRight 0.4s ease-out;
}

/* ---- صفحه ورود ---- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 50%, var(--accent) 100%);
    position: relative;
    overflow: hidden;
}

.login-wrapper::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(14,165,233,0.15) 0%, transparent 60%);
    animation: pulse 8s ease-in-out infinite;
}

.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 48px 40px;
    width: 420px;
    max-width: 95%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    position: relative;
    z-index: 1;
    animation: fadeIn 0.6s ease-out;
}

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

.login-card .login-logo i {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 12px;
    display: block;
}

.login-card .login-logo h1 {
    font-size: 22px;
    color: var(--primary);
    font-weight: 700;
}

.login-card .login-logo p {
    color: var(--text-light);
    font-size: 13px;
    margin-top: 4px;
}

.login-card .form-floating {
    margin-bottom: 16px;
}

.login-card .form-control {
    border-radius: 10px;
    border: 2px solid var(--border);
    padding: 12px 16px;
    font-size: 14px;
    transition: all 0.3s;
    direction: rtl;
}

.login-card .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15);
}

.login-card .btn-login {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 15px;
    font-weight: 600;
    width: 100%;
    transition: all 0.3s;
    cursor: pointer;
}

.login-card .btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(14,165,233,0.3);
}

.login-card .btn-login:active {
    transform: translateY(0);
}

/* ---- لایه اصلی ---- */
.app-wrapper {
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

/* ---- سایدبار ---- */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    color: white;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: all 0.3s;
}

.sidebar-brand {
    padding: 24px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i {
    font-size: 36px;
    color: var(--accent-light);
    margin-bottom: 8px;
    display: block;
}

.sidebar-brand h2 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 2px;
}

.sidebar-brand small {
    font-size: 11px;
    opacity: 0.6;
}

.sidebar-menu {
    padding: 16px 0;
}

.sidebar-menu .menu-label {
    padding: 8px 24px;
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    letter-spacing: 1px;
    font-weight: 600;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    padding: 11px 24px;
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    transition: all 0.3s;
    border-right: 3px solid transparent;
    gap: 12px;
}

.sidebar-menu a:hover {
    background: rgba(255,255,255,0.08);
    color: white;
}

.sidebar-menu a.active {
    background: rgba(14,165,233,0.2);
    color: var(--accent-light);
    border-right-color: var(--accent-light);
}

.sidebar-menu a i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-menu a span {
    font-size: 13px;
}

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    position: absolute;
    bottom: 0;
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0,0,0,0.15);
}

.sidebar-user .user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.sidebar-user .user-info {
    flex: 1;
}

.sidebar-user .user-info .name {
    font-size: 13px;
    font-weight: 600;
}

.sidebar-user .user-info .role {
    font-size: 11px;
    opacity: 0.6;
}

.sidebar-user .btn-logout {
    background: none;
    border: none;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    transition: color 0.3s;
}

.sidebar-user .btn-logout:hover {
    color: var(--danger-light);
}

/* ---- محتوای اصلی ---- */
.main-content {
    flex: 1;
    margin-right: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
    overflow-x: hidden;
    max-width: 100vw;
}

.top-bar {
    background: white;
    padding: 16px 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}

.top-bar .page-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

.top-bar .page-title i {
    margin-left: 8px;
    color: var(--accent);
}

.top-bar .date-display {
    font-size: 13px;
    color: var(--text-light);
}

.top-bar .date-display i {
    margin-left: 6px;
    color: var(--accent);
}

.content-area {
    padding: 24px 32px;
}

/* ---- کارت‌ها ---- */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: none;
    overflow: hidden;
    transition: all 0.3s;
    margin-bottom: 24px;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-header {
    background: white;
    border-bottom: 2px solid var(--bg);
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.card-header h5 {
    margin: 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
}

.card-header h5 i {
    margin-left: 8px;
    color: var(--accent);
}

.card-body {
    padding: 24px;
}

/* ---- کارت‌های آمار ---- */
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: all 0.3s;
    height: 100%;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
}

.stat-card.stat-primary::before { background: var(--accent); }
.stat-card.stat-success::before { background: var(--success); }
.stat-card.stat-warning::before { background: var(--warning); }
.stat-card.stat-danger::before { background: var(--danger); }

.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 16px;
}

.stat-card.stat-primary .stat-icon { background: rgba(14,165,233,0.12); color: var(--accent); }
.stat-card.stat-success .stat-icon { background: rgba(16,185,129,0.12); color: var(--success); }
.stat-card.stat-warning .stat-icon { background: rgba(245,158,11,0.12); color: var(--warning); }
.stat-card.stat-danger .stat-icon { background: rgba(239,68,68,0.12); color: var(--danger); }

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
}

.stat-card .stat-label {
    font-size: 13px;
    color: var(--text-light);
}

/* ---- جدول‌ها ---- */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
}

table thead th {
    background: var(--bg);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-light);
    text-align: right;
    white-space: nowrap;
    border-bottom: 2px solid var(--border);
}

table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr:hover {
    background: rgba(14,165,233,0.04);
}

table tbody tr:last-child td {
    border-bottom: none;
}

/* ---- بج‌ها ---- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
}

.badge-success { background: rgba(16,185,129,0.12); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.12); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.12); color: var(--danger); }
.badge-info { background: rgba(14,165,233,0.12); color: var(--accent); }
.badge-secondary { background: rgba(100,116,139,0.12); color: var(--text-light); }
.badge-primary { background: rgba(27,42,74,0.12); color: var(--primary); }

/* ---- دکمه‌ها ---- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    font-family: inherit;
    text-decoration: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-light), var(--accent));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-light));
    color: white;
}
.btn-accent:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(14,165,233,0.3);
}

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:hover {
    background: var(--success-light);
    transform: translateY(-1px);
}

.btn-warning {
    background: var(--warning);
    color: white;
}
.btn-warning:hover {
    background: var(--warning-light);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-danger:hover {
    background: var(--danger-light);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--border);
    color: var(--text);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(14,165,233,0.05);
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-lg {
    padding: 12px 28px;
    font-size: 15px;
}

/* ---- فرم‌ها ---- */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
    margin-right: 2px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    direction: rtl;
    transition: all 0.3s;
    background: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748B' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 12px center;
    padding-left: 32px;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

.form-text {
    font-size: 12px;
    color: var(--text-light);
    margin-top: 4px;
}

/* ---- فایل آپلود ---- */
.file-upload-area {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
    background: var(--bg);
}

.file-upload-area:hover {
    border-color: var(--accent);
    background: rgba(14,165,233,0.04);
}

.file-upload-area i {
    font-size: 36px;
    color: var(--accent);
    margin-bottom: 8px;
    display: block;
}

.file-upload-area p {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 4px;
}

.file-upload-area small {
    color: var(--text-light);
    opacity: 0.7;
}

.file-preview {
    margin-top: 12px;
    text-align: center;
}

.file-preview img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    border: 2px solid var(--border);
}

/* ---- هشدارها ---- */
.alert {
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

.alert i {
    font-size: 18px;
}

.alert-success {
    background: rgba(16,185,129,0.1);
    color: #065F46;
    border: 1px solid rgba(16,185,129,0.2);
}
.alert-success i { color: var(--success); }

.alert-danger {
    background: rgba(239,68,68,0.1);
    color: #991B1B;
    border: 1px solid rgba(239,68,68,0.2);
}
.alert-danger i { color: var(--danger); }

.alert-warning {
    background: rgba(245,158,11,0.1);
    color: #92400E;
    border: 1px solid rgba(245,158,11,0.2);
}
.alert-warning i { color: var(--warning); }

.alert-info {
    background: rgba(14,165,233,0.1);
    color: #0C4A6E;
    border: 1px solid rgba(14,165,233,0.2);
}
.alert-info i { color: var(--accent); }

/* ---- مدال ---- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.modal-box {
    background: white;
    border-radius: 16px;
    width: 500px;
    max-width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 50px rgba(0,0,0,0.25);
    animation: slideInRight 0.3s ease-out;
}

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

.modal-header h5 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-light);
    cursor: pointer;
    padding: 4px;
    transition: color 0.3s;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

/* ---- فاکتور ---- */
.invoice-container {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-width: 800px;
    margin: 0 auto;
    overflow: hidden;
}

.invoice-header {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    padding: 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invoice-header .company-info h2 {
    font-size: 20px;
    margin-bottom: 4px;
}

.invoice-header .company-info p {
    opacity: 0.8;
    font-size: 13px;
}

.invoice-header .invoice-meta {
    text-align: left;
}

.invoice-header .invoice-meta .invoice-number {
    font-size: 14px;
    opacity: 0.8;
}

.invoice-header .invoice-meta .invoice-date {
    font-size: 16px;
    font-weight: 600;
}

.invoice-body {
    padding: 32px;
}

.invoice-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.invoice-summary .summary-item {
    background: var(--bg);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
}

.invoice-summary .summary-item .label {
    font-size: 12px;
    color: var(--text-light);
    margin-bottom: 8px;
}

.invoice-summary .summary-item .value {
    font-size: 22px;
    font-weight: 800;
}

.invoice-summary .summary-item.income .value { color: var(--success); }
.invoice-summary .summary-item.expense .value { color: var(--danger); }
.invoice-summary .summary-item.profit .value { color: var(--accent); }

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.invoice-table th {
    background: var(--primary);
    color: white;
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    text-align: right;
}

.invoice-table td {
    padding: 10px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}

.invoice-table tr:nth-child(even) {
    background: rgba(14,165,233,0.03);
}

.invoice-total-row td {
    background: var(--bg);
    font-weight: 700;
    font-size: 14px;
    border-top: 2px solid var(--primary);
}

.invoice-footer {
    padding: 20px 32px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-light);
    font-size: 12px;
}

/* ---- بدهی کارت ---- */
.debt-card {
    background: white;
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-right: 4px solid;
    margin-bottom: 16px;
}

.debt-card.debt-owe {
    border-right-color: var(--danger);
}

.debt-card.debt-owed {
    border-right-color: var(--success);
}

.debt-card .debt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.debt-card .debt-amount {
    font-size: 20px;
    font-weight: 800;
}

.debt-card.debt-owe .debt-amount { color: var(--danger); }
.debt-card.debt-owed .debt-amount { color: var(--success); }

.debt-card .debt-description {
    font-size: 13px;
    color: var(--text-light);
}

/* ---- پروژه کارت ---- */
.project-card {
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: all 0.3s;
    height: 100%;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

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

.project-card .project-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}

.project-card .project-body {
    padding: 20px;
}

.project-card .project-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.project-card .project-stat {
    background: var(--bg);
    border-radius: 8px;
    padding: 12px;
    text-align: center;
}

.project-card .project-stat .value {
    font-size: 16px;
    font-weight: 700;
}

.project-card .project-stat .label {
    font-size: 11px;
    color: var(--text-light);
}

.project-card .project-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ---- صفحه خالی ---- */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 64px;
    color: var(--border);
    margin-bottom: 16px;
}

.empty-state h4 {
    color: var(--text-light);
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-light);
    opacity: 0.7;
    font-size: 13px;
}

/* ---- پاگینیشن ---- */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 24px;
}

.pagination a, .pagination span {
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    border: 1px solid var(--border);
    color: var(--text);
    transition: all 0.3s;
}

.pagination a:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination .active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* ---- توست ---- */
.toast-container {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 9999;
}

.toast {
    background: white;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 16px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 300px;
    animation: slideInLeft 0.4s ease-out;
    border-right: 4px solid;
}

.toast.toast-success { border-right-color: var(--success); }
.toast.toast-danger { border-right-color: var(--danger); }
.toast.toast-warning { border-right-color: var(--warning); }
.toast.toast-info { border-right-color: var(--accent); }

.toast i { font-size: 20px; }
.toast.toast-success i { color: var(--success); }
.toast.toast-danger i { color: var(--danger); }
.toast.toast-warning i { color: var(--warning); }
.toast.toast-info i { color: var(--accent); }

.toast .toast-message { flex: 1; font-size: 13px; }

/* ---- دکمه منوی موبایل ---- */
.mobile-menu-btn {
    display: none;
    background: var(--accent);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    font-size: 18px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin-left: 8px;
}

.mobile-menu-btn:hover {
    background: var(--primary);
}

/* ---- اورلی سایدبار ---- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.3s;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ---- ریسپانسیو ---- */

/* رویه کلی: هر عنصری که grid-template-columns دارد روی موبایل تک‌ستونه شود */
/* جدول‌ها همیشه داخل table-container با overflow-x:auto قرار می‌گیرند */
/* تصاویر و عناصر بلاکی از عرض بیشتر از صفحه جلوگیری می‌شود */

img, video, svg {
    max-width: 100%;
    height: auto;
}

.receipt-thumb {
    max-width: 48px;
    max-height: 48px;
    border-radius: 6px;
    cursor: pointer;
    object-fit: cover;
}

/* تبلت عمودی و کوچک */
@media (max-width: 1200px) {
    .content-area > [style*="grid-template-columns:repeat(5"] {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}

/* تبلت */
@media (max-width: 992px) {
    .mobile-menu-btn {
        display: flex;
    }

    .sidebar {
        transform: translateX(100%);
        box-shadow: -5px 0 25px rgba(0,0,0,0.3);
    }

    .sidebar.show {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
        max-width: 100vw;
    }

    .top-bar {
        padding: 12px 16px;
    }

    .top-bar .page-title {
        font-size: 15px;
    }

    .top-bar .date-display {
        font-size: 11px;
        display: none;
    }

    .content-area {
        padding: 16px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* همه گریدهای اینلاین داخل content-area ریسپانسیو شوند */
    .content-area > [style*="grid-template-columns:repeat(5"],
    .content-area > [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
    }

    .content-area > [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .content-area > [style*="grid-template-columns:repeat(2"] {
        grid-template-columns: 1fr !important;
    }

    .stat-card {
        padding: 16px;
    }

    .stat-card .stat-icon {
        width: 42px;
        height: 42px;
        font-size: 20px;
        margin-bottom: 10px;
    }

    .stat-card .stat-value {
        font-size: 20px;
    }

    .stat-card .stat-label {
        font-size: 11px;
    }

    .card-header {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .card-body {
        padding: 16px;
        overflow-x: hidden;
    }

    /* همه گریدهای داخل card-body */
    .card-body [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
    }

    .card-body [style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }

    .card-body [style*="grid-template-columns:1fr 1fr 1fr"] {
        grid-template-columns: 1fr 1fr !important;
    }

    .card-body [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* همه جداول داخل card-body اسکرول‌پذیر شوند */
    .card-body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-body table thead,
    .card-body table tbody {
        display: table;
        width: 100%;
        min-width: 500px;
    }

    /* فیلتر */
    .card-body form.d-flex,
    .card-body form[style*="display:flex"] {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .card-body form .form-group[style*="min-width"] {
        min-width: 100% !important;
    }

    /* هدر صفحات - دکمه‌ها زیر هم */
    .content-area > .d-flex.justify-between {
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }

    .content-area > .d-flex.justify-between .btn {
        text-align: center;
        justify-content: center;
    }

    /* هدر با دکمه بازگشت */
    .content-area > .d-flex.gap-16 {
        flex-wrap: wrap;
        gap: 8px !important;
    }

    /* فاکتور */
    .invoice-header {
        padding: 20px 16px;
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .invoice-header .invoice-meta {
        text-align: center;
    }

    .invoice-body {
        padding: 16px;
        overflow-x: hidden;
    }

    .invoice-summary {
        grid-template-columns: 1fr;
    }

    .invoice-summary .summary-item .value {
        font-size: 18px;
    }

    .invoice-table {
        display: block;
        width: 100%;
        overflow-x: auto;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 8px 10px;
        font-size: 11px;
    }

    .invoice-footer {
        padding: 12px 16px;
    }

    /* پروژه کارت‌ها */
    .project-card .project-header {
        flex-direction: column;
        gap: 8px;
    }

    .project-card .project-footer {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }

    .project-card .project-footer .d-flex {
        justify-content: center;
        flex-wrap: wrap;
    }

    /* بدهی کارت‌ها */
    .debt-card .debt-header {
        flex-direction: column;
        gap: 8px;
        align-items: flex-start;
    }

    /* لاگین */
    .login-card {
        padding: 32px 24px;
    }

    /* توست */
    .toast-container {
        top: 10px;
        left: 10px;
        right: 10px;
    }

    .toast {
        min-width: auto;
    }

    /* مدال */
    .modal-box {
        width: 95%;
        border-radius: 12px;
    }
}

/* گوشی موبایل */
@media (max-width: 576px) {
    body {
        font-size: 13px;
    }

    .mobile-menu-btn {
        display: flex;
    }

    .top-bar {
        padding: 10px 12px;
    }

    .top-bar .page-title {
        font-size: 14px;
    }

    .content-area {
        padding: 12px;
        max-width: 100vw;
        overflow-x: hidden;
    }

    /* همه گریدهای اینلاین داخل content-area */
    .content-area > [style*="grid-template-columns:repeat(5"],
    .content-area > [style*="grid-template-columns:repeat(4"],
    .content-area > [style*="grid-template-columns:repeat(3"],
    .content-area > [style*="grid-template-columns:repeat(2"],
    .content-area > [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .stat-card {
        padding: 14px;
        border-radius: 10px;
    }

    .stat-card .stat-icon {
        width: 38px;
        height: 38px;
        font-size: 18px;
        border-radius: 10px;
        margin-bottom: 8px;
    }

    .stat-card .stat-value {
        font-size: 18px;
    }

    .stat-card .stat-label {
        font-size: 10px;
    }

    .card {
        border-radius: 10px;
        margin-bottom: 16px;
    }

    .card-header {
        padding: 10px 14px;
    }

    .card-header h5 {
        font-size: 13px;
    }

    .card-body {
        padding: 12px;
        overflow-x: hidden;
    }

    /* همه گریدهای داخل card-body */
    .card-body [style*="grid-template-columns:repeat(4"],
    .card-body [style*="grid-template-columns:repeat(3"],
    .card-body [style*="grid-template-columns:repeat(2"],
    .card-body [style*="grid-template-columns:1fr 1fr 1fr"],
    .card-body [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    /* جداول - اسکرول افقی */
    .card-body table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .card-body table thead,
    .card-body table tbody {
        display: table;
        width: 100%;
        min-width: 480px;
    }

    table thead th {
        padding: 8px 10px;
        font-size: 11px;
    }

    table tbody td {
        padding: 8px 10px;
        font-size: 12px;
    }

    .form-control {
        font-size: 16px; /* جلوگیری از زوم خودکار iOS */
    }

    /* دکمه‌ها */
    .btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .btn-lg {
        padding: 10px 20px;
        font-size: 13px;
    }

    .btn-sm {
        padding: 4px 10px;
        font-size: 11px;
    }

    /* بج‌ها */
    .badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    /* فاکتور */
    .invoice-container {
        border-radius: 10px;
        margin: 0;
        max-width: 100%;
    }

    .invoice-header {
        padding: 16px;
    }

    .invoice-header .company-info h2 {
        font-size: 16px;
    }

    .invoice-body {
        padding: 12px;
    }

    .invoice-summary .summary-item {
        padding: 14px;
    }

    .invoice-summary .summary-item .value {
        font-size: 16px;
    }

    .invoice-table th,
    .invoice-table td {
        padding: 6px 8px;
        font-size: 10px;
    }

    .debt-card {
        padding: 14px;
    }

    .debt-card .debt-amount {
        font-size: 16px;
    }

    /* لاگین */
    .login-card {
        padding: 24px 20px;
        border-radius: 16px;
    }

    .login-card .login-logo i {
        font-size: 40px;
    }

    .login-card .login-logo h1 {
        font-size: 18px;
    }

    /* پروژه کارت */
    .project-card .project-title {
        font-size: 14px;
    }

    .project-card .project-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .project-card .project-stat .value {
        font-size: 14px;
    }

    /* صفحه خالی */
    .empty-state {
        padding: 30px 16px;
    }

    .empty-state i {
        font-size: 48px;
    }

    .empty-state h4 {
        font-size: 14px;
    }

    /* فایل آپلود */
    .file-upload-area {
        padding: 16px;
    }

    .file-upload-area i {
        font-size: 28px;
    }

    /* تأیید حذف */
    .confirm-box {
        padding: 24px;
    }

    .confirm-box i {
        font-size: 40px;
    }

    /* تب‌ها */
    .tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .tabs .tab {
        white-space: nowrap;
        padding: 8px 14px;
        font-size: 12px;
    }

    /* تصویر فاکتور */
    .receipt-thumb {
        width: 36px;
        height: 36px;
    }

    /* سایدبار */
    .sidebar-brand {
        padding: 16px 12px;
    }

    .sidebar-brand i {
        font-size: 28px;
    }

    .sidebar-brand h2 {
        font-size: 14px;
    }

    .sidebar-menu a {
        padding: 10px 16px;
    }

    .sidebar-user {
        padding: 12px 16px;
    }

    .sidebar-user .user-avatar {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .sidebar-user .user-info .name {
        font-size: 12px;
    }
}

/* موبایل بسیار کوچک */
@media (max-width: 360px) {
    .content-area > [style*="grid-template-columns:repeat(5"],
    .content-area > [style*="grid-template-columns:repeat(4"],
    .content-area > [style*="grid-template-columns:repeat(2"],
    .content-area > [style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }

    .stat-card .stat-value {
        font-size: 16px;
    }

    .stat-card .stat-icon {
        width: 34px;
        height: 34px;
        font-size: 16px;
    }

    .login-card {
        padding: 20px 16px;
    }
}

/* ---- چاپ ---- */
@media print {
    .sidebar, .top-bar, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-right: 0 !important;
    }
    .content-area {
        padding: 0 !important;
    }
    .card {
        box-shadow: none !important;
        border: 1px solid #ddd;
    }
    .invoice-container {
        box-shadow: none;
    }
}

/* ---- اسکرولبار ---- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* ---- ابزار کمکی ---- */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-accent { color: var(--accent) !important; }
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-light) !important; }
.fw-bold { font-weight: 700 !important; }
.fw-800 { font-weight: 800 !important; }
.fs-12 { font-size: 12px !important; }
.fs-13 { font-size: 13px !important; }
.fs-18 { font-size: 18px !important; }
.fs-24 { font-size: 24px !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px !important; }
.mb-16 { margin-bottom: 16px !important; }
.mb-24 { margin-bottom: 24px !important; }
.mt-16 { margin-top: 16px !important; }
.mt-24 { margin-top: 24px !important; }
.gap-8 { gap: 8px; }
.gap-16 { gap: 16px; }
.d-flex { display: flex !important; }
.align-center { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.flex-wrap { flex-wrap: wrap !important; }

/* ریسپانسیو d-flex - در موبایل wrap شود */
@media (max-width: 992px) {
    .content-area > .d-flex.justify-between {
        flex-wrap: wrap;
        flex-direction: column;
        gap: 12px;
        align-items: stretch !important;
    }
    .content-area > .d-flex.justify-between .btn {
        text-align: center;
        justify-content: center;
    }
    .content-area > .d-flex.gap-16 {
        flex-wrap: wrap;
        gap: 8px !important;
    }
    .card-body .d-flex.justify-between {
        flex-wrap: wrap;
        gap: 8px;
    }
}
.flex-wrap { flex-wrap: wrap !important; }
.w-100 { width: 100% !important; }
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }

/* ---- تأیید حذف ---- */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.confirm-box {
    background: white;
    border-radius: 16px;
    padding: 32px;
    width: 400px;
    max-width: 90%;
    text-align: center;
    animation: fadeIn 0.3s ease-out;
}

.confirm-box i {
    font-size: 48px;
    color: var(--warning);
    margin-bottom: 16px;
}

.confirm-box h4 {
    margin-bottom: 8px;
    color: var(--primary);
}

.confirm-box p {
    color: var(--text-light);
    font-size: 13px;
    margin-bottom: 24px;
}

.confirm-box .btn-group {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* ---- تب‌ها ---- */
.tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin-bottom: 24px;
}

.tabs .tab {
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.3s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tabs .tab:hover {
    color: var(--accent);
}

.tabs .tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ---- وضعیت پروژه ---- */
.status-active { color: var(--success); }
.status-completed { color: var(--accent); }
.status-cancelled { color: var(--danger); }
.status-suspended { color: var(--warning); }

/* ---- تصویر فاکتور ---- */
.receipt-thumb {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.3s;
}

.receipt-thumb:hover {
    transform: scale(1.5);
    z-index: 10;
    position: relative;
}

/* ---- lightbox ---- */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.85);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.lightbox img {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
