/*
 * Minimal CSS bundle for authentication pages
 * Only includes essential styles needed for login/signup pages
 *





 */

/* ========== Buttons ========== */

/* Reset Bootstrap button styles if present */
.btn,
.btn-default,
.btn-primary,
.btn-success,
.btn-info,
.btn-warning,
.btn-danger {
  /* Reset Bootstrap defaults */
  background-image: none !important;
  background-color: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  text-shadow: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

/* Default button base styles */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-2) var(--spacing-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  transition: all var(--transition-normal);
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
  vertical-align: middle;
  line-height: 1.5;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
}

.btn:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Button Color Variants - Shared white text */
.btn--primary,
.btn--submit,
.btn--create,
.btn--success,
.btn--edit,
.btn--filter,
.btn--danger {
  color: var(--color-white) !important;
  background-image: none !important;
  text-shadow: none !important;
}

/* Default Primary Button */
.btn--primary,
.btn--submit,
.btn-primary {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: var(--color-white) !important;
}

.btn--primary:hover:not(:disabled),
.btn--submit:hover:not(:disabled),
.btn-primary:hover:not(:disabled) {
  background-color: var(--color-primary-hover) !important;
  border-color: var(--color-primary-hover) !important;
  color: var(--color-white) !important;
}

.btn--primary:focus,
.btn--submit:focus,
.btn-primary:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.btn--full {
  width: 100%;
}

/* Button Responsive */
@media (max-width: 640px) {
  .btn {
    padding: var(--spacing-2) var(--spacing-3);
    font-size: var(--text-xs);
    min-height: 32px;
    height: auto;
    max-width: 100%;
  }
  
  .btn--primary,
  .btn-primary,
  .btn--submit {
    width: auto;
    max-width: 200px;
    min-width: auto;
    padding: var(--spacing-2) var(--spacing-3);
  }
}

/* ========== Forms ========== */

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  margin-bottom: var(--spacing-2);
  transition: color var(--transition-base);
}

.form-input,
.form-select,
.form-textarea,
.input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  display: block;
  width: 100%;
  padding: var(--spacing-1-5) var(--spacing-2-5);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--input-bg) !important;
  transition: border-color var(--transition-fast), background-color var(--transition-base), color var(--transition-base);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
input[type="tel"]::placeholder,
input[type="url"]::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
}

.form-input,
.form-select,
.form-textarea,
.input {
  display: block;
  width: 100%;
  padding: var(--spacing-1-5) var(--spacing-2-5);
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--input-bg);
  transition: border-color var(--transition-fast), background-color var(--transition-base), color var(--transition-base);
}

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

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

.form-checkbox,
.input--checkbox {
  width: var(--spacing-4);
  height: var(--spacing-4);
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-gray-300);
  transition: border-color var(--transition-fast);
}

.form-checkbox:focus,
.input--checkbox:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* ========== Password Toggle ========== */

.password-input-wrapper {
  position: relative;
  display: block;
}

.password-input-wrapper .form-input.password-input,
.password-input-wrapper input[type="password"],
.password-input-wrapper .form-input[type="password"] {
  padding-right: var(--spacing-10);
}

.password-toggle-btn {
  position: absolute;
  right: var(--spacing-2);
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: var(--spacing-1);
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition-fast);
  z-index: 10;
  width: 2rem;
  height: 2rem;
}

.password-toggle-btn:hover {
  color: var(--text-primary);
}

.password-toggle-btn:focus {
  outline: none;
  color: var(--color-primary);
}

.password-toggle-icon {
  width: 1.25rem;
  height: 1.25rem;
  stroke: currentColor;
  stroke-width: 1.5;
}

.password-toggle-icon--hidden {
  display: block;
}

.password-toggle-icon--visible {
  display: none;
}

/* ========== Auth Layout Styles ========== */

