/* DESIGN SYSTEM TOKENS — PHS Admin 2026 Redesign (Matching phs-admin-mockup.html) */
:root {
  /* Brand Palette (HomeSnap Blue) */
  --brand-900: #011C3A;   /* sidebar base */
  --brand-850: #01244A;
  --brand-800: #013063;
  --brand-700: #014C94;   /* PRIMARY brand blue */
  --brand-600: #0861AC;
  --brand-500: #1677C9;   /* hover / mid */
  --brand-100: #E6F0FA;
  --brand-50:  #F0F6FB;

  /* Hardware-store accent: brass fittings */
  --brass: #C69A4E;
  --brass-dim: #9C7A3B;

  /* Neutrals (blue-tinted) */
  --ink: #111827;
  --ink-soft: #374151;
  --muted: #6B7280;
  --muted-onDark: #9CA3AF;
  --line: #E5E7EB;
  --line-soft: #F3F4F6;
  --surface: #FFFFFF;
  --canvas: #F8FAFC;

  /* Semantics */
  --rust: #B0451F;
  --rust-bg: #FBEDE6;
  --amber: #96690D;
  --amber-bg: #FBF3E1;
  --ok: #1C4F39;          /* green for success */
  --ok-bg: #E4F0E9;

  --success: var(--ok);
  --warning: var(--amber);
  --danger: var(--rust);
  --info: var(--brand-600);

  /* Elevation & Borders */
  --shadow-sm: 0 1px 2px rgba(1,28,58,.06);
  --shadow-md: 0 6px 20px rgba(1,28,58,.08);
  --shadow-lg: 0 20px 48px rgba(1,28,58,.16);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius: var(--radius-md);

  --sidebar-w: 264px;
  --sidebar-w-collapsed: 80px;

  /* Legacy & Functional Token Aliases */
  --gray-900: var(--ink);
  --gray-700: var(--ink-soft);
  --gray-500: var(--muted);
  --gray-300: var(--line);
  --gray-100: var(--line-soft);
  --white: var(--surface);

  --primary: var(--brand-700);
  --primary-hover: var(--brand-500);
  --primary-glow: rgba(1, 76, 148, 0.15);
  --primary-light: var(--brand-100);
  --secondary: var(--brand-600);
  
  --bg-dark: var(--canvas);
  --bg-surface: var(--surface);
  --bg-glass: rgba(255, 255, 255, 0.85);
  
  --text-heading: var(--ink);
  --text-body: var(--ink-soft);
  --text-muted: var(--muted);
  
  --border: var(--line);
  --border-light: var(--line-soft);

  --error: var(--rust);
  --error-light: var(--rust-bg);
  --sidebar-bg: var(--brand-900);
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* RESET & BASE STYLES */
* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  background-color: var(--bg-dark);
  color: var(--text-body);
}

/* Custom Sleek Scrollbars Globally */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(147, 169, 156, 0.3);
  border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(147, 169, 156, 0.5);
}
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(147, 169, 156, 0.3) transparent;
}

