/* ================================================================
   NexPOS — Main CSS Design System
   ================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Cairo:wght@300;400;500;600;700;800&display=swap');
@import 'themes.css';

/* ── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-primary);
  background: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
  overflow: hidden;
  height: 100vh;
}

body[dir="rtl"] { font-family: var(--font-arabic); }

a { color: inherit; text-decoration: none; }
button { cursor: pointer; border: none; outline: none; font-family: inherit; }
input, select, textarea { font-family: inherit; outline: none; }
img { max-width: 100%; }
ul { list-style: none; }

/* ── Layout ───────────────────────────────────────────────────── */
#app { display: flex; height: 100vh; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────────────── */
.sidebar {
  width: 240px; min-width: 240px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  transition: width 0.3s ease, min-width 0.3s ease;
  position: relative; z-index: 100; overflow: hidden;
}

body[dir="rtl"] .sidebar { border-right: none; border-left: 1px solid var(--border-color); }

.sidebar.collapsed { width: 64px; min-width: 64px; }

.sidebar-logo {
  padding: 10px 14px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border-color);
  height: 64px; min-height: 64px; overflow: hidden;
}

.sidebar-logo .logo-hex {
  width: 36px; height: 36px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
}

.sidebar-logo .logo-hex svg { width: 20px; height: 20px; color: white; }

.sidebar-logo .logo-text {
  font-size: 1.3rem; font-weight: 800; white-space: nowrap;
  color: white; opacity: 1; transition: opacity 0.2s;
}

.sidebar.collapsed .logo-text { opacity: 0; pointer-events: none; }

.sidebar-nav {
  flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 0;
  scrollbar-width: thin; scrollbar-color: var(--border-color) transparent;
}

.nav-group { margin-bottom: 4px; }

.nav-group-label {
  font-size: 0.65rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
  padding: 10px 16px 4px; white-space: nowrap; overflow: hidden;
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-group-label { opacity: 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 8px; margin: 1px 8px;
  cursor: pointer; transition: background 0.15s, color 0.15s;
  white-space: nowrap; overflow: hidden; position: relative;
  color: var(--text-secondary); font-size: 0.85rem; font-weight: 500;
}

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

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

.nav-item.active::before {
  content: ''; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%); width: 3px; height: 60%;
  background: var(--primary); border-radius: 0 4px 4px 0;
}

body[dir="rtl"] .nav-item.active::before { left: auto; right: 0; border-radius: 4px 0 0 4px; }

.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-label { transition: opacity 0.2s; font-size: 0.82rem; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }

.nav-badge {
  margin-left: auto; background: var(--danger); color: white;
  font-size: 0.6rem; font-weight: 700; padding: 1px 5px;
  border-radius: 10px; min-width: 18px; text-align: center;
  transition: opacity 0.2s;
}

.sidebar.collapsed .nav-badge { opacity: 0; }

.nav-submenu { display: none; padding-left: 12px; }
.nav-submenu.open { display: block; }
.nav-submenu .nav-item { font-size: 0.78rem; padding: 7px 12px; }

.nav-arrow { margin-left: auto; width: 14px; height: 14px; transition: transform 0.2s, opacity 0.2s; flex-shrink: 0; }
.nav-item.open .nav-arrow { transform: rotate(90deg); }
.sidebar.collapsed .nav-arrow { opacity: 0; }

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

/* ── Top Bar ──────────────────────────────────────────────────── */
.topbar {
  height: 60px; min-height: 60px;
  background: var(--surface); border-bottom: 1px solid var(--border-color);
  display: flex; align-items: center; padding: 0 20px; gap: 12px;
  position: sticky; top: 0; z-index: 50;
}

.topbar-left { display: flex; align-items: center; gap: 12px; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-title { font-size: 1rem; font-weight: 600; color: var(--text-primary); }
.topbar-breadcrumb { font-size: 0.75rem; color: var(--text-muted); }

/* ── Main Content ─────────────────────────────────────────────── */
.main-wrapper { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-base); height: 100vh; }
.main-content { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 20px 80px; scrollbar-width: thin; scrollbar-color: var(--border-color) transparent; min-height: 0; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: 12px; padding: 20px; transition: box-shadow 0.2s;
}

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

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

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

