/* ── Variables ────────────────────────────────────────────────────────────── */
:root {
  --primary:      #f1a341;
  --primary-dark: #d8892a;
  --secondary:    #40372c;
  --sidebar-bg:   #40372c;
  --sidebar-txt:  #e8ddd0;
  --sidebar-w:    250px;
  --topbar-h:     60px;
  --bg:           #f4f6f9;
  --card-bg:      #ffffff;
  --text:         #2d2d2d;
  --text-muted:   #7a7a7a;
  --border:       #e4e4e4;
  --danger:       #dc3545;
  --success:      #28a745;
  --warning:      #ffc107;
  --info:         #17a2b8;
  --radius:       8px;
  --shadow:       0 2px 8px rgba(0,0,0,.08);
}

/* ── Reset ────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Segoe UI', Tahoma, Arial, sans-serif; background: var(--bg); color: var(--text); direction: rtl; }
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; }

/* ── Auth Layout ──────────────────────────────────────────────────────────── */
.auth-page { display: flex; align-items: center; justify-content: center; min-height: 100vh;
             background: linear-gradient(135deg, var(--secondary) 0%, #2a2218 100%); }
.auth-wrapper { width: 100%; max-width: 420px; padding: 20px; }
.auth-card { background: var(--card-bg); border-radius: 12px; padding: 36px 32px; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.auth-logo { text-align: center; margin-bottom: 28px; }
.auth-logo h1 { font-size: 1.5rem; color: var(--secondary); margin-top: 10px; }
.auth-logo p  { color: var(--text-muted); font-size: .875rem; }

/* ── Dashboard Layout ────────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-txt);
  position: fixed; top: 0; right: 0; bottom: 0;
  display: flex; flex-direction: column;
  overflow-y: auto; z-index: 100;
  transition: width .25s;
}
.sidebar-logo {
  padding: 18px 20px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.sidebar-logo span { font-size: 1.1rem; font-weight: 700; color: var(--primary); }
.sidebar-menu { list-style: none; padding: 12px 0; flex: 1; }
.sidebar-menu li a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 20px; color: var(--sidebar-txt);
  font-size: .9rem; border-right: 3px solid transparent;
  transition: background .2s, border-color .2s;
}
.sidebar-menu li a:hover,
.sidebar-menu li.active a {
  background: rgba(255,255,255,.08);
  border-right-color: var(--primary);
  color: #fff;
}
.sidebar-menu .menu-section {
  padding: 16px 20px 6px;
  font-size: .72rem; color: rgba(255,255,255,.4);
  text-transform: uppercase; letter-spacing: .08em;
}
.sidebar-bottom { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-bottom a { color: rgba(255,255,255,.6); font-size: .875rem; }

.main-wrapper { margin-right: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }

.topbar {
  height: var(--topbar-h); background: var(--card-bg); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; position: sticky; top: 0; z-index: 50;
}
.topbar-left  { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.breadcrumb   { font-size: .875rem; color: var(--text-muted); }
.user-badge   { display: flex; align-items: center; gap: 8px; font-size: .875rem; }
.user-avatar  { width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
                display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 700; }

.page-content { padding: 24px; flex: 1; }
.page-header  { margin-bottom: 24px; display: flex; justify-content: space-between; align-items: center; }
.page-title   { font-size: 1.4rem; font-weight: 700; color: var(--secondary); }
.page-subtitle { color: var(--text-muted); font-size: .875rem; margin-top: 3px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 24px; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.card-title  { font-size: 1rem; font-weight: 600; }
.card-body   { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); }

/* ── Stat Cards ──────────────────────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 24px; }
.stat-card  { background: var(--card-bg); border-radius: var(--radius); padding: 20px;
              box-shadow: var(--shadow); display: flex; align-items: center; gap: 16px; }
.stat-icon  { width: 52px; height: 52px; border-radius: 10px;
              display: flex; align-items: center; justify-content: center; font-size: 1.4rem; }
.stat-icon.orange { background: #fff4e6; }
.stat-icon.brown  { background: #f0ede9; }
.stat-icon.green  { background: #e8f8ee; }
.stat-icon.blue   { background: #e8f4fd; }
.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--text-muted); font-size: .82rem; margin-top: 4px; }
.stat-change { font-size: .78rem; color: var(--success); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group  { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 6px; font-size: .875rem; font-weight: 500; }
.form-row    { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border);
  border-radius: 6px; font-size: .9rem; font-family: inherit;
  background: #fafafa; color: var(--text); transition: border-color .2s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); background: #fff; }
textarea { resize: vertical; min-height: 90px; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7a7a'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center; padding-left: 32px; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 18px;
       border-radius: 6px; font-size: .9rem; font-weight: 500; border: none;
       cursor: pointer; transition: opacity .15s, transform .1s; }
.btn:hover   { opacity: .88; transform: translateY(-1px); }
.btn:active  { transform: translateY(0); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-sm      { padding: 5px 12px; font-size: .82rem; }
.btn-block   { width: 100%; justify-content: center; margin-top: 6px; padding: 11px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
thead tr { background: #f9f9f9; }
th, td { padding: 11px 14px; text-align: right; border-bottom: 1px solid var(--border); }
th { font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:hover { background: #fdf9f5; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: .75rem; font-weight: 600; }
.badge-success { background: #e8f8ee; color: var(--success); }
.badge-danger  { background: #fdecea; color: var(--danger); }
.badge-warning { background: #fff8e1; color: #b8870a; }
.badge-info    { background: #e4f6f9; color: var(--info); }
.badge-grey    { background: #f0f0f0; color: #777; }
.badge-orange  { background: #fff4e6; color: var(--primary-dark); }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 11px 16px; border-radius: 6px; margin-bottom: 16px; font-size: .875rem; }
.alert-danger  { background: #fdecea; color: #c82333; border: 1px solid #f5c6cb; }
.alert-success { background: #e8f8ee; color: #1e7e34; border: 1px solid #c3e6cb; }
.alert-info    { background: #e4f6f9; color: #0c6177; border: 1px solid #bee5eb; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; list-style: none; justify-content: center; margin-top: 20px; }
.pagination li a, .pagination li span {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 6px;
  font-size: .875rem; color: var(--text);
}
.pagination li.active span { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: var(--sidebar-w); }
  .main-wrapper { margin-right: 0; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
