/* ==========================================================================
   MAHALAXMI ENTERPRISES / DHANALAKSHMI PUREIT
   Modern SaaS Admin Dashboard Styling
   ========================================================================== */

:root {
  --admin-sidebar-bg: #0F172A;
  --admin-sidebar-hover: #1E293B;
  --admin-sidebar-active: #0284C7;
  --admin-sidebar-text: #94A3B8;
  --admin-sidebar-text-active: #FFFFFF;
  --admin-body-bg: #F1F5F9;
  --admin-card-bg: #FFFFFF;
  --admin-border: #E2E8F0;
  --admin-primary: #0F172A;
  --admin-accent: #0284C7;
  --admin-success: #10B981;
  --admin-warning: #F59E0B;
  --admin-danger: #EF4444;
  --admin-radius: 10px;
  --admin-shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.05);
}

body.admin-body {
  background-color: var(--admin-body-bg);
  font-family: 'Inter', -apple-system, sans-serif;
  color: #1E293B;
  margin: 0;
  padding: 0;
  display: flex;
  min-height: 100vh;
}

/* ==========================================================================
   ADMIN LAYOUT (SIDEBAR + MAIN CONTENT)
   ========================================================================== */
.admin-sidebar {
  width: 260px;
  background: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 1000;
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand img {
  height: 40px;
  width: auto;
}

.sidebar-menu {
  list-style: none;
  padding: 1.25rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex-grow: 1;
}

.sidebar-section-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #64748B;
  padding: 0.75rem 0.75rem 0.35rem;
  font-weight: 700;
}

.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.85rem;
  color: var(--admin-sidebar-text);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-item a i {
  width: 20px;
  font-size: 1.05rem;
  text-align: center;
}

.sidebar-item a:hover {
  background: var(--admin-sidebar-hover);
  color: #FFFFFF;
}

.sidebar-item.active a {
  background: var(--admin-sidebar-active);
  color: #FFFFFF;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35);
}

.sidebar-item .sidebar-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.15);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
}

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

/* ==========================================================================
   ADMIN TOPBAR
   ========================================================================== */
.admin-topbar {
  background: #FFFFFF;
  border-bottom: 1px solid var(--admin-border);
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 99;
}

.topbar-left-ctrl {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #64748B;
  cursor: pointer;
  display: none;
}

.admin-view-site {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-accent);
  background: #E0F2FE;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
}
.admin-view-site:hover {
  background: #BAE6FD;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--admin-primary);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
}

.user-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: #0F172A;
}

.user-role {
  font-size: 0.75rem;
  color: #64748B;
}

