/**
 * Linkeyz Design System v2.0
 * Modern dark theme design system for Agent Network
 * Consistent pixel-perfect design across all pages
 */

/* ============================================
   IMPORT FONTS
   ============================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ============================================
   CSS VARIABLES - DESIGN TOKENS
   ============================================ */
:root {
  /* ===COLORS - DARK THEME PRIMARY === */

  /* Background Colors - Dark Theme */
  --color-bg-main: #000000;           /* Main background */
  --color-bg-card: #111111;           /* Cards and containers - more visible */
  --color-bg-secondary: #1A1A1A;      /* Secondary elements */
  --color-bg-tertiary: #2A2A2A;       /* Tertiary elements */
  --color-bg-hover: #1F1F1F;          /* Solid hover - not transparent */
  --color-bg-active: #2A2A2A;         /* Solid active - not transparent */
  --color-bg-sidebar: #0D0D0D;        /* Dedicated sidebar background */
  --color-bg-input: #1A1A1A;

  /* Text Colors - Dark Theme */
  --color-text-primary: #FFFFFF;
  --color-text-secondary: #A0A0A0;
  --color-text-tertiary: #707070;
  --color-text-muted: #505050;

  /* Border Colors - Dark Theme */
  --color-border: #1A1A1A;
  --color-border-light: #2A2A2A;
  --color-border-medium: #3A3A3A;
  --color-border-focus: #4DD0C0;

  /* Accent Colors - Turquoise/Teal Primary */
  --color-primary: #4DD0C0;
  --color-primary-hover: #5DDFD0;
  --color-primary-dark: #3DB0A0;

  /* Secondary Accent - Orange for Admin */
  --color-secondary: #FF9F40;
  --color-secondary-hover: #FFB060;

  /* Status Colors */
  --color-success: #10B981;
  --color-success-light: #34D399;
  --color-warning: #F59E0B;
  --color-warning-light: #FBBF24;
  --color-error: #EF4444;
  --color-error-light: #F87171;
  --color-info: #3B82F6;
  --color-info-light: #60A5FA;

  /* Danger (consistent with error) */
  --color-danger: var(--color-error);
  --color-danger-hover: var(--color-error-light);

  /* Grayscale Palette */
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --black: #000000;

  /* Icon Colors */
  --icon-default: #A0A0A0;
  --icon-primary: var(--color-primary);

  /* === SPACING SYSTEM === */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;
  --space-5xl: 48px;
  --space-6xl: 64px;
  --space-7xl: 80px;
  --space-8xl: 96px;

  /* === TYPOGRAPHY === */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
  --font-family-mono: 'Courier New', 'Menlo', 'Monaco', 'Courier', monospace;

  /* Font Sizes */
  --font-size-10: 10px;
  --font-size-11: 11px;
  --font-size-12: 12px;
  --font-size-13: 13px;
  --font-size-14: 14px;
  --font-size-16: 16px;
  --font-size-18: 18px;
  --font-size-20: 20px;
  --font-size-24: 24px;
  --font-size-28: 28px;
  --font-size-32: 32px;
  --font-size-40: 40px;
  --font-size-48: 48px;

  /* Font Weights */
  --font-weight-light: 300;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800;
  --font-weight-black: 900;

  /* Line Heights */
  --line-height-tight: 1.2;
  --line-height-snug: 1.375;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;
  --line-height-loose: 2;

  /* === BORDER RADIUS === */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 20px;
  --radius-3xl: 24px;
  --radius-full: 9999px;

  /* === SHADOWS === */
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px -1px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6), 0 4px 6px -4px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.7);
  --shadow-glow-primary: 0 0 20px rgba(77, 208, 192, 0.3);
  --shadow-glow-secondary: 0 0 20px rgba(255, 159, 64, 0.3);

  /* === TRANSITIONS === */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

  /* === Z-INDEX LAYERS === */
  --z-base: 0;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;

  /* === LAYOUT === */
  --sidebar-width: 220px;
  --sidebar-collapsed-width: 64px;
  --header-height: 64px;
  --container-max-width: 1600px;
  --card-min-width: 200px;
  --card-max-width: 250px;
}

/* ============================================
   GLOBAL RESETS & BASE STYLES
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  scroll-behavior: smooth;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-16);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-normal);
  color: var(--color-text-primary);
  background: var(--color-bg-main);
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

/* ============================================
   TYPOGRAPHY UTILITIES
   ============================================ */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  color: var(--color-text-primary);
  margin: 0;
}