.auth-logo {
  width: 3rem;
  height: 3rem;
  background-color: var(--color-primary);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.auth-logo-text {
  color: var(--color-white);
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
}

.auth-page-body {
  background-color: var(--bg-secondary);
  min-height: 100vh;
  transition: background-color var(--transition-base);
}

.auth-page-title {
  margin-top: 1.5rem;
  text-align: center;
  font-size: 1.875rem;
  font-weight: var(--font-bold);
  letter-spacing: -0.025em;
  color: var(--text-primary);
  transition: color var(--transition-base);
}

.auth-page-subtitle {
  margin-top: 0.5rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color var(--transition-base);
}

.auth-page-card {
  background-color: var(--bg-primary);
  padding: 2rem 1rem;
  box-shadow: var(--shadow-lg);
  border-radius: 0.5rem;
  border: 1px solid var(--border-primary);
  transition: background-color var(--transition-base), border-color var(--transition-base);
}

@media (min-width: 640px) {
  .auth-page-card {
    border-radius: 0.5rem;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
  }
}

.auth-page-divider {
  width: 100%;
  border-top: 1px solid var(--border-secondary);
  transition: border-color var(--transition-base);
}

.auth-page-footer-text {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  transition: background-color var(--transition-base), color var(--transition-base);
}

.auth-page-link {
  font-size: 0.875rem;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
}

.auth-page-link:hover {
  color: var(--color-primary-hover);
}
/* ============================================================================
   CSS CUSTOM PROPERTIES (VARIABLES)
   Design System Foundation
   ============================================================================ */

:root {
  /* ========== Colors ========== */
  
  /* Primary Colors */
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-light: #3b82f6;
  --color-primary-bg: #eff6ff;
  --color-primary-border: #bfdbfe;
  
  /* Success Colors */
  --color-success: #16a34a;
  --color-success-hover: #15803d;
  --color-success-bg: #dcfce7;
  --color-success-text: #166534;
  --color-success-border: #bbf7d0;
  --color-success-light: rgb(34, 197, 94);    /* #22c55e */
  --color-success-icon-bg: rgb(220, 252, 231); /* #dcfce7 */
  --color-success-icon: rgb(22, 101, 52);      /* #166534 */
  
  /* Warning Colors */
  --color-warning: #854d0e;
  --color-warning-bg: #fef9c3;
  --color-warning-yellow: #fef3c7;
  --color-warning-yellow-text: #92400e;
  --color-warning-light: rgb(234, 179, 8);     /* #eab308 */
  --color-warning-orange: #d97706;
  --color-warning-border: #fde047;
  
  /* Danger/Error Colors */
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-danger-bg: #fee2e2;
  --color-danger-text: #b91c1c;
  --color-danger-border: #fca5a5;
  --color-danger-red: #f87171;
  
  /* Info Colors */
  --color-info: #1e40af;
  --color-info-bg: #dbeafe;
  --color-info-text: #1e40af;
  --color-info-border: #93c5fd;
  
  /* Purple Colors */
  --color-purple: #9333ea;
  --color-purple-bg: #f3e8ff;
  --color-purple-light: #faf5ff;
  --color-purple-border: #d8b4fe;
  --color-purple-dark: rgb(88, 28, 135);      /* #581c87 */
  --color-purple-medium: rgb(126, 34, 206);   /* #7e22ce */
  --color-purple-text: rgb(107, 33, 168);     /* #6b21a8 */
  
  /* Blue Scale */
  --color-blue-50: #eff6ff;
  --color-blue-100: #dbeafe;
  --color-blue-500: #3b82f6;
  --color-blue-600: rgb(59, 130, 246);
  --color-blue-700: #1d4ed8;
  
  /* Gray Scale */
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-gray-900: #111827;
  
  /* Green Scale */
  --color-green-50: #f0fdf4;
  --color-green-100: #dcfce7;
  --color-green-200: #d1fae5;
  --color-green-600: #16a34a;
  --color-green-700: #15803d;
  --color-green-800: #065f46;
  
  /* Yellow Scale */
  --color-yellow-50: #fefce8;
  --color-yellow-100: #fef3c7;
  --color-yellow-200: #fef08a;
  --color-yellow-500: #fbbf24;
  --color-yellow-600: #ca8a04;
  --color-yellow-700: #a16207;
  
  /* Red Scale */
  --color-red-50: #fef2f2;
  --color-red-100: #fee2e2;
  --color-red-500: #ef4444;
  --color-red-600: #dc2626;
  
  /* Orange Scale */
  --color-orange-50: #fff7ed;
  --color-orange-100: #ffedd5;
  
  /* Neutral Colors */
  --color-white: #ffffff;
  --color-black: #000000;
  
  /* ========== Spacing Scale ========== */
  --spacing-1: 0.2rem;    /* 3.2px */
  --spacing-1-5: 0.3rem;  /* 4.8px */
  --spacing-2: 0.4rem;    /* 6.4px */
  --spacing-2-5: 0.5rem;  /* 8px */
  --spacing-3: 0.625rem;  /* 10px */
  --spacing-4: 0.875rem;  /* 14px */
  --spacing-5: 1rem;      /* 16px */
  --spacing-6: 1.25rem;   /* 20px */
  --spacing-8: 1.75rem;   /* 28px */
  --spacing-10: 2rem;     /* 32px */
  --spacing-12: 2.5rem;   /* 40px */
  
  /* ========== Border Radius ========== */
  --radius-sm: 0.25rem;    /* 4px */
  --radius-md: 0.375rem;   /* 6px */
  --radius-lg: 0.5rem;     /* 8px */
  --radius-xl: 0.75rem;    /* 12px */
  --radius-2xl: 1rem;      /* 16px */
  --radius-full: 9999px;   /* Circular */
  
  /* ========== Typography ========== */
  
  /* Font Sizes - Desktop */
  --text-xs: 0.6875rem;   /* 11px */
  --text-sm: 0.8125rem;    /* 13px */
  --text-base: 0.9375rem;  /* 15px */
  --text-lg: 1.0625rem;   /* 17px */
  --text-xl: 1.1875rem;   /* 19px */
  --text-2xl: 1.375rem;   /* 22px */
  
  /* Font Sizes - Tablet (641px - 1024px) */
  --text-xs-tablet: 0.65rem;
  --text-sm-tablet: 0.75rem;
  --text-base-tablet: 0.875rem;
  --text-lg-tablet: 1rem;
  --text-xl-tablet: 1.125rem;
  --text-2xl-tablet: 1.25rem;
  
  /* Font Sizes - Mobile (max 640px) */
  --text-xs-mobile: 0.5625rem;
  --text-sm-mobile: 0.6875rem;
  --text-base-mobile: 0.8125rem;
  --text-lg-mobile: 0.9375rem;
  --text-xl-mobile: 1.0625rem;
  --text-2xl-mobile: 1.125rem;
  
  /* Font Weights */
  --font-normal: 400;
  --font-medium: 500;
  --font-semibold: 600;
  --font-bold: 700;
  
  /* ========== Shadows ========== */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  
  /* ========== Transitions ========== */
  --transition-fast: 0.15s ease-in-out;
  --transition-normal: 0.2s ease-in-out;
  --transition-base: 0.2s ease-in-out;  /* Alias for normal */
  
  /* ========== Effects ========== */
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.1);
  
  /* ========== Touch Targets (Mobile) ========== */
  --touch-target: 44px;
  --touch-target-sm: 40px;
  
  /* ========== Gradients ========== */
  --gradient-blue: linear-gradient(to right, #eff6ff, #dbeafe);
  --gradient-green: linear-gradient(to right, #f0fdf4, #d1fae5);
  --gradient-yellow: linear-gradient(to right, #fefce8, #fef3c7);
  --gradient-purple: linear-gradient(to right, #faf5ff, #f3e8ff);
  --gradient-gray: linear-gradient(to right, #f9fafb, #f3f4f6);
  --gradient-orange: linear-gradient(to right, #fff7ed, #ffedd5);
  
  /* ========== Responsive Breakpoints (for reference in media queries) ========== */
  /* Note: CSS variables can't be used directly in @media queries */
  /* Mobile:  max-width: 640px */
  /* Tablet:  min-width: 641px and max-width: 1024px */
  /* Desktop: min-width: 1025px */
  
  /* ========== Z-Index Scale ========== */
  --z-dropdown: 10;
  --z-sticky: 20;
  --z-fixed: 30;
  --z-modal-backdrop: 40;
  --z-modal: 50;

  /* ========== Background Colors ========== */
  --bg-primary: var(--color-white);
  --bg-secondary: var(--color-gray-50);
  --bg-tertiary: var(--color-gray-100);
  --bg-hover: var(--color-gray-100);
  --bg-active: var(--color-gray-200);
  
  /* Input Background */
  --input-bg: var(--color-white);

  /* ========== Text Colors ========== */
  --text-primary: var(--color-gray-900);
  --text-secondary: var(--color-gray-700);
  --text-tertiary: var(--color-gray-600);
  --text-muted: var(--color-gray-500);
  --text-inverse: var(--color-white);

  /* ========== Border Colors ========== */
  --border-primary: var(--color-gray-200);
  --border-secondary: var(--color-gray-300);
  --border-focus: var(--color-primary);
}

/* ========== Dark Mode Variables ========== */
[data-theme="dark"],
.dark {
  /* Primary Colors - Adjusted for dark mode */
  --color-primary: #3b82f6;
  --color-primary-hover: #60a5fa;
  --color-primary-light: #60a5fa;
  --color-primary-bg: rgba(59, 130, 246, 0.1);
  --color-primary-border: rgba(59, 130, 246, 0.3);

  /* Success Colors - Modern Blue/Cyan for Dark Mode */
  --color-success: #3b82f6;
  --color-success-hover: #60a5fa;
  --color-success-bg: rgba(59, 130, 246, 0.15);
  --color-success-text: #93c5fd;
  --color-success-border: rgba(59, 130, 246, 0.4);
  --color-success-light: #60a5fa;
  --color-success-icon-bg: rgba(59, 130, 246, 0.2);
  --color-success-icon: #93c5fd;

  /* Warning Colors */
  --color-warning: #fbbf24;
  --color-warning-bg: rgba(251, 191, 36, 0.1);
  --color-warning-yellow: rgba(251, 191, 36, 0.15);
  --color-warning-yellow-text: #fbbf24;
  --color-warning-light: #fbbf24;
  --color-warning-orange: #f59e0b;
  --color-warning-border: rgba(251, 191, 36, 0.3);

  /* Danger/Error Colors */
  --color-danger: #d00000;
  --color-danger-hover: #ef4444;
  --color-danger-bg: rgba(208, 0, 0, 0.15);
  --color-danger-text: #d00000;
  --color-danger-border: rgba(208, 0, 0, 0.4);
  --color-danger-light: #d00000;
  --color-danger-red: #d00000;

  /* Info Colors */
  --color-info: #60a5fa;
  --color-info-bg: rgba(96, 165, 250, 0.1);
  --color-info-text: #60a5fa;
  --color-info-border: rgba(96, 165, 250, 0.3);

  /* Purple Colors */
  --color-purple: #a78bfa;
  --color-purple-bg: rgba(167, 139, 250, 0.1);
  --color-purple-light: rgba(167, 139, 250, 0.05);
  --color-purple-border: rgba(167, 139, 250, 0.3);
  --color-purple-dark: #7c3aed;
  --color-purple-medium: #8b5cf6;
  --color-purple-text: #a78bfa;

  /* Blue Scale */
  --color-blue-50: rgba(59, 130, 246, 0.1);
  --color-blue-100: rgba(59, 130, 246, 0.15);
  --color-blue-500: #3b82f6;
  --color-blue-600: #93c5fd;
  --color-blue-700: #60a5fa;

  /* Gray Scale - Inverted for dark mode */
  --color-gray-50: #1f2937;
  --color-gray-100: #374151;
  --color-gray-200: #4b5563;
  --color-gray-300: #6b7280;
  --color-gray-400: #9ca3af;
  --color-gray-500: #d1d5db;
  --color-gray-600: #e5e7eb;
  --color-gray-700: #f3f4f6;
  --color-gray-800: #f9fafb;
  --color-gray-900: #ffffff;

  /* Green Scale */
  --color-green-50: rgba(34, 197, 94, 0.1);
  --color-green-100: rgba(34, 197, 94, 0.15);
  --color-green-200: rgba(34, 197, 94, 0.2);
  --color-green-600: #22c55e;
  --color-green-700: #16a34a;
  --color-green-800: #15803d;

  /* Yellow Scale */
  --color-yellow-50: rgba(251, 191, 36, 0.1);
  --color-yellow-100: rgba(251, 191, 36, 0.15);
  --color-yellow-200: rgba(251, 191, 36, 0.2);
  --color-yellow-500: #fbbf24;
  --color-yellow-600: #f59e0b;
  --color-yellow-700: #d97706;

  /* Red Scale */
  --color-red-50: rgba(239, 68, 68, 0.1);
  --color-red-100: rgba(239, 68, 68, 0.15);
  --color-red-500: #ef4444;
  --color-red-600: #dc2626;

  /* Orange Scale */
  --color-orange-50: rgba(251, 146, 60, 0.1);
  --color-orange-100: rgba(251, 146, 60, 0.15);

  /* Neutral Colors */
  --color-white: #111827;
  --color-black: #f9fafb;

  /* Background Colors */
  --bg-primary: #111827;
  --bg-secondary: #1f2937;
  --bg-tertiary: #374151;
  --bg-hover: #374151;
  --bg-active: #4b5563;
  
  /* Input Background */
  --input-bg: #1f2937;

  /* Text Colors */
  --text-primary: #f9fafb;
  --text-secondary: #e5e7eb;
  --text-tertiary: #d1d5db;
  --text-muted: #9ca3af;
  --text-inverse: #111827;

  /* Border Colors */
  --border-primary: #374151;
  --border-secondary: #4b5563;
  --border-focus: var(--color-primary);

  /* Shadows - Adjusted for dark mode */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.4), 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
  --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.5);

  /* Focus Ring */
  --focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.3);

  /* Gradients */
  --gradient-blue: linear-gradient(to right, rgba(59, 130, 246, 0.1), rgba(59, 130, 246, 0.15));
  --gradient-green: linear-gradient(to right, rgba(34, 197, 94, 0.1), rgba(34, 197, 94, 0.15));
  --gradient-yellow: linear-gradient(to right, rgba(251, 191, 36, 0.1), rgba(251, 191, 36, 0.15));
  --gradient-purple: linear-gradient(to right, rgba(167, 139, 250, 0.1), rgba(167, 139, 250, 0.15));
  --gradient-gray: linear-gradient(to right, #1f2937, #374151);
  --gradient-orange: linear-gradient(to right, rgba(251, 146, 60, 0.1), rgba(251, 146, 60, 0.15));
}

/* ============================================================================
   CSS RESET & BASE STYLES
   ============================================================================ */

/* Base HTML Configuration */
html {
  font-size: 12.6px;
  -webkit-text-size-adjust: 100%;
  -ms-text-size-adjust: 100%;
  height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  scroll-behavior: auto;
}

*,
*::before,
*::after {
  box-sizing: inherit;
}

img,
video,
iframe,
object,
embed {
  max-width: 100%;
  height: auto;
}

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 0.7875rem;
  line-height: 1.5;
  height: 100%;
  min-height: 100%;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  overflow-y: hidden;
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-base), color var(--transition-base);
}

/* Allow body scrolling on mobile to prevent content cutoff */
@media (max-width: 640px) {
  body {
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    min-height: 100dvh;
  }
}

/* ========== Responsive Base Font Sizes ========== */

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  html {
    font-size: 13.5px;
  }
  
  body {
    font-size: 0.8125rem;
    line-height: 1.55;
  }
}

/* Mobile (max 640px) */
@media (max-width: 640px) {
  html { 
    font-size: 14px;
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1);
  }
  
  body { 
    font-size: 0.875rem; 
    line-height: 1.6;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="number"],
  input[type="search"],
  input[type="tel"],
  input[type="url"],
  input[type="date"],
  input[type="time"],
  input[type="datetime-local"],
  textarea,
  select {
    font-size: 16px !important;
  }
  
  /* Minimum touch targets for accessibility */
  a, button, input, select, textarea {
    min-height: var(--touch-target);
  }
  
  /* Better tap highlights */
  button, a {
    -webkit-tap-highlight-color: rgba(37, 99, 235, 0.2);
  }
}

