﻿:root {
  --primary: #0369a1;
  --primary-light: #0284c7;
  --primary-dark: #001f1b;
  --accent: #c8a35d;
  --accent-light: #dfc28a;
  --danger: #ce2b37;
  --success: #198754;
  --info: #0d6efd;
  --warning: #ffc107;
  --bg: #f0f4f8;
  --bg-card: #ffffff;
  --text: #1a2332;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,45,39,0.06);
  --shadow: 0 4px 16px rgba(0,45,39,0.08);
  --shadow-lg: 0 8px 32px rgba(0,45,39,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 20px;
  --sidebar-width: 270px;
  --topbar-height: 72px;
}

* { box-sizing: border-box; }

body {
  font-family: 'Cairo', sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding-top: var(--topbar-height);
  overflow-x: hidden;
  min-height: 100vh;
}

/* ========== TOPBAR ========== */
.topbar {
  height: var(--topbar-height);
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  border-bottom: 3px solid var(--accent);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1040;
  transition: box-shadow .3s;
}
.topbar.scrolled { box-shadow: 0 4px 30px rgba(0,0,0,.25); }
.topbar .logo {
  width: 48px; height: 48px;
  border-radius: 12px;
  object-fit: contain;
  background: rgba(255,255,255,.1);
  padding: 4px;
  border: 1px solid rgba(200,163,93,.3);
}
.brand-title { font-size: 1.35rem; font-weight: 800; color: #fff; letter-spacing: -.3px; line-height: 1.2; }
.brand-subtitle { font-size: .72rem; color: rgba(255,255,255,.6); }
.user-chip {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  padding: .45rem 1rem .45rem .45rem;
  border-radius: 100px;
  color: #fff!important;
  font-weight: 600;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background .2s;
  text-decoration: none;
}
.user-chip:hover { background: rgba(255,255,255,.15); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
}
.icon-pill {
  width: 40px; height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.1);
  color: #fff;
  text-decoration: none;
  position: relative;
  transition: all .2s;
  border: 1px solid rgba(255,255,255,.08);
}
.icon-pill:hover { background: rgba(255,255,255,.18); color: #fff; transform: translateY(-1px); }
.badge-notify {
  position: absolute;
  top: -6px; left: -6px;
  background: var(--danger);
  font-size: .6rem;
  min-width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50px;
  border: 2px solid var(--primary);
  animation: pulse-badge 2s infinite;
}
@keyframes pulse-badge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
.user-dropdown {
  background: #fff;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 8px;
  min-width: 200px;
}
.user-dropdown .dropdown-item {
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  color: var(--text);
  transition: all .15s;
}
.user-dropdown .dropdown-item:hover { background: var(--bg); color: var(--primary); }
.user-dropdown .dropdown-item i { width: 20px; color: var(--text-muted); }
.user-dropdown .dropdown-divider { margin: 6px 0; }

/* ========== SIDEBAR ========== */
.sidebar {
  position: fixed;
  top: var(--topbar-height);
  right: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--topbar-height));
  background: #fff;
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 20px rgba(0,0,0,.04);
  padding: 20px 14px;
  z-index: 1030;
  overflow-y: auto;
  transition: transform .3s ease;
}
.sidebar-brand {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 0 16px;
  margin-bottom: 16px;
  display: block;
}
.side-link {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: .92rem;
  transition: all .2s;
  text-align: right;
  cursor: pointer;
  position: relative;
}
.side-link i {
  font-size: 1.15rem;
  color: var(--text-muted);
  width: 22px;
  text-align: center;
  transition: color .2s;
}
.side-link:hover {
  background: rgba(0,45,39,.06);
  color: var(--primary);
}
.side-link:hover i { color: var(--primary); }
.side-link.active {
  background: linear-gradient(135deg, rgba(0,45,39,.1), rgba(0,45,39,.04));
  color: var(--primary);
  font-weight: 700;
}
.side-link.active i { color: var(--primary); }
.side-link.active::before {
  content: '';
  position: absolute;
  right: -14px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}
.side-link .badge {
  margin-right: auto;
  font-size: .7rem;
}
.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 16px;
}

/* ========== MAIN CONTENT ========== */
.main-content {
  margin-right: var(--sidebar-width);
  padding: 24px 28px 40px;
  min-height: calc(100vh - var(--topbar-height));
  transition: margin .3s;
}

/* ========== SECTION HEADERS ========== */
.section-title {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--text);
}
.section-subtitle {
  font-size: .85rem;
  color: var(--text-muted);
}

/* ========== STAT CARDS ========== */
.stat-card {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all .3s;
  cursor: default;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}