h1 { font-size: var(--font-size-40); font-weight: var(--font-weight-extrabold); }
h2 { font-size: var(--font-size-32); font-weight: var(--font-weight-bold); }
h3 { font-size: var(--font-size-28); font-weight: var(--font-weight-bold); }
h4 { font-size: var(--font-size-24); font-weight: var(--font-weight-semibold); }
h5 { font-size: var(--font-size-20); font-weight: var(--font-weight-semibold); }
h6 { font-size: var(--font-size-18); font-weight: var(--font-weight-semibold); }

p {
  color: var(--color-text-secondary);
  line-height: var(--line-height-relaxed);
  margin: 0;
}

a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--color-primary-hover);
}

strong {
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
}

/* ============================================
   BUTTON STYLES
   ============================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-2xl);
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family);
  line-height: 1;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  user-select: none;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Button Variants */
.btn-primary {
  background: var(--color-primary);
  color: var(--color-bg-main);
  border: none;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  color: var(--color-bg-main);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(77, 208, 192, 0.4);
}

.btn-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-light);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-bg-tertiary);
  border-color: var(--color-primary);
  color: var(--color-text-primary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-primary);
  border: 1px solid transparent;
}

.btn-ghost:hover:not(:disabled) {
  background: var(--color-bg-hover);
  border-color: var(--color-border);
  color: var(--color-text-primary);
}

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

.btn-danger:hover:not(:disabled) {
  background: var(--color-danger-hover);
  transform: translateY(-2px);
}

/* Button Sizes */
.btn-sm {
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-12);
}

.btn-lg {
  padding: var(--space-lg) var(--space-3xl);
  font-size: var(--font-size-16);
}

.btn-full {
  width: 100%;
}

/* ============================================
   CARD STYLES
   ============================================ */
.card {
  background: var(--color-bg-card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: var(--space-2xl);
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.card-secondary {
  background: var(--color-bg-secondary);
}

.card-no-hover:hover {
  transform: none;
  box-shadow: none;
}

/* Stat Card Specific */
.stat-card {
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  min-width: var(--card-min-width);
  max-width: var(--card-max-width);
  text-align: center;
  transition: all var(--transition-normal);
}

.stat-card:hover {
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.stat-card-icon {
  font-size: var(--font-size-32);
  margin-bottom: var(--space-md);
  filter: grayscale(0%);
}

.stat-card-value {
  font-size: var(--font-size-28);
  font-weight: var(--font-weight-bold);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
  line-height: 1;
}

.stat-card-label {
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
  margin-bottom: var(--space-xl);
}

.form-label {
  display: block;
  font-size: var(--font-size-14);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  margin-bottom: var(--space-sm);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: var(--space-md) var(--space-lg);
  font-size: var(--font-size-14);
  font-family: var(--font-family);
  color: var(--color-text-primary);
  background: var(--color-bg-input);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  background: var(--color-bg-secondary);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-tertiary);
}

.form-textarea {
  min-height: 120px;
  resize: vertical;
}

/* ============================================
   BADGE & STATUS INDICATORS
   ============================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--font-size-12);
  font-weight: var(--font-weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1;
}

.badge-success {
  background: rgba(16, 185, 129, 0.2);
  color: var(--color-success-light);
  border: 1px solid var(--color-success);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.2);
  color: var(--color-warning-light);
  border: 1px solid var(--color-warning);
}

.badge-error {
  background: rgba(239, 68, 68, 0.2);
  color: var(--color-error-light);
  border: 1px solid var(--color-error);
}

.badge-info {
  background: rgba(59, 130, 246, 0.2);
  color: var(--color-info-light);
  border: 1px solid var(--color-info);
}

.badge-primary {
  background: rgba(77, 208, 192, 0.2);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

.badge-secondary {
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  border: 1px solid var(--color-border-light);
}

/* ============================================
   GRID LAYOUTS
   ============================================ */
.grid-auto-fill {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr));
  gap: var(--space-2xl);
}

.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--card-min-width), 1fr));
  gap: var(--space-2xl);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2xl);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2xl);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-2xl);
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

/* Spacing Utilities */
.m-0 { margin: 0; }
.mt-xs { margin-top: var(--space-xs); }
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mt-3xl { margin-top: var(--space-3xl); }

.mb-xs { margin-bottom: var(--space-xs); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }
.mb-3xl { margin-bottom: var(--space-3xl); }

.p-0 { padding: 0; }
.p-xs { padding: var(--space-xs); }
.p-sm { padding: var(--space-sm); }
.p-md { padding: var(--space-md); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }
.p-2xl { padding: var(--space-2xl); }
.p-3xl { padding: var(--space-3xl); }

/* Display */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.grid { display: grid; }
.hidden { display: none; }
.block { display: block; }
.inline { display: inline; }
.inline-block { display: inline-block; }

