/**
 * Design Tokens - Pokemon Card Tracker
 * 
 * This file contains all design tokens used throughout the application.
 * These tokens are consumed by Tailwind CSS and components.
 */

:root {
  /* ==================== COLOR TOKENS ==================== */

  /* Base Colors */
  --color-white: #ffffff;
  --color-black: #000000;

  /* Primary Color Scale (Blue) */
  --color-primary-50: #eff6ff;
  --color-primary-100: #dbeafe;
  --color-primary-200: #bfdbfe;
  --color-primary-300: #93c5fd;
  --color-primary-400: #60a5fa;
  --color-primary-500: #3b82f6; /* Blue 500 */
  --color-primary-600: #2563eb;
  --color-primary-700: #1d4ed8;
  --color-primary-800: #1e40af;
  --color-primary-900: #1e3a8a;
  --color-primary-950: #172554;

  /* Accent Color Scale (Pink for gradients) */
  --color-accent-50: #fdf2f8;
  --color-accent-100: #fce7f3;
  --color-accent-200: #fbcfe8;
  --color-accent-300: #f9a8d4;
  --color-accent-400: #f472b6;
  --color-accent-500: #ec4899;
  --color-accent-600: #db2777;
  --color-accent-700: #be185d;
  --color-accent-800: #9d174d;
  --color-accent-900: #831843;
  --color-accent-950: #500724;

  /* 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;
  --color-gray-950: #030712;

  /* Semantic Colors */
  --color-success-50: #f0fdf4;
  --color-success-100: #dcfce7;
  --color-success-200: #bbf7d0;
  --color-success-300: #86efac;
  --color-success-400: #4ade80;
  --color-success-500: #22c55e;
  --color-success-600: #16a34a;
  --color-success-700: #15803d;
  --color-success-800: #166534;
  --color-success-900: #14532d;
  --color-success-950: #052e16;

  --color-warning-50: #fffbeb;
  --color-warning-100: #fef3c7;
  --color-warning-200: #fde68a;
  --color-warning-300: #fcd34d;
  --color-warning-400: #fbbf24;
  --color-warning-500: #f59e0b;
  --color-warning-600: #d97706;
  --color-warning-700: #b45309;
  --color-warning-800: #92400e;
  --color-warning-900: #78350f;
  --color-warning-950: #451a03;

  --color-error-50: #fef2f2;
  --color-error-100: #fee2e2;
  --color-error-200: #fecaca;
  --color-error-300: #fca5a5;
  --color-error-400: #f87171;
  --color-error-500: #ef4444;
  --color-error-600: #dc2626;
  --color-error-700: #b91c1c;
  --color-error-800: #991b1b;
  --color-error-900: #7f1d1d;
  --color-error-950: #450a0a;

  --color-info-50: #eff6ff;
  --color-info-100: #dbeafe;
  --color-info-200: #bfdbfe;
  --color-info-300: #93c5fd;
  --color-info-400: #60a5fa;
  --color-info-500: #3b82f6;
  --color-info-600: #2563eb;
  --color-info-700: #1d4ed8;
  --color-info-800: #1e40af;
  --color-info-900: #1e3a8a;
  --color-info-950: #172554;

  /* ==================== SURFACE TOKENS ==================== */

  /* Light Mode Surfaces */
  --surface-light-primary: var(--color-gray-50);
  --surface-light-secondary: var(--color-gray-50);
  --surface-light-tertiary: var(--color-gray-100);
  --surface-light-quaternary: var(--color-gray-200);

  /* Dark Mode Surfaces */
  --surface-dark-primary: var(--color-black);
  --surface-dark-secondary: #0F0F0F;
  --surface-dark-tertiary: #0F0F0F;
  --surface-dark-quaternary: #0F0F0F;

  /* ==================== TEXT TOKENS ==================== */

  /* Light Mode Text */
  --text-light-primary: var(--color-gray-900);
  --text-light-secondary: var(--color-gray-700);
  --text-light-tertiary: var(--color-gray-500);
  --text-light-quaternary: var(--color-gray-400);

  /* Dark Mode Text */
  --text-dark-primary: var(--color-gray-50);
  --text-dark-secondary: var(--color-gray-300);
  --text-dark-tertiary: var(--color-gray-400);
  --text-dark-quaternary: var(--color-gray-500);

  /* ==================== BORDER TOKENS ==================== */

  --border-light: var(--color-gray-200);
  --border-light-hover: var(--color-gray-300);
  --border-dark: var(--color-gray-700);
  --border-dark-hover: var(--color-gray-600);

  /* ==================== SPACING TOKENS ==================== */

  --space-1: 0.25rem; /* 4px */
  --space-2: 0.5rem; /* 8px */
  --space-3: 0.75rem; /* 12px */
  --space-4: 1rem; /* 16px */
  --space-5: 1.25rem; /* 20px */
  --space-6: 1.5rem; /* 24px */
  --space-8: 2rem; /* 32px */
  --space-10: 2.5rem; /* 40px */
  --space-12: 3rem; /* 48px */
  --space-16: 4rem; /* 64px */
  --space-20: 5rem; /* 80px */
  --space-24: 6rem; /* 96px */

  /* ==================== TYPOGRAPHY TOKENS ==================== */

  /* Font Sizes */
  --font-size-xs: 0.75rem; /* 12px */
  --font-size-sm: 0.875rem; /* 14px */
  --font-size-base: 1rem; /* 16px */
  --font-size-lg: 1.125rem; /* 18px */
  --font-size-xl: 1.25rem; /* 20px */
  --font-size-2xl: 1.5rem; /* 24px */
  --font-size-3xl: 1.875rem; /* 30px */
  --font-size-4xl: 2.25rem; /* 36px */

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

  /* Line Heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.75;

  /* ==================== BORDER RADIUS TOKENS ==================== */

  /*
    Unified radius system:
    Set a single value here to standardize rounded corners across the app.
    Update --radius-unified to your preferred value (default: 0.5rem = 8px).
  */
  --radius-unified: 0.5rem; /* 8px */

  --radius-none: 0;
  --radius-sm: var(--radius-unified);
  --radius-md: var(--radius-unified);
  --radius-lg: var(--radius-unified);
  --radius-xl: var(--radius-unified);
  --radius-2xl: var(--radius-unified);
  --radius-full: 9999px;

  /* ==================== SHADOW TOKENS ==================== */

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg:
    0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl:
    0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);

  /* ==================== Z-INDEX TOKENS ==================== */

  --z-base: 1;
  --z-dropdown: 1000;
  --z-sticky: 1020;
  --z-fixed: 1030;
  --z-modal-backdrop: 1040;
  --z-modal: 1050;
  --z-popover: 1060;
  --z-tooltip: 1070;
  --z-toast: 1080;
  --z-settings: 2000;
  --z-header: 2500;
  --z-bottom-nav: 3000;

  /* ==================== COMPONENT TOKENS ==================== */

  /* Button Tokens */
  --btn-height-sm: 2rem; /* 32px */
  --btn-height-md: 2.5rem; /* 40px */
  --btn-height-lg: 2.75rem; /* 44px */
  --btn-padding-x-sm: 0.75rem; /* 12px */
  --btn-padding-x-md: 1rem; /* 16px */
  --btn-padding-x-lg: 1.25rem; /* 20px */
  --btn-font-size: var(--font-size-sm);
  --btn-font-weight: var(--font-weight-medium);
  --btn-radius: var(--radius-lg);
  --btn-icon-size: 1.25rem; /* 20px */

  /* Header Tokens */
  --header-height-mobile: 4rem; /* 64px */
  --header-height-desktop: 5rem; /* 80px */

  /* ==================== GRADIENT TOKENS ==================== */

  --gradient-primary: linear-gradient(
    to right,
    var(--color-primary-500),
    var(--color-primary-700)
  );
  --gradient-primary-hover: linear-gradient(
    to right,
    var(--color-primary-600),
    var(--color-primary-800)
  );

  /* ==================== SEMANTIC THEME TOKENS ==================== */

  /* These are the active theme tokens that components should use */
  /* They are automatically switched based on light/dark mode */

  /* Default to light mode */
  --color-surface-primary: var(--surface-light-primary);
  --color-surface-secondary: var(--surface-light-secondary);
  --color-surface-tertiary: var(--surface-light-tertiary);
  --color-surface-quaternary: var(--surface-light-quaternary);

  --color-text-primary: var(--text-light-primary);
  --color-text-secondary: var(--text-light-secondary);
  --color-text-tertiary: var(--text-light-tertiary);
  --color-text-quaternary: var(--text-light-quaternary);

  --color-border: var(--border-light);
  --color-border-hover: var(--border-light-hover);
}