/* ========== 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 Styles ========== */

/* Remove default browser outlines - we'll use custom border colors instead */
:focus {
  outline: none;
}

:focus-visible {
  outline: none;
}

/* Form elements - no blue borders, use simple gray border */
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
  outline: none;
}

button:focus,
button:focus-visible,
a:focus,
a:focus-visible {
  outline: none;
}

/* ========== Global Input Styles for Dark Mode ========== */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="tel"],
input[type="url"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
textarea,
select {
  background-color: var(--input-bg) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-secondary) !important;
  transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base);
}

input[type="text"]::placeholder,
input[type="email"]::placeholder,
input[type="password"]::placeholder,
input[type="number"]::placeholder,
input[type="search"]::placeholder,
input[type="tel"]::placeholder,
input[type="url"]::placeholder,
textarea::placeholder {
  color: var(--text-muted) !important;
}

/* ========== SVG Background Fix for Dark Mode ========== */
/* Ensure SVGs maintain transparent backgrounds and don't inherit dark backgrounds */
svg {
  background-color: transparent !important;
  background: transparent !important;
}

/* Ensure SVG containers don't get dark backgrounds unless explicitly styled */
svg * {
  background-color: transparent !important;
  background: transparent !important;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="tel"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="time"]:focus,
input[type="datetime-local"]:focus,
textarea:focus,
select:focus {
  background-color: var(--input-bg) !important;
  border-color: var(--border-focus) !important;
  outline: none !important;
}

