/* =========================================================
   KANGA PEPS — Admin Panel Styles
   Clean light dashboard with brand orange accents.
   ========================================================= */

:root {
  --brand:        #de6c13;
  --brand-bright: #f4933f;
  --brand-dark:   #b85a0d;
  --purple:       #4b2480;
  --bg:           #f5f6fa;
  --panel:        #ffffff;
  --border:       #e6e8ef;
  --text:         #1a1530;
  --text-mute:    #6b7390;
  --text-soft:    #9ca3b8;
  --success:      #10b981;
  --warning:      #f59e0b;
  --danger:       #ef4444;
  --info:         #3b82f6;
  --shadow:       0 1px 3px rgba(20,15,40,0.05), 0 4px 16px rgba(20,15,40,0.04);
  --radius:       12px;
  --radius-sm:    8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'DM Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-bright); }

/* =========================================================
   LAYOUT
========================================================= */

.admin-shell {
  min-height: 100vh;
  display: flex;
}

.admin-sidebar {
  width: 260px;
  background: #14102a;
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  padding: 22px 16px;
  overflow-y: auto;
  z-index: 20;
}

.admin-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  margin-bottom: 18px;
}
.admin-sidebar .brand img { height: 38px; width: 38px; object-fit: contain; }
.admin-sidebar .brand .name {
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}
.admin-sidebar .brand .name span { color: var(--brand); }

.admin-sidebar .nav-section {
  color: rgba(255,255,255,0.35);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
  padding: 16px 10px 8px;
}

.admin-sidebar a.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  color: rgba(255,255,255,0.7);
  border-radius: 9px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
}
.admin-sidebar a.nav-link:hover {
  background: rgba(255,255,255,0.05);
  color: #fff;
}
.admin-sidebar a.nav-link.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 16px -6px rgba(222,108,19,0.55);
}
.admin-sidebar .nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

/* Main area */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 15;
}
.admin-topbar h1 {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 600;
  margin: 0;
}
.admin-topbar .right { display: flex; align-items: center; gap: 14px; }
.admin-topbar .user {
  display: flex; align-items: center; gap: 10px;
  font-size: 13px; color: var(--text-mute);
}
.admin-topbar .user .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
}

.admin-content {
  padding: 26px 28px 60px;
  flex: 1;
}

/* =========================================================
   CARDS / PANELS
========================================================= */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 20px;
}
.panel.no-pad { padding: 0; }
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.panel-head h2 {
  margin: 0;
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 600;
}
.panel-head .sub { color: var(--text-mute); font-size: 13px; }

/* Dashboard stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
  font-weight: 600;
}
.stat-card .value {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 30px;
  font-weight: 700;
  margin-top: 6px;
  color: var(--text);
}
.stat-card .icon {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(222,108,19,0.08);
  color: var(--brand);
  display: inline-flex; align-items: center; justify-content: center;
}
.stat-card .icon svg { width: 20px; height: 20px; }
.stat-card.is-purple .icon { background: rgba(75,36,128,0.08); color: var(--purple); }
.stat-card.is-success .icon { background: rgba(16,185,129,0.1); color: var(--success); }
.stat-card.is-info .icon { background: rgba(59,130,246,0.1); color: var(--info); }

/* =========================================================
   TABLES
========================================================= */