/* ==================== DARK MODE THEME SWITCHING ==================== */

.dark {
  /* Override semantic tokens for dark mode */
  --color-surface-primary: var(--surface-dark-primary);
  --color-surface-secondary: var(--surface-dark-secondary);
  --color-surface-tertiary: var(--surface-dark-tertiary);
  --color-surface-quaternary: var(--surface-dark-quaternary);

  --color-text-primary: var(--text-dark-primary);
  --color-text-secondary: var(--text-dark-secondary);
  --color-text-tertiary: var(--text-dark-tertiary);
  --color-text-quaternary: var(--text-dark-quaternary);

  --color-border: var(--border-dark);
  --color-border-hover: var(--border-dark-hover);
}

/**
 * Utilities - Pokemon Card Tracker
 * 
 * This file contains:
 * - Custom utility classes
 * - Component-specific styles that aren't in the UI library
 * - Application-specific utilities
 */

/* ==================== LAYOUT UTILITIES ==================== */

/* Container utilities */
.container-fluid {
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: var(--space-4);
  padding-right: var(--space-4);
}

@media (min-width: 769px) {
  .container-fluid,
  .container {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }
}

/* Page layout utilities */
.page-container {
  min-height: 100vh;
  background-color: var(--color-surface-primary);
}

.page-no-padding {
  padding: 0;
  margin: 0;
}