.stat-card .card-body { padding: 1.5rem; }
.stat-card .icon-box {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  color: #fff;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.1;
  margin: 4px 0 0;
}
.stat-card .stat-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: .85rem;
}
.stat-card .stat-icon-bg {
  position: absolute;
  left: -20px;
  bottom: -20px;
  font-size: 6rem;
  opacity: .04;
  color: inherit;
}
.stat-card.accent-green { border-top: 4px solid var(--primary); }
.stat-card.accent-gold { border-top: 4px solid var(--accent); }
.stat-card.accent-blue { border-top: 4px solid var(--info); }
.stat-card.accent-red { border-top: 4px solid var(--danger); }

/* ========== CARDS ========== */
.card-modern {
  border: none;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: all .3s;
}
.card-modern:hover { box-shadow: var(--shadow-lg); }
.card-modern .card-header-modern {
  background: transparent;
  border-bottom: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  font-weight: 700;
}

/* ========== TABLES ========== */
.table-modern {
  margin-bottom: 0;
}
.table-modern thead th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 14px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.table-modern tbody td {
  padding: 14px 16px;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}
.table-modern tbody tr {
  transition: background .15s;
}
.table-modern tbody tr:hover { background: rgba(0,45,39,.02); }
.table-modern tbody tr:last-child td { border-bottom: none; }

/* ========== BADGES ========== */
.badge-modern {
  font-weight: 700;
  padding: 5px 14px;
  border-radius: 100px;
  font-size: .78rem;
}

/* ========== BUTTONS ========== */
.btn-primary-modern {
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 10px 24px;
  border-radius: var(--radius-sm);
  transition: all .2s;
}
.btn-primary-modern:hover {
  background: var(--primary-light);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,45,39,.25);
}
.btn-outline-modern {
  background: transparent;
  border: 2px solid var(--primary);
  color: var(--primary);
  font-weight: 700;
  padding: 9px 22px;
  border-radius: var(--radius-sm);
  transition: all .2s;
}
.btn-outline-modern:hover {
  background: var(--primary);
  color: #fff;
}
.btn-icon-modern {
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  transition: all .15s;
}
.action-group {
  display: flex;
  gap: 4px;
  justify-content: center;
}

/* ========== FORMS ========== */
.form-control-modern {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-weight: 600;
  transition: all .2s;
}
.form-control-modern:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,45,39,.1);
}

/* ========== LOGIN PAGE ========== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--primary-light) 100%);
  position: relative;
  overflow: hidden;
  padding-top: 0;
}
.login-page::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(200,163,93,.08) 0%, transparent 70%);
  pointer-events: none;
}
.login-page::after {
  content: '';
  position: absolute;
  bottom: -30%;
  left: -30%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle, rgba(255,255,255,.03) 0%, transparent 70%);
  pointer-events: none;
}
.login-card {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
  animation: login-fade-in .6s ease;
}
@keyframes login-fade-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.login-card .card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}
.login-card .card-body {
  padding: 2.5rem 2rem;
}
.login-card .logo-wrap {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  background: var(--primary);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  box-shadow: 0 8px 24px rgba(0,45,39,.2);
}
.login-card .logo-wrap img { width: 100%; height: 100%; object-fit: contain; }
.login-title { font-size: 1.6rem; font-weight: 800; color: var(--text); }
.login-subtitle { color: var(--text-muted); font-size: .9rem; }
.login-card .form-control {
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-weight: 600;
  transition: all .2s;
}
.login-card .form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(0,45,39,.1);
}
.login-card .form-label { font-weight: 700; color: var(--text); font-size: .85rem; }
.login-card .btn-login {
  background: var(--primary);
  border: none;
  color: #fff;
  font-weight: 800;
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: all .2s;
  font-size: 1rem;
}
.login-card .btn-login:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,45,39,.3);
}
.login-card .test-creds {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  border: 1px solid var(--border);
  font-size: .82rem;
}
.login-card .test-creds strong { color: var(--primary); }
.login-page footer { display: none !important; }

/* ========== TOOLBAR ========== */
.toolbar-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  padding: 20px 24px;
  margin-bottom: 24px;
}

/* ========== CHARTS ========== */
.chart-box { height: 320px; }
.chart-sm { height: 260px; }
.chart-box canvas, .chart-sm canvas { cursor: pointer; }

/* ========== FILTER ROW ========== */
.filter-row {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin: 0;
}
.filter-row .form-select,
.filter-row .form-control {
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: .85rem;
}