/* ========== Reduced Motion ========== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================================
   TYPOGRAPHY SYSTEM
   ============================================================================ */

/* ========== Headings ========== */

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  line-height: 1.2;
  transition: color var(--transition-base);
}

h1 {
  font-size: var(--text-2xl);
}

h2 {
  font-size: var(--text-xl);
}

h3 {
  font-size: var(--text-lg);
}

h4 {
  font-size: var(--text-base);
}

h5, h6 {
  font-size: var(--text-sm);
}

/* ========== Paragraphs & Text ========== */

p {
  margin: 0 0 var(--spacing-4) 0;
}

p:last-child {
  margin-bottom: 0;
}

/* ========== Links ========== */

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

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

/* Exception: Buttons should maintain their own text colors on hover */
a.btn:hover {
  color: inherit;
}

/* Ensure colored buttons keep white text on hover */
a.btn--primary:hover,
a.btn--submit:hover,
a.btn--create:hover,
a.btn--success:hover,
a.btn--edit:hover,
a.btn--filter:hover,
a.btn--danger:hover {
  color: var(--color-white);
}

/* ========== Color Classes ========== */

.text-gray-400 { color: var(--text-muted); }
.text-gray-500 { color: var(--text-muted); }
.text-gray-600 { color: var(--text-tertiary); }
.text-gray-700 { color: var(--text-secondary); }
.text-gray-900 { color: var(--text-primary); }

