@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css');

/* Sidebar close button styling (Mobile only by default) */
#sidebar-close {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  margin-left: auto;
  transition: all 0.2s ease;
}

/* Custom CSS for Admin Panel */

:root {
  color-scheme: dark;
  --bg-dark: #0f172a;
  --surface: #1e293b;
  --surface-hover: #334155;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --danger: #ef4444;
  --success: #10b981;
  --nav-bg: rgba(8, 12, 25, 0.75); /* Unique dark glassy blue for sidebar/topbar */
  --border: #334155;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

:root.light-theme {
  color-scheme: light;
  --bg-dark: #cbd5e1; /* Fallback */
  --surface: #f1f5f9; /* Solid soft gray cards */
  --surface-hover: #f8fafc; /* Lighter soft gray on hover */
  --primary: #2563eb; /* Vibrant Blue */
  --primary-hover: #1d4ed8;
  --text-main: #0f172a;
  --text-muted: #475569;
  --danger: #ef4444; /* Vibrant Red */
  --success: #10b981;
  --nav-bg: #e2e8f0; /* Solid cool gray sidebar/topbar background */
  --border: rgba(148, 163, 184, 0.4); /* Clear border separation */
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-dark);
  color: var(--text-main);
  display: flex;
  min-height: 100vh;
}

:root.light-theme body {
  background: #cbd5e1; /* Solid slate gray background to eliminate gradients and eye strain */
  background-attachment: fixed;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
  position: fixed;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  text-decoration: none;
}