/* ========== TOOLBAR FILTERS ========== */
.toolbar-card .form-select {
  font-size: .85rem;
  font-weight: 600;
  min-width: 0;
  text-overflow: clip;
  white-space: normal;
  padding-right: 12px;
  padding-left: 32px;
}
.toolbar-card .form-select option,
.filter-row .form-select option {
  white-space: normal;
  padding: 4px 8px;
}
.filter-row .form-select.form-select-sm {
  font-size: .8rem;
  padding-right: 8px;
  padding-left: 24px;
}

/* ========== MODALS ========== */
.modal-modern .modal-content {
  border: none;
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.modal-modern .modal-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff;
  border: none;
  padding: 1.25rem 1.5rem;
}
.modal-modern .modal-header .btn-close { filter: invert(1) brightness(2); }
.modal-modern .modal-body { padding: 1.5rem; }
.modal-modern .modal-footer { border-top: 1px solid var(--border); padding: 1rem 1.5rem; }
.modal-modern .form-label { font-weight: 700; font-size: .85rem; color: var(--text); }

/* ========== NOTIFICATIONS ========== */
.notif-item {
  border: none!important;
  border-radius: var(--radius-sm)!important;
  margin-bottom: 8px;
  transition: all .2s;
  padding: 1rem 1.25rem;
}
.notif-item:hover { transform: translateX(-4px); }
.notif-item.unread {
  background: rgba(0,45,39,.04);
  border-right: 4px solid var(--primary)!important;
}
.notif-item .notif-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-block;
  margin-left: 8px;
}

/* ========== VIEW COMPLAINT ========== */
.detail-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 2px;
}
.detail-value {
  font-weight: 700;
  color: var(--text);
  font-size: .95rem;
}
.detail-box {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  border: 1px solid var(--border);
  margin-top: 4px;
}

/* ========== PROGRESS BARS ========== */
.progress-modern {
  height: 38px;
  border-radius: 100px;
  position: relative;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
}
.progress-modern .progress-bar-inner {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: auto;
  border-radius: 100px;
  transition: width .6s ease;
}
.progress-modern .progress-text {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  display: flex;
  align-items: center;
  padding: 0 18px;
  font-size: .88rem;
  font-weight: 700;
  z-index: 2;
  pointer-events: none;
  gap: 8px;
  direction: rtl;
}
.progress-modern .progress-text .pct-value {
  margin-right: auto;
  opacity: .85;
  font-size: .8rem;
}
.progress-link {
  display: block;
  text-decoration: none;
  margin-bottom: 12px;
  border-radius: 100px;
  transition: all .2s;
}
.progress-link:hover {
  box-shadow: 0 4px 16px rgba(0,45,39,.15);
  transform: translateY(-1px);
}
.progress-link:last-child { margin-bottom: 0; }

/* ========== RESPONSIVE ========== */
@media (max-width: 991.98px) {
  body { padding-top: 64px; }
  :root { --topbar-height: 64px; --sidebar-width: 0px; }
  .brand-title { font-size: 1rem; }
  .brand-subtitle { display: none; }
  .topbar .logo { width: 38px; height: 38px; }
  .sidebar {
    transform: translateX(var(--sidebar-width));
    width: 280px;
    --sidebar-width: 280px;
  }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-right: 0; padding: 16px; }
  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1029;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
  .stat-card .stat-value { font-size: 1.6rem; }
  .chart-box { height: 240px; }
  .chart-sm { height: 200px; }
  .login-card { padding: 0 16px; }
}

@media (max-width: 575.98px) {
  .main-content { padding: 12px; }
  .toolbar-card { padding: 14px; }
  .stat-card .card-body { padding: 1.1rem; }
  .table-modern thead th { font-size: .72rem; padding: 10px 10px; }
  .table-modern tbody td { padding: 10px 10px; font-size: .85rem; }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ========== UTILITIES ========== */
.text-primary-modern { color: var(--primary) !important; }
.bg-primary-modern { background: var(--primary) !important; }
.border-accent { border-color: var(--accent) !important; }
.gradient-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
}
.shadow-hover { transition: box-shadow .3s; }
.shadow-hover:hover { box-shadow: var(--shadow-lg); }
.transition-all { transition: all .2s; }
.cursor-pointer { cursor: pointer; }

/* ========== BULK ACTIONS BAR ========== */
.bulk-actions-bar {
  background: #fff;
  border-top: 2px solid var(--accent);
  border-radius: 0 0 var(--radius) var(--radius);
  animation: slideUp .3s ease;
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.bulk-actions-bar .btn { font-weight: 700; font-size: .85rem; padding: 8px 18px; }
.bulk-actions-bar #selectedCount {
  font-size: 1.2rem;
  color: var(--primary);
}
.bulk-actions-bar .form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}