body, .main-content, .sidebar, .page-header, .card, .modal, .form-input, .form-select, .form-textarea, .btn, .bento-card, .data-table td, .data-table th, .empty-state, .info-box, .search-bar {
  transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  font-family: 'Open Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-body);
  background: var(--bg-dark);
  display: flex;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* TYPOGRAPHY */
h1, h2, h3, h4, h5, h6 { color: var(--text-heading); letter-spacing: -0.02em; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.text-success { color: var(--success); }
.text-error { color: var(--error); }
.tabular-nums { font-variant-numeric: tabular-nums; font-weight: 600; }

/* LAYOUT */
.main-content {
  flex: 1;
  margin-left: 264px;
  padding: 0;
  min-height: 100vh;
  background: var(--bg-dark);
  transition: margin-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.sidebar-collapsed .main-content {
  margin-left: 80px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 32px;
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.page-body { padding: 32px; }

/* BREADCRUMB & TOPBAR ENHANCEMENTS */
.topbar-breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.topbar-breadcrumbs a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s;
}
.topbar-breadcrumbs a:hover {
  color: var(--primary);
}
.topbar-breadcrumbs span.sep {
  font-size: 11px;
  opacity: 0.6;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.search-trigger-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.search-trigger-btn:hover {
  border-color: var(--brand-500);
  color: var(--text-heading);
}
.search-trigger-btn svg, .search-trigger-btn i {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: var(--text-muted);
  flex-shrink: 0;
}
.search-trigger-btn kbd {
  background: var(--brand-50);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 600;
  font-family: inherit;
  color: var(--text-muted);
}

/* BUTTONS */
.btn {
  height: 40px;
  padding: 0 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { 
  background: var(--brand-700); 
  color: var(--white); 
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover { 
  background: var(--brand-500); 
  box-shadow: var(--shadow-md);
}
.btn-outline { 
  background: var(--bg-surface); 
  color: var(--text-heading); 
  border: 1px solid var(--border); 
}
.btn-outline:hover { 
  background: var(--brand-50);
  border-color: var(--brand-600); 
  color: var(--brand-700);
}
.btn-danger { background: var(--error-light); color: var(--error); border: 1px solid transparent; }
.btn-danger:hover { background: var(--error); color: white; }
.btn-sm { padding: 6px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-icon { 
  padding: 8px; 
  border-radius: var(--radius-sm); 
  background: var(--bg-surface); 
  border: 1px solid var(--border); 
  cursor: pointer; 
  color: var(--text-muted); 
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
}
.btn-icon:hover { 
  background: var(--brand-50); 
  border-color: var(--brand-600);
  color: var(--brand-700); 
}

/* CARDS & CONTAINERS */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

/* TABLES */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  text-align: left; padding: 14px 18px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--brand-50);
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
  color: var(--text-body);
}
.data-table tr { transition: var(--transition); }
.data-table tr:hover { background: var(--brand-50); }
.data-table tr:last-child td { border-bottom: none; }

/* FORM INPUTS & CUSTOM SELECT */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}
.form-input, .form-textarea {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px;
  color: var(--text-heading); 
  background: var(--bg-surface);
  outline: none; transition: var(--transition);
}
.form-select {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B766F' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px;
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-heading);
  background-color: var(--bg-surface);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.form-select:hover {
  border-color: var(--brand-500);
}
.form-input:focus, .form-select:focus, .form-textarea:focus { 
  border-color: var(--brand-700); 
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.form-select option { background: var(--bg-surface); color: var(--text-heading); }
.form-textarea { resize: vertical; min-height: 100px; }

/* CUSTOM SELECT COMPONENT */
.custom-select-wrapper {
  position: relative;
  display: inline-block;
  user-select: none;
  min-width: 170px;
}
.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-heading);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.custom-select-trigger:hover {
  border-color: var(--brand-500);
}
.custom-select-wrapper.open .custom-select-trigger {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.custom-select-chevron {
  width: 16px;
  height: 16px;
  stroke-width: 2;
  color: var(--text-muted);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.custom-select-wrapper.open .custom-select-chevron {
  transform: rotate(180deg);
  color: var(--brand-700);
}
.custom-select-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  width: max-content;
  max-width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 500;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}
.custom-select-wrapper.open .custom-select-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.custom-select-search-wrap {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--brand-50);
}
.custom-select-search-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-surface);
  color: var(--text-heading);
  font-size: 12.5px;
  outline: none;
}
.custom-select-search-input:focus {
  border-color: var(--brand-700);
}
.custom-select-options {
  max-height: 240px;
  overflow-y: auto;
  padding: 6px;
}
.custom-select-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-body);
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.custom-select-option:hover {
  background: var(--brand-50);
  color: var(--text-heading);
}
.custom-select-option.selected {
  background: var(--brand-100);
  color: var(--brand-700);
  font-weight: 700;
}
.custom-select-option .opt-check {
  width: 15px;
  height: 15px;
  stroke: var(--brand-700);
  stroke-width: 2.5;
}

/* TOGGLE SWITCH */
.toggle { position: relative; width: 44px; height: 24px; display: inline-block; }
.toggle input { display: none; }
.toggle-slider {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--gray-300); border-radius: 24px; cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border);
}
.toggle-slider:before {
  content: ""; position: absolute; width: 18px; height: 18px;
  left: 2px; bottom: 2px; background: white; border-radius: 50%;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.toggle input:checked + .toggle-slider { 
  background: var(--brand-700); 
  border-color: var(--brand-700);
}
.toggle input:checked + .toggle-slider:before { 
  transform: translateX(20px); 
}

/* SKELETON ANIMATIONS */
.skeleton-box {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--border) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* MODAL / DIALOG */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0;
  width: 100%; height: 100%; background: rgba(15, 23, 32, 0.65);
  backdrop-filter: blur(6px);
  z-index: 1000; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.25s ease;
}
.modal-overlay.active { display: flex; opacity: 1; }
.modal {
  background: var(--bg-surface); 
  color: var(--text-heading);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: 28px; max-width: 520px; width: 90%;
  box-shadow: var(--shadow-lg);
  transform: translateY(15px);
  transition: transform 0.25s ease, background-color 0.3s ease, color 0.3s ease;
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal h2, .modal h3 {
  color: var(--text-heading);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.modal .form-label {
  color: var(--text-muted);
}
.modal .form-input, .modal .form-select, .modal .form-textarea {
  background: var(--bg-dark);
  color: var(--text-heading);
  border: 1px solid var(--border);
}
.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

/* SNACKBAR / TOAST */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  padding: 14px 20px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: white;
  z-index: 2000; transform: translateY(80px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast-success { background: var(--brand-700); }
.toast-error { background: var(--danger); }
.toast-undo-btn {
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.4);
  color: white;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.toast-undo-btn:hover { background: rgba(255,255,255,0.3); }

/* LOADING SPINNER */
.spinner { width: 24px; height: 24px; border: 3px solid var(--border);
  border-top-color: var(--brand-700); border-radius: 50%;
  animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* REACTION & EMPTY / ERROR STATES */
.empty-state, .error-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
}
.empty-state-icon, .error-state-icon {
  width: 48px; height: 48px; margin-bottom: 16px; opacity: 0.6; stroke-width: 1.5;
}
.empty-state h3, .error-state h3 { margin-bottom: 8px; color: var(--text-heading); font-size: 18px; }
.error-state-icon { color: var(--danger); }

/* SEARCH BAR & FILTERS */
.search-bar {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface); 
  border: 1px solid var(--border);
  border-radius: var(--radius-sm); 
  padding: 8px 14px;
  transition: var(--transition);
}
.search-bar:focus-within {
  border-color: var(--brand-700);
  box-shadow: 0 0 0 3px var(--primary-glow);
}
.search-bar input {
  border: none; outline: none; font-size: 14px;
  font-family: inherit; flex: 1;
  background: transparent; color: var(--text-heading);
}
.search-bar input::placeholder { color: var(--text-muted); }

/* RESPONSIVE BREAKPOINTS */
@media (max-width: 992px) {
  .main-content { margin-left: 0 !important; width: 100% !important; }
  .sidebar-collapsed .main-content { margin-left: 0 !important; }
}

@media (max-width: 768px) {
  .page-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  }
  .header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
  }
  .topbar-breadcrumbs {
    display: none !important;
  }
  .page-header h1 {
    font-size: 15.5px !important;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
  }
  .page-header p.text-muted {
    display: none !important;
  }
  .topbar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .search-trigger-btn {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
  }
  .search-trigger-btn kbd {
    display: none !important;
  }
  .topbar-actions .btn {
    height: 36px;
    padding: 0 10px;
    font-size: 12px;
    gap: 4px;
  }
  .page-body {
    padding: 12px 10px;
  }
  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
  }
  .data-table th, .data-table td {
    padding: 8px 10px;
    font-size: 12px;
    white-space: nowrap;
  }
  .custom-select-wrapper {
    width: 100%;
  }
  .custom-select-dropdown {
    min-width: 100%;
    width: 100%;
    max-width: 100%;
  }
  .card {
    padding: 16px !important;
  }
  .bento-grid {
    grid-template-columns: 1fr !important;
  }
  .categories-grid, .banners-grid {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 640px) {
  .search-trigger-btn span {
    display: none !important;
  }
  .search-trigger-btn {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    justify-content: center;
    border-radius: var(--radius-sm);
    flex-shrink: 0;
  }
  #exportCsvBtn {
    display: none !important;
  }
  .topbar-actions .btn-outline {
    width: 34px;
    height: 34px;
    padding: 0 !important;
    justify-content: center;
    flex-shrink: 0;
  }
  .topbar-actions .btn-primary {
    height: 34px;
    padding: 0 10px !important;
    font-size: 12px;
    border-radius: var(--radius-sm);
  }
  .page-header h1 {
    font-size: 15px !important;
  }
}
