/* ==========================================================================
   CBTfied Classic Professional Admin Theme - Emerald Green Theme
   ========================================================================== */

:root {
  --admin-sidebar-bg: #064e3b;
  --admin-sidebar-text: #a7f3d0;
  --admin-sidebar-hover: #047857;
  --admin-sidebar-active: #10b981;
  --admin-sidebar-active-text: #ffffff;
  --admin-header-bg: #ffffff;
  --admin-body-bg: #f0fdf4;
  --admin-card-bg: #ffffff;
  --admin-primary: #059669;
  --admin-primary-hover: #047857;
  --admin-secondary: #64748b;
  --admin-success: #10b981;
  --admin-warning: #f59e0b;
  --admin-danger: #ef4444;
  --admin-border: #e2e8f0;
  --admin-text-main: #064e3b;
  --admin-text-muted: #475569;
  --admin-font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body.admin-body {
  font-family: var(--admin-font);
  background-color: var(--admin-body-bg);
  color: var(--admin-text-main);
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Layout Architecture */
.admin-wrapper {
  display: flex;
  min-height: 100vh;
}

/* Sidebar Styling */
.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 260px;
  background-color: var(--admin-sidebar-bg);
  color: var(--admin-sidebar-text);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1040;
}

.admin-sidebar .sidebar-brand {
  height: 70px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
}

.admin-sidebar .sidebar-brand .brand-logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.admin-sidebar .sidebar-brand .brand-name {
  font-size: 1.25rem;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.02em;
}

.admin-sidebar .sidebar-brand .brand-badge {
  font-size: 0.65rem;
  background: rgba(52, 211, 153, 0.2);
  color: #6ee7b7;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-weight: 700;
  text-transform: uppercase;
}

.admin-sidebar .sidebar-menu {
  padding: 1.25rem 0.75rem;
  flex-grow: 1;
  overflow-y: auto;
}

.admin-sidebar .menu-header {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6ee7b7;
  padding: 0.75rem 0.75rem 0.4rem;
  opacity: 0.8;
}

.admin-sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--admin-sidebar-text);
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  margin-bottom: 0.25rem;
}

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

.admin-sidebar .nav-link.active {
  background-color: var(--admin-sidebar-active);
  color: var(--admin-sidebar-active-text);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.admin-sidebar .nav-link i {
  font-size: 1.1rem;
  width: 22px;
  text-align: center;
}

.admin-sidebar .sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.75rem;
  color: #6ee7b7;
}

/* Main Content Area */
.admin-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Top Navbar Header */
.admin-header {
  height: 70px;
  background-color: var(--admin-header-bg);
  border-bottom: 1px solid #d1fae5;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
  box-shadow: 0 2px 10px rgba(5, 150, 105, 0.03);
}

.admin-header .header-search {
  max-width: 380px;
  width: 100%;
}

.admin-header .header-search .input-group {
  background-color: #ecfdf5;
  border-radius: 20px;
  padding: 0.25rem 0.75rem;
  border: 1px solid #a7f3d0;
  transition: all 0.2s ease;
}

.admin-header .header-search .input-group:focus-within {
  background-color: #ffffff;
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15);
}

.admin-header .header-search input {
  border: none;
  background: transparent;
  box-shadow: none !important;
  font-size: 0.875rem;
  color: #064e3b;
}

.admin-header .header-search input:focus {
  background: transparent;
}

.admin-header .header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.admin-header .user-profile-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.35rem 0.75rem;
  border-radius: 30px;
  border: 1px solid #a7f3d0;
  background-color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.admin-header .user-profile-btn:hover {
  background-color: #ecfdf5;
  border-color: #059669;
}

.admin-header .user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.admin-header .user-info {
  text-align: left;
  line-height: 1.2;
}

.admin-header .user-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--admin-text-main);
  display: block;
}

.admin-header .user-role {
  font-size: 0.7rem;
  color: var(--admin-primary);
  font-weight: 600;
}

/* Content Container */
.admin-content {
  padding: 2rem;
  flex-grow: 1;
}

/* Page Header & Breadcrumbs */
.page-title-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
}

.page-title-box h3 {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
  letter-spacing: -0.02em;
}

.page-title-box p {
  color: var(--admin-text-muted);
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

/* Metric Cards System */
.stat-card {
  background-color: var(--admin-card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  border: 1px solid #d1fae5;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.04);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px rgba(5, 150, 105, 0.08);
}

.stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  margin-bottom: 1rem;
}

.stat-card.primary .stat-icon {
  background-color: #d1fae5;
  color: #059669;
}

.stat-card.success .stat-icon {
  background-color: #a7f3d0;
  color: #047857;
}

.stat-card.info .stat-icon {
  background-color: #e0f2fe;
  color: #0284c7;
}

.stat-card.warning .stat-icon {
  background-color: #fef3c7;
  color: #d97706;
}

.stat-card .stat-label {
  font-size: 0.825rem;
  font-weight: 700;
  color: var(--admin-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}

.stat-card .stat-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--admin-text-main);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

/* Custom Table Card Styling */
.table-card {
  background-color: var(--admin-card-bg);
  border-radius: 16px;
  border: 1px solid #d1fae5;
  box-shadow: 0 4px 20px rgba(5, 150, 105, 0.04);
  overflow: hidden;
  margin-bottom: 2rem;
}

.table-card .card-header {
  padding: 1.25rem 1.75rem;
  background-color: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-card .card-title-group h4 {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--admin-text-main);
  margin: 0;
  letter-spacing: -0.01em;
}

.table-card .card-title-group span.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35em 0.75em;
  border-radius: 20px;
}