/* Flex Utilities */
.flex-col { flex-direction: column; }
.flex-row { flex-direction: row; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }
.gap-2xl { gap: var(--space-2xl); }

/* Text Utilities */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-primary { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-accent { color: var(--color-primary); }

.font-light { font-weight: var(--font-weight-light); }
.font-normal { font-weight: var(--font-weight-normal); }
.font-medium { font-weight: var(--font-weight-medium); }
.font-semibold { font-weight: var(--font-weight-semibold); }
.font-bold { font-weight: var(--font-weight-bold); }
.font-extrabold { font-weight: var(--font-weight-extrabold); }

.text-xs { font-size: var(--font-size-12); }
.text-sm { font-size: var(--font-size-14); }
.text-base { font-size: var(--font-size-16); }
.text-lg { font-size: var(--font-size-18); }
.text-xl { font-size: var(--font-size-20); }
.text-2xl { font-size: var(--font-size-24); }
.text-3xl { font-size: var(--font-size-28); }
.text-4xl { font-size: var(--font-size-32); }

.uppercase { text-transform: uppercase; }
.lowercase { text-transform: lowercase; }
.capitalize { text-transform: capitalize; }

/* Width & Height */
.w-full { width: 100%; }
.w-auto { width: auto; }
.h-full { height: 100%; }
.h-auto { height: auto; }

/* Border Radius */
.rounded-xs { border-radius: var(--radius-xs); }
.rounded-sm { border-radius: var(--radius-sm); }
.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Cursor */
.cursor-pointer { cursor: pointer; }
.cursor-not-allowed { cursor: not-allowed; }

/* Transitions */
.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.animate-fade-in {
  animation: fadeIn var(--transition-normal) ease-out;
}

.animate-slide-in {
  animation: slideIn var(--transition-normal) ease-out;
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* ============================================
   SCROLLBAR STYLING (DARK THEME)
   ============================================ */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-border-medium);
}

/* Firefox Scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-bg-tertiary) var(--color-bg-card);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Extra Large Screens (1440px+) - Desktop HD */
@media (min-width: 1441px) {
  :root {
    --container-max-width: 1600px;
  }
}

/* Large Screens (1280px-1440px) - Desktop */
@media (max-width: 1440px) {
  :root {
    --container-max-width: 1400px;
  }
}

@media (max-width: 1280px) {
  :root {
    --container-max-width: 1200px;
  }
}

/* Medium Screens (1024px) - Tablets Landscape & Small Desktops */
@media (max-width: 768px) {
  :root {
    --container-max-width: 960px;
    --sidebar-width: 200px;
  }

  /* Admin Layout - Sidebar */
  .admin-layout {
    grid-template-columns: 1fr !important;
  }

  .admin-sidebar {
    position: fixed;
    top: 0;
    left: -220px;
    bottom: 0;
    width: 220px;
    transition: left var(--transition-normal);
    z-index: var(--z-modal);
    box-shadow: var(--shadow-xl);
  }

  .admin-sidebar.open {
    left: 0;
  }

  .admin-main {
    width: 100%;
  }

  /* Grids */
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
  }

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

  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  /* Stats Cards */
  .admin-stat-card,
  .stat-card {
    min-width: auto;
  }

  /* Tables */
  .admin-table-container {
    overflow-x: auto;
  }

  /* Action Buttons */
  .action-buttons {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .action-buttons .action-btn {
    width: 100%;
  }
}

