/* ============ NOIR ADMIN - SHARED.CSS ============ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --bg: #0a0a0f;
  --bg2: #111118;
  --card: #1a1a24;
  --border: #2a2a3a;
  --text: #e2e2e8;
  --text2: #9898a8;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-light: rgba(139,92,246,0.15);
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --sidebar-w: 240px;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --transition: 0.2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: var(--primary); text-decoration: none; }
ul { list-style: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg2); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text2); }

/* ============ LAYOUT ============ */
.admin-wrapper { display: flex; min-height: 100vh; }

/* ---- SIDEBAR ---- */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 50;
  overflow-y: auto;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  font-size: 20px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-logo span { color: var(--primary); }
.sidebar-logo-sub { font-size: 10px; font-weight: 400; color: var(--text2); text-transform: uppercase; letter-spacing: 0.1em; margin-left: auto; }
.sidebar-nav { padding: 12px 8px; flex: 1; }
.sidebar-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text2); padding: 8px 12px 4px; margin-top: 8px; }
.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: var(--text2);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  text-decoration: none;
}
.sidebar-link:hover { background: rgba(139,92,246,0.08); color: var(--text); }
.sidebar-link.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.sidebar-link .icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.sidebar-link .badge-count {
  margin-left: auto;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}
.sidebar-footer {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
}

/* ---- MAIN CONTENT ---- */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(10,10,15,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.page-title { font-size: 16px; font-weight: 600; }
.admin-content { padding: 24px; flex: 1; }

/* ============ STAT CARDS ============ */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: var(--accent, var(--primary));
}
.stat-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text2); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1; margin-bottom: 6px; }
.stat-change { font-size: 12px; color: var(--text2); }
.stat-icon { position: absolute; top: 20px; right: 20px; font-size: 28px; opacity: 0.3; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1px solid transparent; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: all var(--transition); white-space: nowrap; text-decoration: none; line-height: 1;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--card); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #dc2626; color: #fff; }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover:not(:disabled) { background: #16a34a; color: #fff; }
.btn-ghost { background: transparent; color: var(--text2); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--card); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }
.btn-warning { background: var(--warning); color: #000; border-color: var(--warning); }
.btn-warning:hover:not(:disabled) { background: #d97706; }

/* ============ CARDS ============ */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 600; margin: 0; }
.card-body { padding: 20px; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); }

/* ============ TABLES ============ */
.table-wrapper { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  padding: 9px 14px; text-align: left; font-weight: 600; color: var(--text2);
  text-transform: uppercase; font-size: 11px; letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: rgba(0,0,0,0.2);
}
.table td { padding: 11px 14px; border-bottom: 1px solid rgba(42,42,58,0.5); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255,255,255,0.02); }
.table tbody tr:last-child td { border-bottom: none; }
.table .actions { display: flex; gap: 6px; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--text2); margin-bottom: 5px; }
.form-control {
  width: 100%; padding: 9px 12px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); font-size: 13px; transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.form-control::placeholder { color: var(--text2); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.form-hint { font-size: 11px; color: var(--text2); margin-top: 3px; }
.form-error { font-size: 11px; color: var(--danger); margin-top: 3px; }

/* ============ BADGES ============ */
.badge {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: 20px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,0.15); color: var(--info); }
.badge-neutral { background: rgba(152,152,168,0.15); color: var(--text2); }

/* ============ MODAL ============ */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px); z-index: 1000; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }
.modal-header { padding: 18px 22px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text2); font-size: 18px; cursor: pointer; padding: 2px; line-height: 1; transition: color var(--transition); }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

/* ============ TOAST ============ */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--card);
  color: var(--text); font-size: 13px; min-width: 260px; max-width: 380px;
  box-shadow: var(--shadow); animation: toastIn 0.3s ease;
}
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }
.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--info); }

/* ============ FILTERS BAR ============ */
.filters-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-bar .form-control { width: auto; }
.search-input { min-width: 220px; }

/* ============ PAGINATION ============ */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; margin-top: 20px; }
.page-btn {
  width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
  color: var(--text2); font-size: 12px; cursor: pointer; transition: all var(--transition);
}
.page-btn:hover, .page-btn.active { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ============ LOADING ============ */
.spinner { width: 18px; height: 18px; border: 2px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-overlay { display: flex; align-items: center; justify-content: center; padding: 48px; }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text2); }
.empty-state-icon { font-size: 40px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

/* ============ UTILITIES ============ */
.text-primary { color: var(--primary); } .text-success { color: var(--success); } .text-danger { color: var(--danger); } .text-warning { color: var(--warning); } .text-muted { color: var(--text2); }
.text-center { text-align: center; } .text-right { text-align: right; }
.text-sm { font-size: 12px; } .text-lg { font-size: 16px; }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.d-flex { display: flex; } .align-center { align-items: center; } .justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .flex-1 { flex: 1; } .flex-col { flex-direction: column; } .gap-4 { gap: 4px; } .gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-4{margin-top:4px}.mt-8{margin-top:8px}.mt-12{margin-top:12px}.mt-16{margin-top:16px}.mt-20{margin-top:20px}.mt-24{margin-top:24px}
.mb-4{margin-bottom:4px}.mb-8{margin-bottom:8px}.mb-12{margin-bottom:12px}.mb-16{margin-bottom:16px}.mb-20{margin-bottom:20px}.mb-24{margin-bottom:24px}
.w-100 { width: 100%; } .divider { height: 1px; background: var(--border); margin: 16px 0; } .cursor-pointer { cursor: pointer; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ============ ACTIVE NAV ============ */
.sidebar-link[data-page].active { background: var(--primary-light); color: var(--primary); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1024px) { .stat-cards { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
}

/* ============ ADMIN MOBILE ============ */
.mobile-menu-btn { display: none; background: none; border: none; color: var(--text); font-size: 24px; cursor: pointer; padding: 4px; }
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 49; }
.sidebar-overlay.active { display: block; }

@media (max-width: 768px) {
  .admin-sidebar { width: 260px; z-index: 50; }
  .admin-main { margin-left: 0; width: 100%; }
  .admin-topbar { padding: 0 12px; gap: 8px; }
  .admin-topbar .page-title { font-size: 16px; }
  .admin-content { padding: 16px 12px; }
  .mobile-menu-btn { display: block; }
  .stat-cards { grid-template-columns: 1fr 1fr; gap: 12px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .grid-2 { grid-template-columns: 1fr; }
  .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .filters-bar { flex-direction: column; gap: 8px; }
  .filters-bar .form-control { width: 100% !important; }
  .filters-bar .search-input { width: 100% !important; }
  .modal { max-width: 100%; margin: 0; border-radius: 12px 12px 0 0; }
  .modal-xl { max-width: 100%; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .admin-topbar { flex-wrap: wrap; }
}
