/* ==============================================================================
   SASTAMART QUICK COMMERCE - SUPER ADMIN DASHBOARD STYLES
   File: admin/css/admin.css
   Aesthetic: Polished, Modern, Human-Crafted Quick Commerce Admin Theme
   ============================================================================== */

:root {
  --primary: #0c8340;
  --primary-hover: #096a33;
  --primary-light: #ecfdf5;
  --primary-border: #a7f3d0;
  
  --dark-bg: #0f172a;
  --dark-surface: #1e293b;
  --dark-border: rgba(255, 255, 255, 0.08);
  --dark-text: #f8fafc;
  --dark-muted: #94a3b8;
  
  --canvas-bg: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  
  --status-green-bg: #ecfdf5;
  --status-green-text: #065f46;
  --status-red-bg: #fef2f2;
  --status-red-text: #991b1b;
  --status-yellow-bg: #fef9c3;
  --status-yellow-text: #854d0e;
  --status-blue-bg: #eff6ff;
  --status-blue-text: #1e40af;
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: var(--canvas-bg);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* --------------------------------------------------------------------------
   Sidebar Navigation
--------------------------------------------------------------------------- */
.admin-sidebar {
  width: 260px;
  background-color: var(--dark-bg);
  color: var(--dark-muted);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  border-right: 1px solid var(--dark-border);
  transition: transform 0.25s ease;
}

.brand-header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--dark-border);
}

.brand-logo-badge {
  background-color: var(--primary);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.1rem;
}

.brand-text h2 {
  font-size: 1.15rem;
  color: #fff;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.brand-text span {
  font-size: 0.72rem;
  color: #10b981;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.nav-menu {
  list-style: none;
  padding: 18px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--dark-muted);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-item a:hover {
  background-color: var(--dark-surface);
  color: #fff;
}

.nav-item.active a {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
  font-weight: 600;
}

.nav-item a svg {
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--dark-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-initial {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #334155;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
}

.admin-info p {
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.admin-info small {
  color: var(--dark-muted);
  font-size: 0.72rem;
}

/* --------------------------------------------------------------------------
   Main Content Layout
--------------------------------------------------------------------------- */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-topbar {
  background: var(--card-bg);
  height: 64px;
  border-bottom: 1px solid var(--border-color);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.page-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.store-badge {
  background-color: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.store-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--primary);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-secondary {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-secondary:hover {
  background: #e2e8f0;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-danger:hover {
  background: #fca5a5;
}

/* --------------------------------------------------------------------------
   Views Canvas
--------------------------------------------------------------------------- */
.admin-content {
  padding: 28px;
  flex: 1;
}

.spa-view {
  display: none;
}

.spa-view.active {
  display: block;
}

/* --------------------------------------------------------------------------
   Metric Cards Grid
--------------------------------------------------------------------------- */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.metric-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.metric-data h4 {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

.metric-data h2 {
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text-main);
}

.metric-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-icon-wrap.green { background: #ecfdf5; color: #059669; }
.metric-icon-wrap.blue  { background: #eff6ff; color: #2563eb; }
.metric-icon-wrap.purple{ background: #faf5ff; color: #9333ea; }
.metric-icon-wrap.amber { background: #fffbeb; color: #d97706; }

/* --------------------------------------------------------------------------
   Data Cards & Table Container
--------------------------------------------------------------------------- */
.data-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 24px;
}

.data-card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.data-card-header h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-main);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.search-input {
  border: 1px solid var(--border-color);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  width: 220px;
  outline: none;
  transition: all 0.15s ease;
}

.search-input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.custom-select {
  border: 1px solid var(--border-color);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Tables
--------------------------------------------------------------------------- */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.custom-table th {
  background-color: #f8fafc;
  padding: 12px 18px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border-color);
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.custom-table tbody tr:hover {
  background-color: #f8fafc;
}

.table-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #f1f5f9;
  border: 1px solid var(--border-color);
  padding: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.active { background: var(--status-green-bg); color: var(--status-green-text); }
.badge.inactive { background: var(--status-red-bg); color: var(--status-red-text); }
.badge.warning { background: var(--status-yellow-bg); color: var(--status-yellow-text); }
.badge.info { background: var(--status-blue-bg); color: var(--status-blue-text); }

.action-btns {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.btn-icon:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
}

/* --------------------------------------------------------------------------
   Bulk Import Box
--------------------------------------------------------------------------- */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-dropzone svg {
  color: var(--primary);
  margin-bottom: 12px;
}

.upload-dropzone p {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
  margin-bottom: 4px;
}

.upload-dropzone span {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.import-log-console {
  margin-top: 20px;
  background: #0f172a;
  color: #38bdf8;
  font-family: Consolas, monospace;
  font-size: 0.82rem;
  padding: 16px;
  border-radius: var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  line-height: 1.5;
  display: none;
}

/* --------------------------------------------------------------------------
   Stores Grid Cards
--------------------------------------------------------------------------- */
.stores-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.store-info-card {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.store-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.store-card-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
}

.store-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.store-detail-row strong {
  color: var(--text-muted);
  min-width: 90px;
}

/* --------------------------------------------------------------------------
   Modals
--------------------------------------------------------------------------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: #fff;
  border-radius: var(--radius-md);
  width: 100%;
  max-width: 580px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-control {
  border: 1px solid var(--border-color);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.12);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.modal-footer {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

/* --------------------------------------------------------------------------
   Toast Notifications
--------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
}

.toast {
  background: var(--dark-bg);
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn 0.25s ease;
}

.toast.success { border-left: 4px solid var(--primary); }
.toast.error   { border-left: 4px solid #ef4444; }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open {
    transform: translateX(0);
  }
  .admin-main {
    margin-left: 0;
  }
}
