/* ==========================================================================
   AXCES SEVEN EXIMS - ADMIN PANEL STYLESHEET
   Brand Theme: Deep Spruce Teal (#0b3d45) & Lime Accent (#c4d728)
   ========================================================================== */

:root {
  --admin-primary: #0b3d45;
  --admin-primary-dark: #072b31;
  --admin-primary-light: #165b67;
  --admin-accent: #c4d728;
  --admin-accent-hover: #b0c21e;
  --admin-sidebar-bg: #0b2f35;
  --admin-sidebar-hover: #13444c;
  --admin-sidebar-active: #18555f;
  --admin-bg: #f4f7f8;
  --admin-card-bg: #ffffff;
  --admin-text-main: #1e293b;
  --admin-text-muted: #64748b;
  --admin-border: #e2e8f0;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-info: #0284c7;
  --admin-radius: 8px;
  --admin-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --admin-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
  --admin-shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  --transition: all 0.2s ease-in-out;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
}

body {
  background-color: var(--admin-bg);
  color: var(--admin-text-main);
  min-height: 100vh;
  display: flex;
  font-size: 14px;
  line-height: 1.5;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.admin-sidebar {
  width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: #ffffff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-logo {
  height: 38px;
  max-width: 120px;
  border-radius: 6px;
  object-fit: contain;
  background: #ffffff;
  padding: 4px 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.sidebar-brand-text h2 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #ffffff;
}

.sidebar-brand-text p {
  font-size: 11px;
  color: var(--admin-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-nav {
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-group-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  letter-spacing: 0.8px;
  padding: 12px 12px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 4px;
  transition: var(--transition);
}

.sidebar-link svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  flex-shrink: 0;
}

.sidebar-link:hover {
  background-color: var(--admin-sidebar-hover);
  color: #ffffff;
}

.sidebar-link.active {
  background-color: var(--admin-sidebar-active);
  color: #ffffff;
  font-weight: 600;
  border-left: 3px solid var(--admin-accent);
}

.sidebar-badge {
  margin-left: auto;
  background: var(--admin-accent);
  color: #0b2f35;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
}

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

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--admin-accent);
  color: #0b2f35;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

.user-info .user-name {
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
}

.user-info .user-role {
  font-size: 11px;
  color: #94a3b8;
}

.btn-logout {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-logout:hover {
  color: var(--admin-danger);
  background: rgba(239, 68, 68, 0.1);
}

/* ==========================================================================
   MAIN CONTENT AREA
   ========================================================================== */
.admin-main {
  margin-left: 260px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 260px);
}

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

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

.sidebar-toggle-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 4px;
  color: var(--admin-text-main);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--admin-text-muted);
}

.page-breadcrumb .current {
  color: var(--admin-primary);
  font-weight: 600;
}

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

.topbar-btn {
  background: #f1f5f9;
  border: 1px solid var(--admin-border);
  color: var(--admin-text-main);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.topbar-btn:hover {
  background: #e2e8f0;
  color: var(--admin-primary);
}

.topbar-btn svg {
  width: 14px;
  height: 14px;
}

/* Page Body Container */
.admin-content {
  padding: 28px;
  flex: 1;
}

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

.page-header-title h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--admin-primary);
}

.page-header-title p {
  font-size: 13px;
  color: var(--admin-text-muted);
  margin-top: 2px;
}

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

/* ==========================================================================
   BUTTONS & UI CONTROLS
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  line-height: 1.4;
}

.btn-primary {
  background-color: var(--admin-primary);
  color: #ffffff;
}

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

.btn-accent {
  background-color: var(--admin-accent);
  color: #0b2f35;
  font-weight: 700;
}

.btn-accent:hover {
  background-color: var(--admin-accent-hover);
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

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

.btn-danger {
  background-color: #fee2e2;
  color: var(--admin-danger);
  border: 1px solid #fca5a5;
}

.btn-danger:hover {
  background-color: var(--admin-danger);
  color: #ffffff;
}

.btn-success {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}

.btn-success:hover {
  background-color: var(--admin-success);
  color: #ffffff;
}

.btn-whatsapp {
  background-color: #25d366;
  color: #ffffff;
  font-weight: 600;
}

.btn-whatsapp:hover {
  background-color: #128c7e;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn svg {
  width: 15px;
  height: 15px;
}

/* ==========================================================================
   STATS CARDS
   ========================================================================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 20px;
  box-shadow: var(--admin-shadow-sm);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--admin-shadow);
}

.stat-info h3 {
  font-size: 13px;
  color: var(--admin-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--admin-primary);
  margin: 6px 0;
}

.stat-trend {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-trend.up {
  color: var(--admin-success);
}

.stat-trend.down {
  color: var(--admin-danger);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-icon.teal {
  background: #e6f3f4;
  color: var(--admin-primary);
}

.stat-icon.lime {
  background: #f7fbe6;
  color: #849608;
}

.stat-icon.orange {
  background: #fef3c7;
  color: #b45309;
}

.stat-icon.blue {
  background: #e0f2fe;
  color: var(--admin-info);
}

.stat-icon svg {
  width: 22px;
  height: 22px;
}

/* ==========================================================================
   CARDS & PANELS
   ========================================================================== */