/* Tablets (768px) - Portrait & Small Landscape */
@media (max-width: 768px) {
  html {
    font-size: 14px;
  }

  :root {
    --container-max-width: 100%;
    --space-2xl: 16px;
    --space-3xl: 20px;
    --space-4xl: 24px;
    --space-5xl: 32px;
  }

  body {
    padding: 0;
  }

  /* Typography */
  h1 { font-size: var(--font-size-28) !important; }
  h2 { font-size: var(--font-size-24) !important; }
  h3 { font-size: var(--font-size-20) !important; }
  h4 { font-size: var(--font-size-18) !important; }

  /* Grids - All single column */
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-auto-fill,
  .grid-auto-fit,
  .stats-grid,
  .details-grid,
  .form-grid,
  .quick-actions-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-md) !important;
  }

  /* Admin Layout */
  .admin-content {
    padding: var(--space-lg) !important;
  }

  .admin-topbar {
    padding: var(--space-md) var(--space-lg) !important;
  }

  .admin-topbar__breadcrumb {
    font-size: var(--font-size-12);
  }

  /* Dashboard Header */
  .dashboard-header,
  .agent-header,
  .listing-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: var(--space-lg) !important;
    padding: var(--space-lg) !important;
  }

  .listing-header__actions,
  .agent-header__actions {
    width: 100%;
    flex-direction: column;
  }

  .btn-edit,
  .action-btn {
    width: 100%;
    justify-content: center;
  }

  /* Cards */
  .form-card,
  .detail-card,
  .listing-card,
  .action-card {
    padding: var(--space-lg) !important;
  }

  /* Stats Cards - Stack vertically */
  .admin-stat-card__header {
    flex-direction: row;
    justify-content: space-between;
  }

  /* Tables */
  table {
    font-size: var(--font-size-12);
  }

  th, td {
    padding: var(--space-sm) !important;
  }

  /* Forms */
  .form-container {
    padding: var(--space-lg) !important;
  }

  .form-input,
  .form-select,
  .form-textarea {
    font-size: var(--font-size-14);
    padding: var(--space-sm) var(--space-md) !important;
  }

  .button-group {
    flex-direction: column;
    width: 100%;
  }

  .button-group .submit-button,
  .button-group .cancel-button {
    width: 100%;
  }

  /* Photos/Images */
  .photos-grid,
  .current-images {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: var(--space-sm) !important;
  }

  /* Sidebar */
  .admin-sidebar {
    width: 200px;
    left: -200px;
  }

  .admin-sidebar__brand {
    font-size: var(--font-size-16);
  }

  .admin-sidebar__link {
    padding: var(--space-sm) var(--space-md) !important;
    font-size: var(--font-size-14);
  }

  /* Referrals/Activity */
  .referral-card,
  .activity-item {
    padding: var(--space-md) !important;
  }

  .referral-info {
    grid-template-columns: 1fr !important;
    gap: var(--space-xs) !important;
    font-size: var(--font-size-12);
  }

  /* Meta Information */
  .listing-meta,
  .meta-item {
    flex-direction: column;
    gap: var(--space-xs);
  }

  /* Checkboxes */
  .checkbox-group {
    grid-template-columns: 1fr !important;
  }
}

/* Mobile (480px) - Large Phones */
@media (max-width: 480px) {
  html {
    font-size: 13px;
  }

  :root {
    --space-xl: 12px;
    --space-2xl: 16px;
    --space-3xl: 20px;
  }

  /* Typography - Further reduced */
  h1 { font-size: var(--font-size-24) !important; }
  h2 { font-size: var(--font-size-20) !important; }
  h3 { font-size: var(--font-size-18) !important; }

  /* Layout */
  .admin-content,
  .form-container {
    padding: var(--space-md) !important;
  }

  .form-card,
  .detail-card {
    padding: var(--space-md) !important;
    border-radius: var(--radius-md);
  }

  /* Stats */
  .admin-stat-card__value,
  .stat-number {
    font-size: var(--font-size-24) !important;
  }

  .admin-stat-card__label,
  .stat-label {
    font-size: var(--font-size-12) !important;
  }

  /* Buttons */
  .btn,
  .action-btn,
  .submit-button {
    padding: var(--space-sm) var(--space-lg) !important;
    font-size: var(--font-size-14) !important;
  }

  /* Photos - Single column on very small screens */
  .photos-grid,
  .current-images {
    grid-template-columns: 1fr !important;
  }

  /* Back Button */
  .back-button,
  .back-btn {
    padding: var(--space-sm) var(--space-md) !important;
    font-size: var(--font-size-13);
  }

  /* Tables - Minimal */
  table {
    font-size: var(--font-size-11);
  }

  th, td {
    padding: var(--space-xs) !important;
  }

  /* Modal/Dialogs */
  .modal-content {
    width: 95vw !important;
    margin: var(--space-sm);
  }
}

/* Extra Small Mobile (360px) - Small Phones */
@media (max-width: 360px) {
  html {
    font-size: 12px;
  }

  .admin-content {
    padding: var(--space-sm) !important;
  }

  .form-card {
    padding: var(--space-sm) !important;
  }

  /* Compact stat cards */
  .stats-grid {
    gap: var(--space-sm) !important;
  }

  .admin-stat-card {
    padding: var(--space-sm) !important;
  }
}

/* ============================================
   AGENT SIDEBAR - GLOBAL STYLES
   ============================================ */
.agent-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 220px;
  height: 100vh;
  background: #0D0D0D !important;  /* Solid dark background - more visible than pure black */
  border-right: 1px solid #1A1A1A;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  z-index: 150;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.5);  /* Subtle shadow for depth */
}

.agent-sidebar__header {
  padding: var(--space-xl) var(--space-lg);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: #0D0D0D;  /* Match sidebar background */
}