/* ========== Text Utilities ========== */

.text-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  transition: color var(--transition-base);
}

.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-break {
  word-break: break-word;
  overflow-wrap: break-word;
}

/* ========== Responsive Typography ========== */

/* Tablet (641px - 1024px) */
@media (min-width: 641px) and (max-width: 1024px) {
  h1 { font-size: var(--text-2xl-tablet); }
  h2 { font-size: var(--text-xl-tablet); }
  h3 { font-size: var(--text-lg-tablet); }
}

/* Mobile (max 640px) */
@media (max-width: 640px) {
  h1 { font-size: var(--text-2xl-mobile); }
  h2 { font-size: var(--text-xl-mobile); }
  h3 { font-size: var(--text-lg-mobile); }
  h4 { font-size: var(--text-base-mobile); }
}

/* ============================================================================
   FLASH MESSAGES
   Toast-style notification messages
   ============================================================================ */

.flash-message {
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  border-radius: var(--radius-md);
  padding: var(--spacing-4);
  margin-bottom: var(--spacing-4);
  animation: flashSlideIn 0.3s ease-out;
}

#global-flash-container {
  position: fixed;
  top: calc(4.5rem + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  width: min(42rem, calc(100vw - (var(--spacing-4) * 2)));
  z-index: 220;
  pointer-events: none;
}