/* ── Buttons ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 0.82rem; font-weight: 600;
  transition: all 0.15s ease; white-space: nowrap; font-family: inherit; cursor: pointer; border: none;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary { background: var(--primary); color: white; box-shadow: 0 2px 8px var(--primary-shadow); }
.btn-primary:hover { background: var(--primary-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary { background: var(--surface-2); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: var(--hover-bg); }

.btn-success { background: var(--success); color: white; box-shadow: 0 2px 8px rgba(16,185,129,0.3); }
.btn-success:hover { background: #059669; transform: translateY(-1px); }

.btn-danger { background: var(--danger); color: white; box-shadow: 0 2px 8px rgba(239,68,68,0.3); }
.btn-danger:hover { background: #dc2626; transform: translateY(-1px); }

.btn-warning { background: var(--warning); color: #1a1a1a; box-shadow: 0 2px 8px rgba(245,158,11,0.3); }
.btn-warning:hover { background: #d97706; }

.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid transparent; }
.btn-ghost:hover { background: var(--hover-bg); color: var(--text-primary); border-color: var(--border-color); }

.btn-icon { padding: 8px; border-radius: 8px; background: transparent; color: var(--text-secondary); transition: all 0.15s; }
.btn-icon:hover { background: var(--hover-bg); color: var(--text-primary); }
.btn-icon svg { width: 17px; height: 17px; }

.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.btn-sm svg { width: 13px; height: 13px; }
.btn-lg { padding: 12px 24px; font-size: 0.9rem; }
.btn-lg svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }

/* ── Form Elements ────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }

.form-label {
  display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.03em;
}

.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--input-bg); border: 1px solid var(--border-color);
  border-radius: 8px; color: var(--text-primary); font-size: 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s; font-family: inherit;
}

.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-alpha); }
.form-control::placeholder { color: var(--text-muted); }

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 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; padding-right: 30px;
}

body[dir="rtl"] select.form-control { background-position: left 10px center; padding-right: 12px; padding-left: 30px; }

.input-group { display: flex; align-items: stretch; }
.input-group .form-control { border-radius: 8px 0 0 8px; border-right: none; flex: 1; }
body[dir="rtl"] .input-group .form-control { border-radius: 0 8px 8px 0; border-right: 1px solid var(--border-color); border-left: none; }

.input-group-addon {
  padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--border-color);
  border-radius: 0 8px 8px 0; color: var(--text-secondary); font-size: 0.82rem; font-weight: 500; white-space: nowrap;
  display: flex; align-items: center;
}

body[dir="rtl"] .input-group-addon { border-radius: 8px 0 0 8px; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrapper { overflow-x: auto; border-radius: 10px; border: 1px solid var(--border-color); }

table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }

thead th {
  background: var(--surface-2); color: var(--text-secondary); font-weight: 600;
  font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em;
  padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border-color); white-space: nowrap;
}

body[dir="rtl"] thead th { text-align: right; }
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border-color); color: var(--text-primary); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--hover-bg); }

/* ── Badges ───────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 20px; font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-primary   { background: var(--primary-alpha); color: var(--primary); }
.badge-success   { background: rgba(16,185,129,0.15); color: #10b981; }
.badge-danger    { background: rgba(239,68,68,0.15);  color: #ef4444; }
.badge-warning   { background: rgba(245,158,11,0.15); color: #f59e0b; }
.badge-secondary { background: var(--surface-2); color: var(--text-secondary); }
.badge-info      { background: rgba(99,102,241,0.15); color: #6366f1; }

/* ── Stat Cards ───────────────────────────────────────────────── */
.stat-card {
  background: var(--surface); border: 1px solid var(--border-color); border-radius: 12px;
  padding: 18px 20px; display: flex; align-items: center; gap: 14px;
  position: relative; overflow: hidden; transition: transform 0.2s, box-shadow 0.2s;
}

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

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

body[dir="rtl"] .stat-card::after { right: auto; left: 0; }