.sidebar-nav {
  padding: 20px 0;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-item {
  padding: 8px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
  border-left: 3px solid transparent;
}

.nav-heading {
  padding: 12px 20px 4px 20px;
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  opacity: 0.7;
}

.nav-item:hover,
.nav-item.active {
  background-color: var(--surface-hover);
  color: var(--text-main);
  border-left-color: var(--primary);
}

.nav-icon {
  font-size: 1.25rem;
  width: 24px;
  text-align: center;
}

/* Sidebar Dropdown Styling */
.nav-group {
  display: flex;
  flex-direction: column;
}

.dropdown-icon {
  margin-left: auto;
  font-size: 0.7rem;
  opacity: 0.5;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.dropdown-check:checked~.sub-menu {
  display: block !important;
}

.sub-menu {
  display: none;
  background-color: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.dropdown-check:checked+.dropdown-toggle .dropdown-icon {
  transform: rotate(180deg);
  opacity: 1;
}

.dropdown-toggle {
  cursor: pointer;
  user-select: none;
}

.sub-menu-inner {
  display: flex;
  flex-direction: column;
}

.sub-item {
  padding: 10px 20px 10px 56px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  position: relative;
  display: block;
}

.sub-item:hover,
.sub-item.active {
  color: var(--text-main);
  background-color: rgba(255, 255, 255, 0.05);
}

.sub-item::before {
  content: '\f105';
  /* FontAwesome chevron-right */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  left: 32px;
  top: 50%;
  font-size: 0.7rem;
  color: var(--border);
  transform: translateY(-50%);
  transition: all 0.2s ease;
}

.sub-item:hover::before,
.sub-item.active::before {
  color: var(--primary);
  text-shadow: 0 0 8px var(--primary);
}

/* Desktop Collapsed Sidebar (Pop-out Menu) */
@media (min-width: 769px) {
  .sidebar.sidebar-collapsed .dropdown-icon {
    display: none !important;
  }

  .sidebar.sidebar-collapsed .nav-group {
    position: relative;
  }

  .sidebar.sidebar-collapsed .sub-menu {
    display: block !important;
    position: absolute;
    left: 80px;
    /* Width of sidebar-collapsed sidebar */
    top: 0;
    width: 220px;
    background-color: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 0 10px 10px 0;
    border: 1px solid var(--border);
    border-left: none;
    box-shadow: 15px 0 35px rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-15px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 1000;
    grid-template-rows: 1fr !important;
    /* Always open if visible */
  }

  /* Only show on hover when sidebar-collapsed */
  .sidebar.sidebar-collapsed .nav-group:hover .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
  }

  /* Prevent checked state from showing sub-menu when sidebar-collapsed unless hovered */
  .sidebar.sidebar-collapsed .dropdown-check:checked~.sub-menu {
    grid-template-rows: 0fr !important;
    /* Hide the internal grid logic */
    opacity: 0;
    visibility: hidden;
  }

  .sidebar.sidebar-collapsed .nav-group:hover .dropdown-check:checked~.sub-menu {
    grid-template-rows: 1fr !important;
    opacity: 1;
    visibility: visible;
  }

  .sidebar.sidebar-collapsed .sub-menu-inner {
    padding: 10px 0;
  }

  .sidebar.sidebar-collapsed .sub-item {
    padding: 12px 20px 12px 40px;
    white-space: nowrap;
  }

  .sidebar.sidebar-collapsed .sub-item::before {
    left: 20px;
  }

  .sidebar.sidebar-collapsed .nav-group label.nav-item {
    justify-content: center;
    padding: 15px 0;
    margin: 0;
    border-left: 3px solid transparent;
  }

  .sidebar.sidebar-collapsed .nav-group label.nav-item i.nav-icon {
    margin: 0;
  }
}

/* Mobile Sidebar Specifics */
@media (max-width: 768px) {
  .sub-menu {
    background-color: rgba(0, 0, 0, 0.2);
    position: relative !important;
    left: 0 !important;
    width: 100% !important;
    transform: none !important;
    box-shadow: none !important;
  }

  /* Ensure it only opens when checked on mobile */
  .dropdown-check:not(:checked)~.sub-menu {
    grid-template-rows: 0fr !important;
  }

  .sub-item {
    padding-left: 50px;
  }
}

/* Main Content */
.main-content {
  flex-grow: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: calc(100% - 260px);
  transition: margin-left 0.3s ease, width 0.3s ease;
}


/* Topbar */
.topbar {
  height: 70px;
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 90;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  flex: 1;
  min-width: 0;
}

.topbar-left > span, 
.topbar-left > div:not(.menu-toggle) {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Adjust font size on smaller screens */
@media (max-width: 768px) {
  .topbar-left > span {
    font-size: 13px !important;
    letter-spacing: 0.5px !important;
    margin-left: 0 !important;
  }
}

.menu-toggle {
  background: none;
  border: none;
  color: var(--text-main);
  font-size: 1.5rem;
  cursor: pointer;
  display: block;
  /* Always show */
}

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

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
}

/* Page Content */
.page-container {
  padding: 30px;
  flex-grow: 1;
  overflow-x: hidden;
  max-width: 100%;
}

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

.page-title {
  font-size: 1.5rem;
  font-weight: 600;
}

.btn {
  padding: 10px 20px;
  border-radius: 6px;
  border: none;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

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

.btn-danger {
  background-color: var(--danger);
  color: white;
}

/* Dashboard Cards */
.dash-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}

.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  max-width: 100%;
  overflow: hidden;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 5px;
}

.stat-info p {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

/* Tables */
.table-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}
.table-container table {
  min-width: 850px;
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 8px;
  /* Adds space between rows like distinct cards */
  text-align: left;
}

.admin-table th {
  padding: 12px 20px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: none;
}

/* Beautiful Row Design */
.admin-table tbody tr {
  background-color: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: fadeInRow 0.4s ease forwards;
  opacity: 0;
  transform: translateY(10px);
}

.admin-table tbody tr:hover {
  background-color: rgba(59, 130, 246, 0.1);
  /* Slight primary tint */
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.admin-table td {
  padding: 16px 20px;
  border-bottom: none;
}

.admin-table td:first-child {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}

.admin-table td:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Stagger Animation */
.admin-table tbody tr:nth-child(1) {
  animation-delay: 0.05s;
}

.admin-table tbody tr:nth-child(2) {
  animation-delay: 0.1s;
}

.admin-table tbody tr:nth-child(3) {
  animation-delay: 0.15s;
}

.admin-table tbody tr:nth-child(4) {
  animation-delay: 0.2s;
}

.admin-table tbody tr:nth-child(5) {
  animation-delay: 0.25s;
}

@keyframes fadeInRow {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.action-btns {
  display: flex;
  gap: 10px;
}

.btn-icon {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  transition: color 0.2s;
}

.btn-icon:hover {
  color: var(--text-main);
}

.btn-icon.edit:hover {
  color: var(--primary);
}

.btn-icon.delete:hover {
  color: var(--danger);
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 12px 15px;
  background-color: var(--bg-dark);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-main);
  font-size: 1rem;
  transition: border-color 0.2s;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--surface);
  border-radius: 10px;
  width: 100%;
  max-width: 500px;
  padding: 30px;
  border: 1px solid var(--border);
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

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

.close-modal {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

/* Login Page specific */
.login-body {
  align-items: center;
  justify-content: center;
  background-image: radial-gradient(circle at center, var(--surface) 0%, var(--bg-dark) 100%);
}

.login-box {
  background-color: var(--surface);
  padding: 40px;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border);
  text-align: center;
}

.login-logo {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 30px;
  color: var(--primary);
}

.login-btn {
  width: 100%;
  margin-top: 10px;
  padding: 12px;
  justify-content: center;
  font-size: 1rem;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success);
}

.badge-primary {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
}

/* Accordion and Tabs */
.settings-tabs {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.settings-tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  font-weight: 500;
  padding: 5px 10px;
}

.settings-tab-btn.active {
  color: var(--primary);
  border-bottom: 2px solid var(--primary);
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

.accordion {
  margin-top: 10px;
}

.accordion-item {
  border: 1px solid var(--border);
  margin-bottom: 15px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
}

.accordion-header {
  padding: 15px 20px;
  background-color: #0037c6;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  transition: background 0.3s;
}

.accordion-header:hover {
  background-color: #0028a3;
}

.accordion-icon {
  transition: transform 0.3s;
  font-size: 1.25rem;
}

.accordion-item.active .accordion-icon {
  transform: rotate(180deg);
}

.accordion-content {
  display: none;
  background: transparent;
  color: var(--text-main);
  padding: 5px 0;
}

.accordion-item.active .accordion-content {
  display: block;
}

.candidate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #e2e8f0;
  font-weight: 500;
  font-size: 0.95rem;
}

.candidate-row:last-child {
  border-bottom: none;
}

.candidate-row:hover {
  background-color: #f8fafc;
}

.candidate-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.candidate-date {
  color: #64748b;
  font-weight: 400;
  font-size: 0.9rem;
}

.btn-download {
  background: none;
  border: none;
  color: #0f172a;
  font-size: 1.2rem;
  cursor: pointer;
  transition: color 0.2s;
}

.btn-download:hover {
  color: #3b82f6;
}

/* Responsive */

/* Responsive */
@media (max-width: 768px) {
  #sidebar-close {
    display: block !important;
  }

  .sidebar {
    transform: translateX(-100%);
  }

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

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

  .menu-toggle {
    display: block;
  }

  .dash-cards {
    grid-template-columns: 1fr;
  }
}