.btn-admin-logout {
  background: #FEE2E2;
  color: #DC2626;
  border: none;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.btn-admin-logout:hover {
  background: #DC2626;
  color: #FFFFFF;
}

/* ==========================================================================
   ADMIN CONTENT & TABS
   ========================================================================== */
.admin-content {
  padding: 2rem;
  flex-grow: 1;
}

.admin-tab-pane {
  display: none;
}

.admin-tab-pane.active {
  display: block;
  animation: fadeInTab 0.25s ease;
}

@keyframes fadeInTab {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.tab-page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.tab-page-header h2 {
  font-size: 1.6rem;
  color: #0F172A;
  margin-bottom: 0.25rem;
}

.tab-page-header p {
  font-size: 0.9rem;
  color: #64748B;
}

/* Stat Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.stat-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  padding: 1.5rem;
  box-shadow: var(--admin-shadow);
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.stat-icon {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.stat-icon.products { background: #E0F2FE; color: #0284C7; }
.stat-icon.enquiries { background: #DCFCE7; color: #10B981; }
.stat-icon.requests { background: #FEF3C7; color: #D97706; }
.stat-icon.customers { background: #F3E8FF; color: #9333EA; }
.stat-icon.categories { background: #FFE4E6; color: #E11D48; }

.stat-info h4 {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #64748B;
  margin-bottom: 0.25rem;
}

.stat-number {
  font-size: 1.75rem;
  font-weight: 800;
  color: #0F172A;
  line-height: 1;
}

/* Tables & Controls */
.admin-card {
  background: var(--admin-card-bg);
  border: 1px solid var(--admin-border);
  border-radius: var(--admin-radius);
  box-shadow: var(--admin-shadow);
  overflow: hidden;
  margin-bottom: 2rem;
}

.card-header-ctrl {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: #0F172A;
}

.ctrl-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.admin-search-input {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  min-width: 220px;
}
.admin-search-input:focus {
  border-color: var(--admin-accent);
}

.admin-filter-select {
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  background: #FFFFFF;
}

.btn-admin-add {
  background: var(--admin-accent);
  color: #FFFFFF;
  border: none;
  padding: 0.55rem 1.1rem;
  border-radius: 6px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
}
.btn-admin-add:hover {
  background: #0369A1;
}

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

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

.admin-table th {
  background: #F8FAFC;
  padding: 0.9rem 1.25rem;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #475569;
  border-bottom: 1px solid var(--admin-border);
  font-weight: 700;
}

.admin-table td {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--admin-border);
  font-size: 0.9rem;
  color: #1E293B;
  vertical-align: middle;
}

.admin-table tr:last-child td {
  border-bottom: none;
}

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

.tbl-img {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: contain;
  background: #F1F5F9;
  border: 1px solid var(--admin-border);
  padding: 2px;
}

/* Status Badges */
.status-pill {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: capitalize;
}

.status-new { background: #E0F2FE; color: #0284C7; }
.status-contacted { background: #FEF3C7; color: #D97706; }
.status-assigned { background: #EDE9FE; color: #7C3AED; }
.status-inprogress { background: #DBEAFE; color: #1D4ED8; }
.status-completed { background: #DCFCE7; color: #15803D; }
.status-cancelled { background: #FEE2E2; color: #B91C1C; }
.status-active { background: #DCFCE7; color: #15803D; }
.status-inactive { background: #F1F5F9; color: #64748B; }

/* Action Buttons in Table */
.tbl-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.btn-tbl {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--admin-border);
  background: #FFFFFF;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  color: #475569;
  transition: all 0.2s ease;
}

.btn-tbl:hover {
  background: #F1F5F9;
  color: #0F172A;
}

.btn-tbl.edit:hover { background: #E0F2FE; color: #0284C7; border-color: #BAE6FD; }
.btn-tbl.delete:hover { background: #FEE2E2; color: #DC2626; border-color: #FECACA; }
.btn-tbl.view:hover { background: #F3E8FF; color: #7C3AED; border-color: #DDD6FE; }
.btn-tbl.whatsapp:hover { background: #DCFCE7; color: #15803D; border-color: #BBF7D0; }

/* ==========================================================================
   MODALS (ADD/EDIT PRODUCT, VIEW DETAILS)
   ========================================================================== */
.admin-modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.admin-modal-backdrop.show {
  display: flex;
  animation: fadeIn 0.2s ease;
}

.admin-modal {
  background: #FFFFFF;
  border-radius: var(--admin-radius);
  width: 100%;
  max-width: 800px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  overflow: hidden;
}

.modal-header {
  padding: 1.25rem 1.75rem;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.25rem;
  color: #0F172A;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #64748B;
  cursor: pointer;
}
.modal-close-btn:hover {
  color: #0F172A;
}

.modal-body {
  padding: 1.75rem;
  overflow-y: auto;
  flex-grow: 1;
}

.modal-footer {
  padding: 1rem 1.75rem;
  border-top: 1px solid var(--admin-border);
  background: #F8FAFC;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.modal-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

/* Image Upload Preview Box */
.img-upload-group {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.img-slot {
  border: 2px dashed var(--admin-border);
  border-radius: 8px;
  padding: 0.75rem;
  text-align: center;
  position: relative;
  background: #F8FAFC;
}

.img-slot img {
  max-height: 70px;
  margin: 0 auto 0.5rem;
  object-fit: contain;
}

.img-slot-input {
  font-size: 0.75rem;
  width: 100%;
}

/* Responsive Admin */
@media (max-width: 991px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }

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

  .admin-main {
    margin-left: 0;
  }

  .sidebar-toggle-btn {
    display: block;
  }

  .modal-grid-2 {
    grid-template-columns: 1fr;
  }

  .img-upload-group {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Admin Mobile Phone Optimization (max-width: 767px) */
@media (max-width: 767px) {
  .admin-content {
    padding: 1rem 0.75rem;
  }

  .admin-topbar {
    padding: 0.65rem 0.85rem;
  }

  .admin-view-site span,
  .btn-admin-logout span {
    display: none;
  }

  .admin-view-site,
  .btn-admin-logout {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
  }

  .user-role {
    display: none;
  }

  .admin-stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }

  .stat-card {
    padding: 1rem 0.75rem;
  }

  .stat-number {
    font-size: 1.45rem;
  }

  .stat-label {
    font-size: 0.78rem;
  }

  .tab-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
  }

  .tab-title {
    font-size: 1.35rem;
  }

  .tab-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .btn-admin-primary,
  .btn-admin-secondary {
    padding: 0.55rem 0.85rem;
    font-size: 0.82rem;
  }

  .card-header-ctrl {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
  }

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

  .admin-search-box input {
    width: 100%;
  }

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

  .admin-table th,
  .admin-table td {
    padding: 0.75rem 0.75rem;
    font-size: 0.82rem;
  }

  /* Responsive audit: comfortable close-button tap target on phones */
  .modal-close-btn {
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Responsive audit: touch-target floor for compact admin chrome */
  .sidebar-toggle-btn {
    min-width: 44px;
    min-height: 44px;
  }
  .admin-view-site,
  .btn-admin-logout {
    min-height: 44px;
    padding: 0.6rem 0.8rem;
  }
  .btn-admin-primary,
  .btn-admin-secondary,
  .btn-admin-add {
    min-height: 44px;
  }

  .admin-modal {
    width: 95vw !important;
    max-width: 95vw !important;
    margin: 1rem auto;
    padding: 1.25rem !important;
    max-height: 90vh;
    overflow-y: auto;
  }
}

