/* =================================================================
   Smart Back-Office Admin Dashboard - CSS Stylesheet
   Modern Clean Dashboard, High-Contrast Data Tables, Profit Badges
   ================================================================= */

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

:root {
  --admin-bg: #F1F5F9;
  --sidebar-bg: #0F172A;
  --sidebar-hover: #1E293B;
  --primary: #FF5722;
  --primary-hover: #E64A19;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --dark: #1E293B;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-500: #64748B;
  --radius: 10px;
  --shadow: 0 4px 12px rgba(0,0,0,0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Kanit', 'Inter', sans-serif;
  background-color: var(--admin-bg);
  color: var(--dark);
  display: flex;
  min-height: 100vh;
}

/* Sidebar Navigation */
.admin-sidebar {
  width: 250px;
  background: var(--sidebar-bg);
  color: white;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 0 20px 20px 20px;
  border-bottom: 1px solid #334155;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-menu {
  list-style: none;
  margin-top: 15px;
}

.nav-item {
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.92rem;
  color: #94A3B8;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-item:hover, .nav-item.active {
  background: var(--sidebar-hover);
  color: white;
  border-left: 4px solid var(--primary);
}

/* Main Content Area */
.admin-main {
  flex-grow: 1;
  padding: 24px;
  overflow-y: auto;
}

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 700;
}

/* Cards & Containers */
.card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
}

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

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

.admin-table th {
  background: #F8FAFC;
  padding: 12px 14px;
  color: var(--gray-500);
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
}

.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-200);
  vertical-align: middle;
}

.admin-table tr:hover {
  background: #F8FAFC;
}

/* Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #CBD5E1;
  transition: .3s;
  border-radius: 24px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .3s;
  border-radius: 50%;
}

input:checked + .slider {
  background-color: var(--success);
}

input:checked + .slider:before {
  transform: translateX(20px);
}

/* Status & Margin Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #E0F2FE; color: #075985; }
.badge-pending   { background: #FEF3C7; color: #B45309; }
.badge-approved  { background: #D1FAE5; color: #047857; }
.badge-rejected  { background: #FEE2E2; color: #B91C1C; }
.badge-suspended { background: #F1F5F9; color: #475569; }
.badge-food    { background: #FFEDD5; color: #C2410C; }
.badge-ride    { background: #DBEAFE; color: #1D4ED8; }
.badge-service { background: #D1FAE5; color: #047857; }

/* Form Controls */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #94A3B8; color: white; }
.btn-sm { padding: 4px 10px; font-size: 0.8rem; }

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.form-group {
  margin-bottom: 12px;
}

.form-group label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-bottom: 4px;
}

.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.9rem;
}

/* Modals */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: white;
  border-radius: var(--radius);
  width: 90%;
  max-width: 650px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
}

.hidden { display: none !important; }

.store-cover-dropzone {
  padding: 12px;
  border: 2px dashed var(--gray-300);
  border-radius: 12px;
  background: #F8FAFC;
  cursor: pointer;
  text-align: center;
  transition: border-color .18s ease, background-color .18s ease, box-shadow .18s ease;
}

.store-cover-preview-frame {
  width: 100%;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  background: #fff;
}

#store-cover-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.store-cover-dropzone:hover,
.store-cover-dropzone:focus-visible,
.store-cover-dropzone.is-dragging {
  border-color: var(--primary);
  background: #FFF7ED;
  box-shadow: 0 0 0 3px rgba(255, 87, 34, .12);
  outline: none;
}

.store-cover-dropzone-hint {
  display: grid;
  gap: 3px;
  margin-top: 8px;
  color: var(--gray-500);
  font-size: .8rem;
}

.store-cover-dropzone-hint strong {
  color: var(--dark);
  font-size: .88rem;
}

/* =================================================================
   Responsive Design for Mobile (iOS, Android), Tablet, and Desktop
   ================================================================= */

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.admin-table {
  min-width: 680px;
}

.mobile-only {
  display: none !important;
}

@media (max-width: 1024px) {
  body {
    flex-direction: column;
  }

  .mobile-only {
    display: inline-flex !important;
  }

  .mobile-nav-bar {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--sidebar-bg);
    color: white;
    padding: 0 16px;
    z-index: 9990;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 9999;
    transform: translateX(-100%);
    transition: transform 0.28s ease-in-out;
    box-shadow: 4px 0 24px rgba(0,0,0,0.35);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .admin-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(2px);
    z-index: 9998;
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .admin-main {
    padding: 16px;
    margin-top: 56px;
    width: 100%;
  }

  .header-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-bar > div:last-child {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-start;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .modal-content {
    width: 95%;
    max-width: 95vw;
    padding: 18px;
    max-height: 92vh;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 1025px) {
  .mobile-nav-bar {
    display: none !important;
  }
  .sidebar-backdrop {
    display: none !important;
  }
}
