/* assets/css/admin.css - ShopNest Admin Panel */

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

:root {
  --adm-primary: #0f172a;
  --adm-sidebar: #1e293b;
  --adm-sidebar-hover: #334155;
  --adm-accent: #e94560;
  --adm-accent2: #3b82f6;
  --adm-text: #f8fafc;
  --adm-text-muted: #94a3b8;
  --adm-border: #334155;
  --adm-bg: #f1f5f9;
  --adm-card: #ffffff;
  --adm-success: #10b981;
  --adm-warning: #f59e0b;
  --adm-danger: #ef4444;
  --adm-info: #3b82f6;
  --sidebar-w: 260px;
  --topbar-h: 64px;
  --font: 'Space Grotesk', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--adm-bg); color: var(--adm-primary); -webkit-font-smoothing: antialiased; }

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

/* ── SIDEBAR ── */
.admin-sidebar {
  width: var(--sidebar-w); background: var(--adm-sidebar);
  position: fixed; top: 0; left: 0; height: 100vh;
  display: flex; flex-direction: column; z-index: 100;
  transition: transform .3s ease;
  overflow: hidden;
}
.admin-sidebar.collapsed { width: 68px; }
.sidebar-brand { padding: 20px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--adm-border); min-height: var(--topbar-h); }
.brand-icon { width: 36px; height: 36px; background: var(--adm-accent); border-radius: 8px; display: grid; place-items: center; color: #fff; font-size: 1rem; flex-shrink: 0; }
.brand-text { font-size: 1.2rem; font-weight: 700; color: var(--adm-text); white-space: nowrap; overflow: hidden; }
.admin-sidebar.collapsed .brand-text,
.admin-sidebar.collapsed .nav-label,
.admin-sidebar.collapsed .sidebar-group-title { display: none; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar-nav::-webkit-scrollbar { display: none; }
.sidebar-group-title { padding: 12px 20px 4px; font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--adm-text-muted); white-space: nowrap; }
.sidebar-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px; color: var(--adm-text-muted);
  font-size: .875rem; font-weight: 500; cursor: pointer;
  transition: all .15s ease; border-left: 3px solid transparent;
  white-space: nowrap; text-decoration: none;
}
.sidebar-link:hover { background: var(--adm-sidebar-hover); color: var(--adm-text); }
.sidebar-link.active { background: rgba(233,69,96,.12); color: var(--adm-accent); border-left-color: var(--adm-accent); }
.sidebar-link i { width: 20px; font-size: .95rem; flex-shrink: 0; }
.sidebar-link .badge { margin-left: auto; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid var(--adm-border); }
.sidebar-footer .sidebar-link { padding: 8px 0; }