#global-flash-container .flash-message {
  pointer-events: auto;
}

.flash-message.success {
  background-color: var(--color-success-bg);
  border: 1px solid var(--color-success-border);
  color: var(--color-success-text);
}

.flash-message.error,
.flash-message.alert {
  background-color: var(--color-danger-bg);
  border: 1px solid var(--color-danger-border);
  color: var(--color-danger-text);
}

.flash-message-content {
  display: flex;
  align-items: center;
  flex: 1;
}

.flash-message-icon {
  width: 1.25rem;
  height: 1.25rem;
  margin-right: 0.75rem;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: inherit;
}

.flash-message-icon svg {
  width: 100%;
  height: 100%;
  color: inherit;
}

.flash-message-text {
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
}

.flash-message-close {
  margin-left: var(--spacing-4);
  padding: var(--spacing-1);
  border-radius: var(--radius-sm);
  background: none;
  border: none;
  cursor: pointer;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.flash-message-close svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

.flash-message.success .flash-message-close {
  color: var(--color-success);
}

.flash-message.success .flash-message-close:hover {
  color: var(--color-success-hover);
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .flash-message.success .flash-message-close:hover,
.dark .flash-message.success .flash-message-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.flash-message.error .flash-message-close,
.flash-message.alert .flash-message-close {
  color: var(--color-danger);
}

.flash-message.error .flash-message-close:hover,
.flash-message.alert .flash-message-close:hover {
  color: var(--color-danger-hover);
  background-color: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .flash-message.error .flash-message-close:hover,
.dark .flash-message.error .flash-message-close:hover,
[data-theme="dark"] .flash-message.alert .flash-message-close:hover,
.dark .flash-message.alert .flash-message-close:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.flash-message.dismissing {
  animation: flashSlideOut 0.3s ease-in forwards;
}

@keyframes flashSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes flashSlideOut {
  from {
    opacity: 1;
    transform: translateY(0);
    max-height: 100px;
  }
  to {
    opacity: 0;
    transform: translateY(-10px);
    max-height: 0;
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
  }
}

@media (max-width: 640px) {
  #global-flash-container {
    width: calc(100vw - (var(--spacing-3) * 2));
  }

  .flash-message {
    padding: 0.75rem;
    margin-bottom: 0.75rem;
  }
  
  .flash-message-text {
    font-size: var(--text-sm-mobile);
  }
  
  .flash-message-icon {
    width: 1.25rem;
    height: 1.25rem;
    margin-right: 0.5rem;
  }
  
  .flash-message-icon svg {
    width: 100%;
    height: 100%;
  }
  
  .flash-message-close {
    margin-left: 0.75rem;
  }
  
  .flash-message-close svg {
    width: 1rem;
    height: 1rem;
  }
}

@media (prefers-contrast: high) {
  .flash-message.success {
    border-width: 2px;
    border-color: var(--color-success);
  }
  
  .flash-message.error,
  .flash-message.alert {
    border-width: 2px;
    border-color: var(--color-danger);
  }
}

@media (prefers-reduced-motion: reduce) {
  .flash-message,
  .flash-message.dismissing {
    animation: none;
  }
}