.tbl-wrap { overflow-x: auto; }
table.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.tbl th, table.tbl td {
  text-align: left;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
table.tbl th {
  font-weight: 600;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  background: #fafbfd;
}
table.tbl tbody tr:hover { background: #fafbfd; }
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl .thumb {
  width: 44px; height: 44px;
  border-radius: 8px;
  object-fit: cover;
  background: #f0f2f8;
  border: 1px solid var(--border);
}
table.tbl .actions { white-space: nowrap; }
table.tbl .actions a, table.tbl .actions button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  margin-right: 4px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
}
table.tbl .actions a:hover { border-color: var(--brand); color: var(--brand); }
table.tbl .actions .danger:hover { border-color: var(--danger); color: var(--danger); }

/* =========================================================
   BADGES
========================================================= */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge-pending    { background:#fef3c7; color:#92400e; }
.badge-processing { background:#dbeafe; color:#1e40af; }
.badge-shipped    { background:#ede9fe; color:#5b21b6; }
.badge-delivered  { background:#d1fae5; color:#065f46; }
.badge-cancelled  { background:#fee2e2; color:#991b1b; }
.badge-active     { background:#d1fae5; color:#065f46; }
.badge-inactive   { background:#f3f4f6; color:#374151; }
.badge-out_of_stock{ background:#fee2e2; color:#991b1b; }
.badge-featured   { background:rgba(222,108,19,0.12); color:var(--brand-dark); }
.badge-sale       { background:#fef3c7; color:#92400e; }

/* =========================================================
   FORMS
========================================================= */

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 22px;
}
.form-grid .full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.form-group label .req { color: var(--danger); }
.form-group .hint { font-size: 12px; color: var(--text-soft); margin-top: 2px; }

.form-control {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(222,108,19,0.12);
}
textarea.form-control { min-height: 130px; resize: vertical; line-height: 1.55; }
select.form-control { cursor: pointer; }

.checkbox-row {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
}
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--brand); }

/* File input + preview */
.file-input { position: relative; }
.file-input input[type=file] {
  width: 100%; padding: 10px 13px; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: #fafbfd; cursor: pointer;
}
.img-preview {
  display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px;
}
.img-preview .item {
  position: relative; width: 90px; height: 90px;
  border-radius: 8px; overflow: hidden; border: 1px solid var(--border); background:#f0f2f8;
}
.img-preview .item img { width: 100%; height: 100%; object-fit: cover; }
.img-preview .item .rm {
  position: absolute; top: 4px; right: 4px;
  background: rgba(0,0,0,0.55); color: #fff;
  width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px; font-weight: bold;
  border: none;
}
.img-preview .item .rm:hover { background: var(--danger); }

/* =========================================================
   BUTTONS
========================================================= */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-bright); color:#fff; }
.btn-outline { background: #fff; color: var(--text); border-color: var(--border); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; color:#fff; }
.btn-ghost { background: transparent; color: var(--text-mute); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-sm { padding: 6px 14px; font-size: 13px; }

.form-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border);
}

/* =========================================================
   FLASH MESSAGES
========================================================= */

.flash {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* =========================================================
   PAGE HEADING + FILTERS
========================================================= */

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 22px;
}
.page-head .left h2 {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 22px; font-weight: 700; margin: 0;
}
.page-head .left p { color: var(--text-mute); margin: 4px 0 0; font-size: 13.5px; }

.filter-bar {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar .form-control { width: auto; min-width: 180px; }

/* =========================================================
   LOGIN PAGE
========================================================= */

.login-shell {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #14102a 0%, #2a1856 100%);
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 420px;
  background: #fff;
  padding: 38px 32px;
  border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0,0,0,0.5);
}
.login-card .brand-row {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 28px;
}
.login-card .brand-row img { height: 56px; width: 56px; object-fit: contain; }
.login-card .brand-row .name {
  font-family: 'Sora', system-ui, sans-serif;
  font-weight: 700; font-size: 20px;
}
.login-card .brand-row .name span { color: var(--brand); }
.login-card h1 {
  font-family: 'Sora', system-ui, sans-serif;
  font-size: 22px; margin: 0 0 4px; text-align: center;
}
.login-card .sub {
  text-align: center; color: var(--text-mute); font-size: 13.5px;
  margin-bottom: 24px;
}

/* =========================================================
   ORDER DETAIL
========================================================= */

.detail-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
.detail-grid > .stack { display: flex; flex-direction: column; gap: 20px; }
.kv { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13.5px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-mute); min-width: 110px; }
.kv .v { color: var(--text); font-weight: 500; flex: 1; }

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 900px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform .25s; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar { padding: 14px 16px; }
  .admin-content { padding: 18px 16px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .sidebar-toggle { display: inline-flex !important; }
}

.sidebar-toggle {
  display: none;
  background: transparent; border: 1px solid var(--border);
  width: 38px; height: 38px; border-radius: 8px;
  align-items: center; justify-content: center; cursor: pointer;
}