.main-content {
  padding-top: var(--header-height-mobile);
  padding-bottom: 4rem; /* Reduced from 5rem to 4rem for smaller bottom nav */
}

@media (min-width: 769px) {
  .main-content {
    padding-top: var(--header-height-desktop);
  }
}

/* Dashboard specific layouts */
.dashboard-page {
  background-color: var(--color-surface-primary);
  min-height: 100vh;
}

.mobile-dashboard {
  padding-bottom: 4rem; /* Reduced from 5rem to 4rem for smaller bottom nav */
}

@media (min-width: 769px) {
  .mobile-dashboard {
    padding-bottom: var(--space-6);
  }
}

/* ==================== NAVIGATION UTILITIES ==================== */

/* Header utilities */
.header-responsive {
  height: var(--header-height-mobile);
  background-color: var(--color-white);
  border-bottom: 1px solid var(--color-border);
}

.dark .header-responsive {
  background-color: #0F0F0F;
}

@media (min-width: 769px) {
  .header-responsive {
    height: var(--header-height-desktop);
  }
}

/* Bottom navigation utilities */
.bottom-nav {
  min-height: 4rem; /* Use min-height instead of fixed height for flexibility */
  background-color: var(--color-white);
  border-top: 1px solid var(--color-border);
  z-index: var(--z-bottom-nav);
}

.dark .bottom-nav {
  background-color: #0F0F0F;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.25rem; /* Reduced from 0.5rem to 0.25rem */
  color: var(--color-text-tertiary);
  transition: color 0.2s ease;
}

.bottom-nav-item.active {
  color: var(--color-primary-500);
}

.bottom-nav-item:hover {
  color: var(--color-text-secondary);
}

.bottom-nav-item.active:hover {
  color: var(--color-primary-600);
}

/* Bottom nav responsive hiding */
.bottom-nav-hidden {
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

@media (min-width: 1024px) {
  .bottom-nav {
    display: none;
  }
}

/* ==================== COLLECTION UTILITIES ==================== */

/* Collection dropdown styling */
.collection-dropdown {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-height: 300px;
  overflow-y: auto;
  z-index: var(--z-dropdown);
}

.dark .collection-dropdown {
  background-color: #0F0F0F;
}

@media (max-width: 639px) {
  .collection-dropdown {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-height: 50vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    border: none;
    border-top: 1px solid var(--color-border);
  }
}

.collection-item {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.collection-item:last-child {
  border-bottom: none;
}

.collection-item:hover {
  background-color: var(--color-surface-secondary);
}

.collection-name {
  font-weight: var(--font-weight-medium);
  color: var(--color-text-primary);
  display: block;
  text-decoration: none;
  transition: color 0.2s ease;
}

.collection-name:hover {
  color: var(--color-primary-500);
}

.collection-divider {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--space-2) 0;
}

/* ==================== CARD UTILITIES ==================== */

/* Financial detail boxes */
.financial-detail-box {
  background-color: transparent;
  border: none;
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  text-align: center;
  transition: background-color 0.2s ease;
}

.dark .financial-detail-box {
  background-color: transparent;
  border: none;
}

.financial-detail-label {
  font-size: var(--font-size-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--space-1);
}

.financial-detail-value {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-primary);
}

/* ==================== FORM UTILITIES ==================== */

/* Sort dropdown utilities */
.sort-dropdown {
  background-color: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-size-sm);
  z-index: 1000;
  z-index: var(--z-dropdown, 1000);
  position: relative;
}

.dark .sort-dropdown {
  background-color: #0F0F0F;
}