/* --- PRELOADER --- */
.preloader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #07080a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100000;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-element {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 20px;
}

.loader-element::before,
.loader-element::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  animation: pulse-ring 1.5s ease-out infinite;
}

.loader-element::before {
  width: 100%;
  height: 100%;
  background: #FF3B30;
  opacity: 0.6;
  left: 0;
  top: 0;
}

.loader-element::after {
  width: 80%;
  height: 80%;
  background: #07080a;
  left: 10%;
  top: 10%;
  animation-delay: 0.2s;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.6);
    opacity: 1;
  }

  100% {
    transform: scale(1.5);
    opacity: 0;
  }
}

.preloader-logo {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 2px;
}

.preloader-logo .highlight {
  color: #FF3B30;
}


/* Sidebar Overlay for Mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.5);
  z-index: 95;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
  display: block;
  opacity: 1;
}


@media (min-width: 769px) {
  .main-content.main-expanded {
    margin-left: 80px;
    width: calc(100% - 80px);
  }

  .main-content:not(.main-expanded) {
    margin-left: 260px !important;
    width: calc(100% - 260px) !important;
  }

  .sidebar.sidebar-collapsed {
    width: 80px;
    transform: translateX(0);
  }

  .sidebar:not(.sidebar-collapsed) {
    width: 260px !important;
  }

  .sidebar.sidebar-collapsed .sidebar-logo,
  .sidebar.sidebar-collapsed .nav-text,
  .sidebar.sidebar-collapsed .portal-selector {
    display: none;
  }

  .sidebar.sidebar-collapsed .sidebar-header {
    justify-content: center;
    padding: 20px 0;
  }

  .sidebar.sidebar-collapsed .nav-item {
    justify-content: center;
    padding: 15px 0;
  }

  .sidebar.sidebar-collapsed .nav-icon {
    margin: 0;
    font-size: 1.5rem;
  }

  /* Hide close button on laptop/desktop */
  #sidebar-close {
    display: none !important;
  }
}