.agent-sidebar__nav {
  flex: 1;
  padding: var(--space-lg) 0;
  background: #0D0D0D;  /* Match sidebar background */
}

.agent-sidebar__link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-lg);
  color: var(--color-text-secondary);
  text-decoration: none;
  transition: all var(--transition-fast);
  border-left: 3px solid transparent;
}

.agent-sidebar__link:hover {
  background: #1A1A1A;  /* Solid hover color - not transparent */
  color: var(--color-text-primary);
}

.agent-sidebar__link--active {
  background: #1A1A1A;  /* Solid active color - not transparent */
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

.agent-sidebar__footer {
  padding: var(--space-lg);
  border-top: 1px solid var(--color-border);
  background: #0D0D0D;  /* Match sidebar background */
  margin-top: auto;
}

/* ============================================
   MOBILE HAMBURGER MENU
   ============================================ */

/* Hamburger Menu Button */
.hamburger-menu {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 100;  /* Lower than sidebar (150) so it stays behind when open */
  width: 44px;
  height: 44px;
  background: var(--color-bg-card);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  padding: 10px;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: all var(--transition-fast);
}

.hamburger-menu:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-primary);
}

.hamburger-menu span {
  display: block;
  width: 100%;
  height: 3px;
  background: var(--color-primary);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Hamburger animation when open */
.hamburger-menu.active span:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
}

.hamburger-menu.active span:nth-child(2) {
  opacity: 0;
}

.hamburger-menu.active span:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
}

/* HIDE hamburger completely when sidebar is open */
.hamburger-menu.active,
body.sidebar-open .hamburger-menu {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile Overlay - lighter background for better visibility */
.mobile-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 140;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-overlay.active {
  display: block;
  opacity: 1;
}

/* Sidebar Close Button - HIDDEN (close by clicking outside) */
.sidebar-close-btn {
  display: none !important;
  visibility: hidden !important;
}

/* Agent Sidebar Mobile Responsive */
@media (max-width: 768px) {
  .hamburger-menu {
    display: flex;
  }

  /* HIDE hamburger when sidebar is open */
  .hamburger-menu.active,
  body.sidebar-open .hamburger-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
  }

  .agent-sidebar,
  .monochrome-sidebar {
    left: -260px;
    transition: left 0.3s ease;
    z-index: 150 !important;
  }

  .agent-sidebar.open,
  .monochrome-sidebar.open {
    left: 0 !important;
    z-index: 150 !important;
  }

  .agent-main,
  .main-content {
    margin-left: 0 !important;
    padding-top: 70px !important;
  }

  /* Ensure main content doesn't shift when sidebar opens */
  body.sidebar-open {
    overflow: hidden;
  }
}

/* ============================================
   RTL SUPPORT
   ============================================ */
[dir="rtl"] {
  direction: rtl;
}

[dir="rtl"] .hamburger-menu {
  left: auto;
  right: 16px;
}

[dir="rtl"] .agent-sidebar {
  left: auto;
  right: -260px;
}

[dir="rtl"] .agent-sidebar.open {
  right: 0;
}

[dir="rtl"] .sidebar {
  left: auto;
  right: 0;
}

/* ============================================
   SIDEBAR OVERLAY - MOBILE FIX
   ============================================ */
/* Global fix: Prevent overlays from blocking clicks when inactive */
.sidebar-overlay,
.mobile-overlay {
  pointer-events: none;
}

.sidebar-overlay.active,
.sidebar-overlay.show,
.mobile-overlay.active,
.mobile-overlay.show {
  pointer-events: auto;
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Focus Visible */
*:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* ============================================
   SKELETON LOADERS
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
    var(--color-bg-secondary) 25%,
    var(--color-bg-tertiary) 50%,
    var(--color-bg-secondary) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 1rem;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
}

.skeleton-text.short {
  width: 60%;
}

.skeleton-text.medium {
  width: 80%;
}

.skeleton-title {
  height: 1.5rem;
  width: 70%;
  margin-bottom: 0.75rem;
  border-radius: var(--radius-sm);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-card {
  height: 120px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-md);
}

.skeleton-image {
  width: 100%;
  height: 200px;
  border-radius: var(--radius-md);
}

.skeleton-row {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
}

.skeleton-row .skeleton-avatar {
  flex-shrink: 0;
}

.skeleton-row .skeleton-content {
  flex: 1;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Loading spinner alternative */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--color-text-secondary);
}

.loading-spinner::before {
  content: '';
  width: 20px;
  height: 20px;
  border: 2px solid var(--color-border-light);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Reduce Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