/* ── TOPBAR ── */
.admin-topbar {
  position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h);
  background: var(--adm-card); border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 99; gap: 16px;
  transition: left .3s ease;
}
.admin-sidebar.collapsed ~ .admin-content .admin-topbar,
.admin-sidebar.collapsed ~ .admin-topbar { left: 68px; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-toggle { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: #64748b; transition: background .15s; }
.topbar-toggle:hover { background: var(--adm-bg); }
.topbar-search { display: flex; align-items: center; gap: 8px; background: var(--adm-bg); border-radius: 8px; padding: 8px 14px; width: 280px; }
.topbar-search input { background: none; border: none; outline: none; font-size: .875rem; width: 100%; font-family: var(--font); }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-icon-btn { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: #64748b; position: relative; transition: background .15s; }
.topbar-icon-btn:hover { background: var(--adm-bg); }
.topbar-icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--adm-danger); border: 2px solid var(--adm-card); }
.topbar-user { display: flex; align-items: center; gap: 10px; padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: background .15s; }
.topbar-user:hover { background: var(--adm-bg); }
.topbar-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--adm-accent); color: #fff; display: grid; place-items: center; font-size: .85rem; font-weight: 700; }
.topbar-user-info { display: flex; flex-direction: column; }
.topbar-user-name { font-size: .84rem; font-weight: 600; }
.topbar-user-role { font-size: .72rem; color: #64748b; }

/* ── MAIN CONTENT ── */
.admin-main {
  margin-left: var(--sidebar-w); padding-top: var(--topbar-h);
  min-height: 100vh; transition: margin-left .3s ease;
}
.admin-sidebar.collapsed ~ .admin-main { margin-left: 68px; }
.admin-content { padding: 28px 24px; }

/* ── PAGE HEADER ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.page-title { font-size: 1.5rem; font-weight: 700; color: var(--adm-primary); }
.page-breadcrumb { font-size: .8rem; color: #64748b; margin-top: 4px; display: flex; gap: 6px; }
.page-breadcrumb a { color: #64748b; }
.page-breadcrumb a:hover { color: var(--adm-accent); }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── CARDS ── */
.adm-card { background: var(--adm-card); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 1px solid #e2e8f0; overflow: hidden; }
.adm-card-header { padding: 16px 20px; border-bottom: 1px solid #f1f5f9; display: flex; align-items: center; justify-content: space-between; }
.adm-card-title { font-size: .95rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.adm-card-body { padding: 20px; }

/* ── BUTTONS (admin) ── */
.adm-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 18px; border-radius: 8px; font-size: .845rem; font-weight: 600; cursor: pointer; border: none; transition: all .15s; font-family: var(--font); text-decoration: none; }
.adm-btn-primary { background: var(--adm-primary); color: #fff; }
.adm-btn-primary:hover { background: #1e293b; }
.adm-btn-accent  { background: var(--adm-accent); color: #fff; }
.adm-btn-accent:hover { filter: brightness(.9); }
.adm-btn-success { background: var(--adm-success); color: #fff; }
.adm-btn-danger  { background: var(--adm-danger); color: #fff; }
.adm-btn-warning { background: var(--adm-warning); color: #fff; }
.adm-btn-outline { background: transparent; border: 1.5px solid #e2e8f0; color: var(--adm-primary); }
.adm-btn-outline:hover { border-color: var(--adm-accent); color: var(--adm-accent); }
.adm-btn-sm  { padding: 6px 14px; font-size: .78rem; }
.adm-btn-icon{ width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: 8px; }
.adm-btn-ghost { background: #f1f5f9; color: #475569; }
.adm-btn-ghost:hover { background: #e2e8f0; }

/* ── STATS ── */
.adm-stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }
.adm-stat { padding: 20px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.adm-stat::after { content: ''; position: absolute; bottom: -20px; right: -20px; width: 80px; height: 80px; border-radius: 50%; background: currentColor; opacity: .05; }
.adm-stat-label { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .5px; color: #64748b; }
.adm-stat-value { font-size: 1.8rem; font-weight: 700; letter-spacing: -.5px; }
.adm-stat-change { font-size: .78rem; display: flex; align-items: center; gap: 4px; }
.adm-stat-change.pos { color: var(--adm-success); }
.adm-stat-change.neg { color: var(--adm-danger); }
.adm-stat-icon { position: absolute; right: 16px; top: 16px; font-size: 1.4rem; opacity: .15; }

/* ── TABLE (admin) ── */
.adm-table-wrap { overflow-x: auto; }
.adm-table { width: 100%; border-collapse: collapse; font-size: .855rem; }
.adm-table th { padding: 11px 16px; text-align: left; font-size: .73rem; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #64748b; background: #f8fafc; border-bottom: 1px solid #e2e8f0; white-space: nowrap; }
.adm-table td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tr:hover td { background: #fafbfc; }
.adm-table .td-img { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; }
.adm-table .td-actions { display: flex; gap: 6px; }

/* ── FORM (admin) ── */
.adm-form-group  { margin-bottom: 18px; }
.adm-form-label  { display: block; font-size: .845rem; font-weight: 600; margin-bottom: 6px; color: var(--adm-primary); }
.adm-form-control {
  width: 100%; padding: 9px 14px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: .875rem; font-family: var(--font); color: var(--adm-primary);
  background: #fff; transition: border-color .15s, box-shadow .15s; outline: none;
}
.adm-form-control:focus { border-color: var(--adm-accent); box-shadow: 0 0 0 3px rgba(233,69,96,.08); }
.adm-form-control::placeholder { color: #94a3b8; }
.adm-select { -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3E%3Cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; padding-right: 36px; }
.adm-form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.adm-form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.adm-form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
textarea.adm-form-control { resize: vertical; min-height: 100px; }

/* ── TABS ── */
.adm-tabs { display: flex; gap: 2px; border-bottom: 2px solid #e2e8f0; margin-bottom: 24px; overflow-x: auto; }
.adm-tab { padding: 10px 20px; font-size: .875rem; font-weight: 600; color: #64748b; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; transition: all .15s; }
.adm-tab:hover  { color: var(--adm-primary); }
.adm-tab.active { color: var(--adm-accent); border-bottom-color: var(--adm-accent); }
.adm-tab-content { display: none; }
.adm-tab-content.active { display: block; }

/* ── CHART CONTAINER ── */
.chart-container { position: relative; height: 280px; }

/* ── TOGGLE SWITCH ── */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: #cbd5e1; border-radius: 99px; transition: .3s; }
.toggle-slider::before { content: ''; position: absolute; height: 18px; width: 18px; left: 3px; bottom: 3px; background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--adm-success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── IMAGE UPLOAD ── */
.img-upload-zone { border: 2px dashed #e2e8f0; border-radius: 10px; padding: 32px; text-align: center; cursor: pointer; transition: all .15s; background: #f8fafc; }
.img-upload-zone:hover { border-color: var(--adm-accent); background: rgba(233,69,96,.02); }
.img-upload-zone.dragover { border-color: var(--adm-accent); background: rgba(233,69,96,.05); }
.img-preview-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; margin-top: 12px; }
.img-preview { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; }
.img-preview img { width: 100%; height: 100%; object-fit: cover; }
.img-preview-remove { position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; background: rgba(0,0,0,.6); color: #fff; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; cursor: pointer; }

/* ── PAGINATION (admin) ── */
.adm-pagination { display: flex; align-items: center; gap: 4px; justify-content: center; padding: 16px 0; }
.adm-pg-btn { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; font-size: .875rem; font-weight: 500; cursor: pointer; border: 1px solid #e2e8f0; color: #475569; background: #fff; transition: all .15s; }
.adm-pg-btn:hover  { border-color: var(--adm-accent); color: var(--adm-accent); }
.adm-pg-btn.active { background: var(--adm-accent); color: #fff; border-color: var(--adm-accent); }
.adm-pg-btn:disabled { opacity: .4; cursor: default; }

/* ── FILTER BAR ── */
.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 20px; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
.filter-bar .adm-form-control { width: auto; min-width: 160px; }

/* ── DROPDOWN MENU ── */
.adm-dropdown { position: relative; display: inline-block; }
.adm-dropdown-menu { position: absolute; top: 100%; right: 0; background: var(--adm-card); border: 1px solid #e2e8f0; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1); z-index: 50; min-width: 180px; padding: 6px; display: none; margin-top: 4px; }
.adm-dropdown.open .adm-dropdown-menu { display: block; }
.adm-dropdown-item { padding: 8px 12px; border-radius: 6px; font-size: .855rem; cursor: pointer; display: flex; align-items: center; gap: 8px; color: var(--adm-primary); transition: background .12s; }
.adm-dropdown-item:hover { background: #f1f5f9; }
.adm-dropdown-item.danger { color: var(--adm-danger); }
.adm-dropdown-item.danger:hover { background: #fef2f2; }
.adm-dropdown-sep { height: 1px; background: #e2e8f0; margin: 4px 0; }

/* ── RESPONSIVE ADMIN ── */
@media (max-width: 1024px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-topbar { left: 0 !important; }
  .adm-form-grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .adm-stats-grid { grid-template-columns: 1fr 1fr; }
  .adm-form-grid-2, .adm-form-grid-3 { grid-template-columns: 1fr; }
  .topbar-search { display: none; }
  .chart-container { height: 200px; }
  .admin-content { padding: 16px; }
}

@media (max-width: 480px) {
  .adm-stats-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; align-items: stretch; }
}