.card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

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

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

.admin-table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--admin-border);
  white-space: nowrap;
}

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

.admin-table tbody tr {
  transition: background-color 0.15s ease;
}

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

/* Status Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-new {
  background: #dbeafe;
  color: #1e40af;
}

.badge-contacted {
  background: #fef3c7;
  color: #92400e;
}

.badge-converted {
  background: #d1fae5;
  color: #065f46;
}

.badge-closed {
  background: #f1f5f9;
  color: #475569;
}

.badge-active {
  background: #dcfce7;
  color: #15803d;
}

.badge-inactive {
  background: #fee2e2;
  color: #b91c1c;
}

.badge-food {
  background: #e0f2fe;
  color: #0369a1;
}

.badge-nonfood {
  background: #fae8ff;
  color: #86198f;
}

/* Table Product Thumbnail */
.table-prod-thumb {
  width: 44px;
  height: 38px;
  border-radius: 4px;
  object-fit: cover;
  border: 1px solid var(--admin-border);
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ==========================================================================
   FILTER & SEARCH TOOLBAR
   ========================================================================== */
.toolbar-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  min-width: 260px;
  flex: 1;
  max-width: 400px;
}

.search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 2px rgba(11, 61, 69, 0.1);
}

.search-box svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--admin-text-muted);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-select {
  padding: 8px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  background: #ffffff;
  color: var(--admin-text-main);
  cursor: pointer;
}

.admin-select:focus {
  border-color: var(--admin-primary);
}

/* ==========================================================================
   PRODUCT GRID & GALLERY GRIDS IN ADMIN
   ========================================================================== */
.admin-prod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.admin-prod-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: var(--transition);
}

.admin-prod-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--admin-shadow);
  border-color: #cbd5e1;
}

.admin-prod-img {
  width: 100%;
  aspect-ratio: 115 / 97;
  border-radius: 4px;
  overflow: hidden;
  background: #f1f5f9;
  margin-bottom: 10px;
}

.admin-prod-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-prod-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--admin-primary);
  margin-bottom: 2px;
}

.admin-prod-meta {
  font-size: 11.5px;
  color: var(--admin-text-muted);
  margin-bottom: 12px;
}

.admin-prod-footer {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

/* Facility 3x5 Grid in Admin */
.facility-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.facility-admin-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  padding: 10px;
  position: relative;
}

.facility-admin-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 8px;
}

/* Certifications 3x2 Grid in Admin */
.cert-admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.cert-admin-card {
  background: #ffffff;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  padding: 16px;
  text-align: center;
}

.cert-admin-card img {
  width: 100%;
  height: 200px;
  object-fit: contain;
  border: 2px solid #b8974a;
  padding: 6px;
  background: #ffffff;
  border-radius: 4px;
  margin-bottom: 12px;
}

/* ==========================================================================
   FORMS & INPUTS
   ========================================================================== */
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

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

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-label .req {
  color: var(--admin-danger);
}

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--admin-text-main);
  background: #ffffff;
  outline: none;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 2px rgba(11, 61, 69, 0.1);
}

textarea.form-control {
  min-height: 90px;
  resize: vertical;
}

/* Image Upload Preview Box */
.image-upload-wrap {
  border: 2px dashed #cbd5e1;
  border-radius: 6px;
  padding: 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.image-upload-wrap:hover {
  border-color: var(--admin-primary);
  background: #f0fdf4;
}

.upload-preview {
  max-width: 140px;
  max-height: 100px;
  border-radius: 4px;
  object-fit: cover;
  margin: 0 auto 10px;
  display: none;
}

.upload-preview.show {
  display: block;
}

/* ==========================================================================
   MODALS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 47, 53, 0.6);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

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

.modal-dialog {
  background: #ffffff;
  border-radius: 10px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--admin-shadow-lg);
  animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-dialog.modal-lg {
  max-width: 780px;
}

@keyframes modalPop {
  0% {
    opacity: 0;
    transform: scale(0.95) translateY(10px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.modal-header {
  padding: 16px 22px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 10px 10px 0 0;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--admin-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}

.modal-close:hover {
  color: var(--admin-danger);
  background: #fee2e2;
}

.modal-body {
  padding: 22px;
}

.modal-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: #f8fafc;
  border-radius: 0 0 10px 10px;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  background: #1e293b;
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 6px;
  box-shadow: var(--admin-shadow-lg);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease;
  min-width: 260px;
}

.toast.success {
  background: #065f46;
  border-left: 4px solid var(--admin-accent);
}

.toast.error {
  background: #991b1b;
  border-left: 4px solid #f87171;
}

.toast.info {
  background: #0f4c5c;
  border-left: 4px solid #38bdf8;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */
@media (max-width: 1024px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .facility-admin-grid,
  .cert-admin-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

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

  .admin-main {
    margin-left: 0;
    width: 100%;
  }

  .sidebar-toggle-btn {
    display: inline-flex;
  }

  .admin-topbar {
    padding: 0 16px;
  }

  .admin-content {
    padding: 16px;
  }

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

  .facility-admin-grid,
  .cert-admin-grid {
    grid-template-columns: 1fr;
  }

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

  .toolbar-wrap {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }
}
