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

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: #f0f2f5;
  color: #0d1117;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .6rem 1.2rem;
  border-radius: 7px;
  font-family: inherit;
  font-size: .82rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn-primary   { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37,99,235,.3); }
.btn-success   { background: #16a34a; color: #fff; }
.btn-success:hover { background: #15803d; transform: translateY(-1px); }
.btn-danger    { background: #dc2626; color: #fff; }
.btn-danger:hover  { background: #b91c1c; transform: translateY(-1px); }
.btn-warning   { background: #d97706; color: #fff; }
.btn-warning:hover { background: #b45309; transform: translateY(-1px); }
.btn-outline   { background: #fff; color: #374151; border: 1.5px solid #d1d5db; }
.btn-outline:hover { border-color: #9ca3af; background: #f9fafb; }
.btn-ghost     { background: #f3f4f6; color: #6b7280; border: 1px solid #e5e7eb; }
.btn-ghost:hover   { background: #e5e7eb; color: #374151; }
.btn-sm        { padding: .38rem .75rem; font-size: .76rem; border-radius: 6px; }
.btn-block     { width: 100%; }
.btn:active    { transform: scale(.97); }

/* ── FORM ── */
.form-group { margin-bottom: 1rem; }
.form-group label {
  display: block;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #6b7280;
  margin-bottom: .4rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: .65rem .9rem;
  border: 1.5px solid #d1d5db;
  border-radius: 7px;
  font-family: inherit;
  font-size: .875rem;
  color: #0d1117;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.form-group input::placeholder { color: #9ca3af; }

/* ── ALERTS ── */
.alert {
  padding: .8rem 1rem;
  border-radius: 7px;
  font-size: .85rem;
  margin-bottom: 1rem;
  border: 1px solid;
  font-weight: 500;
}
.alert-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #bfdbfe; }
.alert-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: .22rem .65rem;
  border-radius: 99px;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  border: 1px solid;
}
.badge-success { background: #f0fdf4; color: #166534; border-color: #bbf7d0; }
.badge-danger  { background: #fef2f2; color: #991b1b; border-color: #fecaca; }
.badge-primary { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }
.badge-warning { background: #fffbeb; color: #92400e; border-color: #fde68a; }
.badge-gray    { background: #f9fafb; color: #6b7280; border-color: #e5e7eb; }

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

/* ── SIDEBAR ── */
.sidebar {
  width: 240px;
  background: #fff;
  border-right: 1px solid #e5e7eb;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 40;
}

.sidebar .brand {
  padding: 1.3rem 1.2rem 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.sidebar .brand-row {
  display: flex;
  align-items: center;
  gap: .7rem;
}

.sidebar .brand-icon {
  width: 34px; height: 34px;
  background: #2563eb;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  padding: 3px;
}

.sidebar .brand-icon img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.sidebar .brand h2 {
  font-size: .92rem;
  font-weight: 800;
  color: #0d1117;
  letter-spacing: -.02em;
}

.sidebar .brand h2 span { color: #2563eb; }

.sidebar .brand p {
  font-size: .68rem;
  color: #9ca3af;
  margin-top: .1rem;
}

.sidebar .nav-section { padding: .8rem 0; flex: 1; }

.sidebar .nav-label {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: #9ca3af;
  padding: .5rem 1.2rem .25rem;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem;
  margin: .06rem .6rem;
  border-radius: 7px;
  color: #6b7280;
  font-size: .845rem;
  font-weight: 500;
  transition: all .12s;
}

.sidebar nav a:hover { background: #f3f4f6; color: #0d1117; }

.sidebar nav a.active {
  background: #eff6ff;
  color: #1d4ed8;
  font-weight: 600;
}

.sidebar .sidebar-footer {
  padding: .9rem 1rem;
  border-top: 1px solid #f3f4f6;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .6rem .75rem;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.admin-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: #2563eb;
  display: flex; align-items: center; justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 1.8rem 2rem;
  min-height: 100vh;
}

/* ── TOPBAR ── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.6rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid #e5e7eb;
}

.topbar h1 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0d1117;
  letter-spacing: -.02em;
}

.topbar .sub { font-size: .78rem; color: #9ca3af; margin-top: .15rem; }

/* ── CARDS ── */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.card-header {
  padding: .9rem 1.3rem;
  border-bottom: 1px solid #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
}

.card-header h3 {
  font-size: .875rem;
  font-weight: 700;
  color: #0d1117;
}

.card-body { padding: 1.3rem; }

/* ── STAT CARDS ── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: .9rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
  transition: transform .18s, box-shadow .18s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.07); }



.stat-card .stat-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem;
  margin-bottom: .85rem;
  background: #eff6ff;
}
.stat-card.green  .stat-icon { background: #f0fdf4; }
.stat-card.red    .stat-icon { background: #fef2f2; }
.stat-card.amber  .stat-icon { background: #fffbeb; }
.stat-card.purple .stat-icon { background: #f5f3ff; }

.stat-card .label {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9ca3af;
  margin-bottom: .3rem;
}

.stat-card .value {
  font-size: 1.85rem;
  font-weight: 800;
  color: #0d1117;
  letter-spacing: -.04em;
  line-height: 1;
}

/* ── TABLE ── */
.table-wrapper { overflow-x: auto; }

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

th {
  background: #f9fafb;
  padding: .7rem 1rem;
  text-align: left;
  font-size: .66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #9ca3af;
  border-bottom: 1px solid #e5e7eb;
  white-space: nowrap;
}

td {
  padding: .85rem 1rem;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

td strong { color: #0d1117; }
tbody tr:hover td { background: #fafbff; }
tbody tr:last-child td { border-bottom: none; }

/* ── MODAL ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  backdrop-filter: blur(3px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-overlay.open { display: flex; }

.modal-box {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: popIn .2s cubic-bezier(.34,1.56,.64,1);
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.93); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-icon {
  width: 52px; height: 52px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto 1rem;
}

.modal-box h3 { font-size: 1rem; font-weight: 700; color: #0d1117; margin-bottom: .45rem; }
.modal-box p  { font-size: .85rem; color: #6b7280; margin-bottom: 1.4rem; line-height: 1.6; }
.modal-buttons { display: flex; gap: .6rem; justify-content: center; }

/* ── AUTH (admin login) ── */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: #f0f2f5;
}

.auth-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 2.5rem 2.2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 2px 16px rgba(0,0,0,.08);
}

.auth-logo {
  text-align: center;
  margin-bottom: 1.8rem;
}

.auth-logo .logo-mark {
  width: 52px; height: 52px;
  background: #2563eb;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  margin: 0 auto .8rem;
  overflow: hidden;
  padding: 5px;
}

.auth-logo .logo-mark img {
  width: 100%; height: 100%;
  object-fit: contain;
}

.auth-logo h1 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0d1117;
  letter-spacing: -.02em;
}

.auth-logo p { color: #6b7280; font-size: .85rem; margin-top: .25rem; }

/* ── UTILITY ── */
.text-center { text-align: center; }
.text-muted  { color: #6b7280; }
.text-sm     { font-size: .825rem; }
.fw-600      { font-weight: 600; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.divider { border: none; border-top: 1px solid #e5e7eb; margin: 1.2rem 0; }

code {
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 5px;
  padding: .15rem .45rem;
  font-size: .78rem;
  font-family: 'SF Mono','Fira Code',monospace;
  color: #2563eb;
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .main-content { margin-left: 0; padding: 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
}