.table-card .table-responsive {
  margin: 0;
}

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

.table-card table thead th {
  background-color: #ecfdf5;
  color: #064e3b;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 1rem 1.75rem;
  border-bottom: 2px solid #a7f3d0;
  border-top: none;
  white-space: nowrap;
}

.table-card table tbody td {
  padding: 1.1rem 1.75rem;
  vertical-align: middle;
  color: #1e293b;
  font-size: 0.875rem;
  border-bottom: 1px solid #f1f5f9;
  transition: background-color 0.15s ease;
}

.table-card table tbody tr:hover td {
  background-color: #f0fdf4;
}

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

/* Badges System */
.badge-active {
  background-color: #dcfce7 !important;
  color: #15803d !important;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.35em 0.85em;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-inactive {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.35em 0.85em;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-info-pill {
  background-color: #e0f2fe !important;
  color: #0369a1 !important;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 0.35em 0.85em;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
}

/* Action Buttons */
.btn-edit-action {
  background-color: #fef3c7;
  color: #b45309;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  font-size: 0.775rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-edit-action:hover {
  background-color: #fde68a;
  color: #92400e;
}

.btn-delete-action {
  background-color: #fee2e2;
  color: #b91c1c;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  font-weight: 700;
  font-size: 0.775rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-delete-action:hover {
  background-color: #fca5a5;
  color: #991b1b;
}

/* Table Footer & Pagination */
.table-card .card-footer {
  padding: 1.25rem 1.75rem;
  background-color: #ffffff;
  border-top: 1px solid var(--admin-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

.table-card .card-footer nav .pagination {
  margin: 0;
  gap: 0.25rem;
}

.table-card .card-footer nav .pagination .page-item .page-link {
  border-radius: 8px !important;
  border: 1px solid var(--admin-border);
  color: var(--admin-text-main);
  font-weight: 600;
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
  transition: all 0.2s ease;
}

.table-card .card-footer nav .pagination .page-item.active .page-link {
  background-color: var(--admin-primary);
  border-color: var(--admin-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3);
}

.table-card .card-footer nav svg {
  width: 1rem;
  height: 1rem;
}

/* Green Theme Overrides for Bootstrap Primary Buttons */
.btn-primary {
  background-color: #059669 !important;
  border-color: #059669 !important;
  color: #ffffff !important;
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #047857 !important;
  border-color: #047857 !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.3) !important;
}

.btn-outline-primary {
  color: #059669 !important;
  border-color: #059669 !important;
}

.btn-outline-primary:hover {
  background-color: #059669 !important;
  color: #ffffff !important;
}

.bg-primary-subtle {
  background-color: #d1fae5 !important;
  color: #047857 !important;
}

.text-primary {
  color: #059669 !important;
}

/* ==========================================================================
   Mobile Responsiveness & Off-Canvas Drawer Styles
   ========================================================================== */

.text-emerald {
  color: #059669 !important;
}

.brand-logo-icon-sm {
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, #34d399 0%, #059669 100%);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1rem;
}

/* Sidebar Overlay Backdrop for Mobile */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(6, 78, 59, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1045;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* Medium & Small Devices (< 992px) */
@media (max-width: 991.98px) {
  .admin-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 270px;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
    z-index: 1055;
  }

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

  .admin-header {
    padding: 0 1rem;
  }

  .admin-content {
    padding: 1.25rem 1rem;
  }

  .page-title-box {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .page-title-box h3 {
    font-size: 1.25rem;
  }

  .table-card .card-header {
    padding: 1rem;
    flex-direction: column;
    align-items: stretch;
  }

  .table-card .card-header > div {
    width: 100%;
  }

  .table-card .card-header form {
    width: 100%;
  }

  .table-card .card-header form .input-group {
    width: 100% !important;
  }

  .table-card table thead th,
  .table-card table tbody td {
    padding: 0.85rem 1rem;
  }

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

  .table-card .card-footer {
    padding: 1rem;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
  }
}

/* Extra Small Devices (< 576px) */
@media (max-width: 575.98px) {
  .admin-header .user-profile-btn {
    padding: 0.25rem;
    border: none;
    background: transparent;
  }

  .admin-header .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
  }

  .stat-card {
    padding: 1.15rem;
  }

  .stat-card .stat-value {
    font-size: 1.5rem;
  }

  .btn-edit-action, .btn-delete-action {
    padding: 0.35rem 0.65rem;
    font-size: 0.725rem;
  }
}

