/* =========================================
   1. MAIN LAYOUT & SIDEBAR
   ========================================= */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
  background: #f9fafb;
}

.admin-sidebar {
  width: 260px;
  background: #1f2937; /* Dark Sidebar */
  color: #e5e7eb;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow-y: auto;
  z-index: 50;
}

.admin-brand {
  height: 64px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  font-weight: 700;
  font-size: 1.25rem;
  color: #fff;
  border-bottom: 1px solid #374151;
  text-decoration: none;
  gap: 12px;
}

.admin-nav {
  padding: 16px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.admin-nav-label {
  padding: 16px 24px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  color: #d1d5db;
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
}

.admin-nav a:hover {
  background: #374151;
  color: #fff;
}

.admin-nav a.active {
  background: #111827;
  color: #fff;
  border-right: 3px solid #3b82f6;
}

.admin-nav a svg {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

/* =========================================
   2. CONTENT AREA & TOPBAR
   ========================================= */
.admin-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.admin-topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-page-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.admin-main-inner {
  padding: 32px;
  flex: 1;
}

.btn-view-site {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.btn-view-site:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* =========================================
   3. MOBILE RESPONSIVENESS
   ========================================= */
@media (max-width: 1024px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
    z-index: 9999;
    width: 280px !important;
    height: 100vh !important;
    display: flex !important;
    flex-direction: column !important;
    background: #1f2937 !important; /* Ensure Dark Background */
    overflow-y: auto !important;
  }

  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  /* Force Nav Visibility */
  .admin-sidebar .admin-nav,
  .admin-sidebar .admin-nav a,
  .admin-sidebar .admin-nav-label {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #e5e7eb !important;
  }
  
  .admin-sidebar .admin-nav {
    flex-direction: column !important;
    width: 100% !important;
    background: transparent !important;
  }

  .admin-sidebar .admin-brand {
    display: flex !important;
    visibility: visible !important;
    flex-shrink: 0 !important;
  }
  
  /* Overlay */
  .admin-sidebar.open::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
    width: 100vw;
    height: 100vh;
    transform: translateX(280px);
  }

  .nav-toggle-admin {
    display: flex !important;
    background: none;
    border: none;
    padding: 8px;
    margin-right: 12px;
    cursor: pointer;
    color: #374151;
  }
  
  .admin-topbar {
    padding: 0 16px;
  }
  
  .admin-main-inner {
    padding: 16px;
  }
}

.nav-toggle-admin {
  display: none;
}

/* =========================================
   4. UI ELEMENTS (Tables, Forms, Cards)
   ========================================= */
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th {
  text-align: left;
  padding: 12px 16px;
  background: #f9fafb;
  color: #4b5563;
  font-weight: 600;
  font-size: 0.875rem;
  border-bottom: 1px solid #e5e7eb;
}

.table td {
  padding: 12px 16px;
  border-bottom: 1px solid #f3f4f6;
  color: #374151;
  vertical-align: middle;
}

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

@media (max-width: 768px) {
  .table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table th, .table td { white-space: nowrap; }
}

.btn-icon-only {
  width: 32px;
  height: 32px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: #4b5563;
  background: #fff;
  border: 1px solid #d1d5db;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-icon-only:hover {
  background: #f3f4f6;
  color: #111827;
}

/* =========================================
   5. DASHBOARD STYLES (Optimized)
   ========================================= */
.dashboard-welcome {
  background: linear-gradient(135deg, #4f46e5 0%, #3b82f6 100%);
  color: white;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.dashboard-welcome h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px 0;
  border: none;
  padding: 0;
  color: white;
}

.dashboard-welcome p {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

.dashboard-date {
  background: rgba(255, 255, 255, 0.2);
  padding: 6px 12px;
  border-radius: 6px;
  font-weight: 500;
  backdrop-filter: blur(4px);
  font-size: 13px;
}

.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #374151;
  transition: all 0.2s ease;
  text-align: center;
  gap: 8px;
}

.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
  border-color: #d1d5db;
  color: #111827;
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4b5563;
  transition: all 0.2s;
}

.quick-action-card:hover .quick-action-icon {
  background: #e0e7ff;
  color: #4f46e5;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: all 0.2s;
}

.stat-card:hover {
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  border-color: #d1d5db;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #eff6ff;
  color: #3b82f6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-info h3 {
  font-size: 24px;
  font-weight: 700;
  margin: 0;
  color: #111827;
  line-height: 1.2;
}

.stat-info p {
  margin: 2px 0 0 0;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
}

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

.section-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}
/* =========================================
   6. AUTH & LOGIN PAGES
   ========================================= */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  padding: 24px;
}

.auth-split {
  display: flex;
  max-width: 900px;
  width: 100%;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.auth-hero {
  flex: 1;
  background: #1e40af;
  color: #fff;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) { .auth-hero { display: none; } }

.auth-hero h2 { font-size: 32px; font-weight: 800; margin-bottom: 24px; color: #fff; border:none; padding:0; }
.auth-hero ul { list-style: none; padding: 0; margin: 24px 0 0; }
.auth-hero li { margin-bottom: 12px; display: flex; align-items: center; gap: 10px; opacity: 0.9; }
.auth-hero li::before { content: '✓'; color: #60a5fa; font-weight: 900; }

.auth-card {
  width: 400px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

@media (max-width: 768px) { .auth-card { width: 100%; } }

.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 24px; color: #111827; }

/* =========================================
   7. FORM ELEMENTS
   ========================================= */
.form-grid { display: flex; flex-direction: column; gap: 16px; }
.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.2s;
  background: #fff;
  color: #111827;
}
.input:focus { outline: none; border-color: #3b82f6; ring: 2px solid rgba(59,130,246,0.2); }
.input-sm { padding: 6px 10px; font-size: 13px; }

label { font-size: 14px; font-weight: 600; color: #374151; margin-bottom: -10px; }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-primary { background: #3b82f6; color: #fff; }
.btn-primary:hover { background: #2563eb; }
.btn-danger { background: #dc2626; color: #fff; }
.btn-danger:hover { background: #b91c1c; }

.muted { color: #6b7280; font-size: 14px; }
.text-center { text-align: center; }

/* Admin Header/Toolbar fixes */
.admin-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}

.toolbar-right { display: flex; gap: 12px; align-items: center; }
.search-form { display: flex; gap: 8px; }

.thumb-xs { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