/* Tag Input Styles */
.tag {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  border: 1px solid rgba(59, 130, 246, 0.3);
  white-space: nowrap;
}

.tag i:hover {
  color: var(--text-main);
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}

::-webkit-scrollbar-track {
  background: var(--bg-dark);
}

::-webkit-scrollbar-thumb {
  background: var(--primary);
  border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
  background: #2563eb;
}

/* Custom Text Selection */
::selection {
  background: var(--primary);
  color: #ffffff;
}

::-moz-selection {
  background: var(--primary);
  color: #ffffff;
}

/* Responsive Table Scroll Overrides */
.fire-table-wrapper {
  overflow-x: auto !important;
  width: 100% !important;
  max-width: 100% !important;
  -webkit-overflow-scrolling: touch !important;
}

.fire-table-wrapper table,
.fire-table-wrapper .fire-table {
  min-width: 950px !important;
}

/* Hide 'View Site' button on screens 393px or narrower */
@media (max-width: 393px) {
    .topbar-right a[href*='index.php'] {
        display: none !important;
    }
}

/* Hide user name and page title on screens 392px or narrower, showing only the avatar/DP and menu toggle */
@media (max-width: 392px) {
    .admin-profile span:not(.avatar) {
        display: none !important;
    }
    .topbar-left span {
        display: none !important;
    }
}

/* Mobile overrides for wizard form grids and topbar center titles */
@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr !important;
        margin-right: 0 !important;
    }
    .entry-row {
        padding-right: 15px !important;
    }
    /* Admin Advance Money Amount/Type grid stack */
    .card .form-group[style*="grid-template-columns: 1fr 1fr"],
    .card .form-group[style*="grid-template-columns:1fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
    .form-meta {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 10px !important;
    }
    .form-meta .meta-badge {
        text-align: center !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    .topbar-center {
        display: none !important;
    }
    .topbar-left {
        flex: none !important;
    }
    .topbar-left span {
        display: inline-block !important;
        font-size: 0.85rem !important;
        margin-left: 10px !important;
        letter-spacing: 0.5px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 150px !important;
    }
    .topbar-right {
        flex: 1 !important;
        justify-content: flex-end !important;
    }
    
    /* Hide view site button on mobile completely */
    .topbar-right a[href*='index.php'],
    .topbar-right .btn-primary,
    .header-nav {
        display: none !important;
    }
    
    /* List Page Header stacking */
    .page-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 15px !important;
    }
    .page-header > div:last-child {
        width: 100% !important;
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 12px !important;
    }
    .page-header > div:last-child > div,
    .page-header > div:last-child > a,
    .page-header > div:last-child > button {
        flex: 1 1 calc(50% - 12px) !important;
        width: auto !important;
        min-width: 120px !important;
    }
    .page-header .search-container {
        width: auto !important;
        flex: 1 1 auto !important;
        min-width: 150px !important;
    }
    .page-header #sync-btn-container {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 0 !important;
    }
    .page-header button, .page-header .btn {
        justify-content: center !important;
    }
    
    /* Swipable tabs layout on mobile */
    .settings-tabs,
    .tabs {
        display: flex !important;
        overflow-x: auto !important;
        white-space: nowrap !important;
        -webkit-overflow-scrolling: touch !important;
        gap: 10px !important;
        padding-bottom: 8px !important;
    }
    .settings-tab-btn,
    .tab-btn {
        flex: 0 0 auto !important;
    }
    
    /* Horizontal scroll for all tables */
    .table-container,
    .table-scroll {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        width: 100% !important;
    }
    
    /* Hide SQL Download button on mobile */
    .btn-download-sql {
        display: none !important;
    }
    .page-container {
        padding: 15px !important;
    }
    .card {
        padding: 15px !important;
    }
}

/* Extra small mobile screen overrides for card/panel stats grids */
@media (max-width: 480px) {
    .card div[style*="grid-template-columns: repeat(3"],
    .card div[style*="grid-template-columns:repeat(3"] {
        grid-template-columns: 1fr !important;
    }
    .stat-row {
        grid-template-columns: 1fr !important;
    }
}