.sort-dropdown:focus {
  outline: none;
  border-color: var(--color-primary-500);
  box-shadow: 0 0 0 2px var(--color-primary-200);
}

.dark .sort-dropdown:focus {
  box-shadow: 0 0 0 2px var(--color-primary-700);
}

/* Form layout utilities */
.form-label-nowrap {
  white-space: nowrap;
  /* Remove overflow: hidden to prevent clipping focus outlines */
  /* overflow: hidden; */
  text-overflow: ellipsis;
}

/* More specific class for just the labels to prevent wrapping */
.form-label-nowrap label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

@media (max-width: 640px) {
  .financial-details-grid {
    grid-template-columns: 1fr;
  }
}

/* Collection selector fixes */
.collection-selector .absolute {
  max-height: 300px;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.collection-selector .absolute::-webkit-scrollbar {
  display: none;
}

/* Header collections dropdown fixes */
header .max-h-60.overflow-y-auto {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

header .max-h-60.overflow-y-auto::-webkit-scrollbar {
  display: none;
}

/* Hide scrollbar utility */
.hide-scrollbar {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* Internet Explorer 10+ */
}

.hide-scrollbar::-webkit-scrollbar {
  display: none; /* WebKit */
}

/* ==================== MODAL UTILITIES ==================== */

/* Modal state utilities */
.modal-open .mobile-bottom-nav {
  transform: translateY(100%);
}

.modal-open .header button {
  pointer-events: none;
}

/* ==================== ACCORDION UTILITIES ==================== */

.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.accordion-content.open {
  max-height: 1000px;
}

/* ==================== ANIMATION UTILITIES ==================== */

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

.fade-in {
  animation: fadeIn 0.3s ease;
}

/* Slide up animation */
@keyframes slideUp {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.slide-up {
  animation: slideUp 0.3s ease;
}

/* Modal Animation Classes */
.animate-backdrop-fade-in {
  animation: backdropFadeIn 0.25s ease forwards;
}

.animate-backdrop-fade-out {
  animation: backdropFadeOut 0.2s ease forwards;
}

.animate-modal-scale-in {
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-modal-enter {
  animation: modalScaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.animate-modal-exit {
  animation: modalExit 0.2s ease-in forwards;
}

.animate-modal-slide-in-right {
  animation: modalSlideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-modal-exit-right {
  animation: modalExitRight 0.2s ease-in forwards;
}

/* Modal backdrop keyframes */
@keyframes backdropFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes backdropFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Modal content keyframes */
@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes modalExit {
  from {
    opacity: 1;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(0.95);
  }
}

@keyframes modalSlideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes modalExitRight {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(30px);
  }
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ==================== GRADIENT UTILITIES ==================== */

.bg-primary-gradient {
  background: var(--gradient-primary);
}

.hover\:bg-primary-gradient-hover:hover {
  background: var(--gradient-primary-hover);
}

/* Glass effect utilities */
.glass-border {
  border-color: rgba(255, 255, 255, 0.1);
}

.glass-border-light {
  border-color: rgba(255, 255, 255, 0.2);
}

.hover\:glass-border-hover:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.glass-bg {
  background-color: rgba(255, 255, 255, 0.05);
}

.glass-bg-secondary {
  background-color: rgba(255, 255, 255, 0.1);
}

.hover\:glass-bg-hover:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.glass-gradient {
  background: linear-gradient(to bottom right, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
}

.dark-glass-gradient {
  background: linear-gradient(to bottom right, rgba(31, 41, 55, 0.5), rgba(17, 24, 39, 0.5));
}

.hero-blur-background {
  background: linear-gradient(to bottom right, rgba(59, 130, 246, 0.1), rgba(168, 85, 247, 0.1), rgba(236, 72, 153, 0.1));
}

.hero-orb-blue {
  background-color: rgba(59, 130, 246, 0.05);
}

.hero-orb-purple {
  background-color: rgba(168, 85, 247, 0.05);
}

/* ==================== ACCESSIBILITY UTILITIES ==================== */

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

/* Focus trap for modals */
.focus-trap {
  outline: none;
}

/* ==================== PRINT UTILITIES ==================== */

@media print {
  .no-print {
    display: none;
  }

  .print-only {
    display: block;
  }

  body {
    background: white !important;
    color: black !important;
  }
}

/* ==================== CARD DETAILS MODAL FIXES ==================== */

/* Ensure the Modal's H2 element doesn't interfere with our flex layout */
.card-details-modal #modal-title {
  display: flex !important;
  width: 100% !important;
}