.stat-card.primary::after { background: var(--primary); }
.stat-card.success::after { background: var(--success); }
.stat-card.warning::after { background: var(--warning); }
.stat-card.danger::after  { background: var(--danger); }
.stat-card.purple::after  { background: #8b5cf6; }

.stat-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.primary { background: var(--primary-alpha); color: var(--primary); }
.stat-icon.success { background: rgba(16,185,129,0.15); color: #10b981; }
.stat-icon.warning { background: rgba(245,158,11,0.15); color: #f59e0b; }
.stat-icon.danger  { background: rgba(239,68,68,0.15);  color: #ef4444; }
.stat-icon.purple  { background: rgba(139,92,246,0.15); color: #8b5cf6; }

.stat-info { flex: 1; min-width: 0; }
.stat-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text-primary); line-height: 1.2; }
.stat-change { font-size: 0.72rem; font-weight: 600; margin-top: 3px; display: flex; align-items: center; gap: 3px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }
.stat-change svg { width: 12px; height: 12px; }

/* ── Grid ─────────────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-6 { grid-template-columns: repeat(6, 1fr); }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}

.modal-overlay.open, .modal-overlay.active { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: 16px; width: 100%; max-width: 500px; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: scale(0.95) translateY(10px); transition: transform 0.2s;
  box-shadow: var(--shadow-xl);
}

.modal-overlay.open .modal, .modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1100px; }

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

.modal-title { font-size: 0.95rem; font-weight: 700; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; flex-shrink: 0; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs { display: flex; border-bottom: 2px solid var(--border-color); gap: 0; overflow-x: auto; scrollbar-width: none; }
.tab-item {
  padding: 10px 18px; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px;
  white-space: nowrap; transition: color 0.15s, border-color 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-item svg { width: 14px; height: 14px; }
.tab-content { display: none; padding-top: 16px; }
.tab-content.active { display: block; }

/* ── Search ───────────────────────────────────────────────────── */
.search-bar { position: relative; display: flex; align-items: center; }
.search-bar svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-muted); pointer-events: none; }
body[dir="rtl"] .search-bar svg { left: auto; right: 10px; }
.search-bar input { padding-left: 34px; }
body[dir="rtl"] .search-bar input { padding-left: 12px; padding-right: 34px; }

/* ── Toggle ───────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--border-color); border-radius: 22px; transition: 0.2s; }
.toggle-slider::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.3); }
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* ── Toast ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}

body[dir="rtl"] #toast-container { right: auto; left: 16px; }

.toast {
  background: var(--surface); border: 1px solid var(--border-color); border-radius: 10px;
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem; font-weight: 500; box-shadow: var(--shadow-lg); pointer-events: all;
  animation: toastIn 0.3s ease forwards; min-width: 260px; max-width: 360px;
}

.toast.exit { animation: toastOut 0.3s ease forwards; }
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { border-left: 4px solid var(--success); }
.toast.error   { border-left: 4px solid var(--danger); }
.toast.warning { border-left: 4px solid var(--warning); }
.toast.info    { border-left: 4px solid var(--primary); }

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

/* ── Spinner ──────────────────────────────────────────────────── */
.spinner { width: 32px; height: 32px; border: 3px solid var(--border-color); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-state p { font-size: 0.8rem; }

/* ── Divider ──────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border-color); margin: 16px 0; }

/* ── Flex Utilities ───────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.flex-1 { flex: 1; } .flex-wrap { flex-wrap: wrap; }

/* ── Spacing ──────────────────────────────────────────────────── */
.mb-1{margin-bottom:4px}.mb-2{margin-bottom:8px}.mb-3{margin-bottom:12px}.mb-4{margin-bottom:16px}.mb-5{margin-bottom:20px}
.mt-1{margin-top:4px}.mt-2{margin-top:8px}.mt-3{margin-top:12px}.mt-4{margin-top:16px}
.p-0{padding:0}

/* ── Text Utilities ───────────────────────────────────────────── */
.text-primary-color { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted   { color: var(--text-muted) !important; }
.text-sm { font-size: 0.75rem; }
.text-xs { font-size: 0.68rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-right  { text-align: right; }
.text-center { text-align: center; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Dropdown ─────────────────────────────────────────────────── */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  background: var(--surface); border: 1px solid var(--border-color);
  border-radius: 10px; box-shadow: var(--shadow-xl); min-width: 180px;
  z-index: 200; opacity: 0; pointer-events: none;
  transform: translateY(-8px); transition: opacity 0.15s, transform 0.15s; overflow: hidden;
}
body[dir="rtl"] .dropdown-menu { right: auto; left: 0; }
.dropdown.open .dropdown-menu { opacity: 1; pointer-events: all; transform: translateY(0); }
.dropdown-item { padding: 9px 14px; font-size: 0.82rem; color: var(--text-primary); cursor: pointer; display: flex; align-items: center; gap: 8px; transition: background 0.1s; }
.dropdown-item:hover { background: var(--hover-bg); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item svg { width: 14px; height: 14px; }
.dropdown-divider { height: 1px; background: var(--border-color); margin: 4px 0; }

/* ── Page Header ──────────────────────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header-left h1 { font-size: 1.2rem; font-weight: 800; color: var(--text-primary); margin-bottom: 2px; }
.page-header-left p { font-size: 0.78rem; color: var(--text-muted); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ── Toolbar ──────────────────────────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 8px; padding: 12px 16px; background: var(--surface-2); border-radius: 10px; margin-bottom: 16px; flex-wrap: wrap; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 16px; flex-wrap: wrap; }
.page-btn { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; font-size: 0.78rem; font-weight: 600; cursor: pointer; background: var(--surface); border: 1px solid var(--border-color); color: var(--text-secondary); transition: all 0.15s; }
.page-btn:hover { background: var(--hover-bg); color: var(--text-primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── Num Input ────────────────────────────────────────────────── */
.num-input-wrap { display: flex; align-items: center; border: 1px solid var(--border-color); border-radius: 8px; overflow: hidden; background: var(--input-bg); }
.num-input-wrap input { border: none; background: transparent; text-align: center; width: 60px; padding: 8px 4px; color: var(--text-primary); font-size: 0.85rem; font-weight: 600; }
.num-btn { padding: 8px 10px; background: var(--surface-2); color: var(--text-primary); font-size: 1rem; font-weight: 700; cursor: pointer; user-select: none; transition: background 0.1s; border: none; }
.num-btn:hover { background: var(--hover-bg); }

/* ── Status Dot ───────────────────────────────────────────────── */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.status-dot.active   { background: var(--success); box-shadow: 0 0 6px rgba(16,185,129,0.5); }
.status-dot.inactive { background: var(--text-muted); }
.status-dot.warning  { background: var(--warning); }
.status-dot.danger   { background: var(--danger); }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulse   { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
.animate-fade  { animation: fadeIn 0.3s ease; }
.animate-slide { animation: slideUp 0.3s ease; }
.animate-pulse { animation: pulse 1.5s ease infinite; }

/* ── Scrollbar ────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 1200px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-6 { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px)  { .sidebar { position: fixed; transform: translateX(-100%); z-index: 500; } .sidebar.open { transform: translateX(0); } .grid-2,.grid-3,.grid-4 { grid-template-columns: 1fr; } .main-content { padding: 12px; } }


/* ── Doc / Print Layout (used for A4 previews) ─────────────────── */
.doc-a4 {
  width: 210mm; min-height: 297mm; background: white; color: #111;
  padding: 16mm; margin: 0 auto;
  font-family: 'Inter', 'Cairo', sans-serif; font-size: 13px;
  box-shadow: 0 0 20px rgba(0,0,0,0.15);
}
.doc-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 24px; padding-bottom: 16px; border-bottom: 2px solid #0055CC; }
.doc-company-info h2 { font-size: 22px; font-weight: 800; color: #0055CC; }
.doc-title-block { text-align: right; }
.doc-title-block h1 { font-size: 28px; font-weight: 800; color: #111; margin-bottom: 4px; }
.doc-number { font-size: 14px; color: #0055CC; font-weight: 700; }
.doc-date { font-size: 12px; color: #888; }
.doc-parties { display: flex; gap: 20px; margin-bottom: 20px; }
.doc-party { flex: 1; background: #f8f9fc; border-radius: 8px; padding: 12px; }
.doc-party h3 { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: #888; margin-bottom: 6px; }
.doc-party p { font-weight: 600; }
.doc-party span { font-size: 12px; color: #666; }
.doc-table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 12px; }
.doc-table th { background: #0055CC; color: white; padding: 8px 10px; text-align: left; }
.doc-table td { padding: 7px 10px; border-bottom: 1px solid #eee; }
.doc-table tr:nth-child(even) td { background: #f8f9fc; }
.doc-table .total-row td { font-size: 15px; font-weight: 800; background: #f0f4ff; padding-top: 10px; border-top: 2px solid #0055CC; }
.doc-totals { display: flex; justify-content: flex-end; }
.doc-totals table { width: 240px; }
.doc-totals td { padding: 4px 8px; font-size: 13px; }
.doc-totals tr:last-child td { font-size: 16px; font-weight: 800; color: #0055CC; border-top: 2px solid #0055CC; padding-top: 8px; }
.doc-footer { display: flex; justify-content: space-between; align-items: flex-end; padding-top: 16px; border-top: 1px solid #eee; font-size: 11px; color: #888; }
.doc-footer-section h4 { color: #111; font-size: 12px; margin-bottom: 4px; }
.doc-signature { border-top: 1px solid #ccc; width: 120px; padding-top: 4px; text-align: center; font-size: 10px; color: #888; }

/* ── Invoice Designer Scrollable Controls ─────────────────────── */
.inv-designer-controls-col {
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  scroll-behavior: smooth;
}
.inv-designer-controls-col::-webkit-scrollbar {
  width: 6px;
}
.inv-designer-controls-col::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 6px;
}
.inv-designer-controls-col::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}
body[dir="rtl"] .inv-designer-controls-col {
  padding-right: 0 !important;
  padding-left: 10px !important;
}

