
@tailwind base;
@tailwind components;
@tailwind utilities;

/* 1) Respect user settings */
html {
  font-size: 100%; /* 1rem = user's default (usually 16px) */
  scroll-behavior: smooth;
}

/* 2) Set a sensible text baseline */
body {
  font-size: 1rem;          /* 16px base text */
  line-height: 1.5;         /* good readability */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}

/* 3) Fluid, but anchored to your exact targets
   Targets at a typical laptop (~1024–1280px):
   H1: 28px(1.75rem) H2: 22px(1.375rem) H3: 18px(1.125rem)
   H4: 16px(1rem)    H5: 14px(0.875rem) H6: 12px(0.75rem)

   clamp(min, preferred, max)
   - min is ~90–95% of your target for small screens
   - max is ~110–120% of your target for large screens
   - the middle uses a small vw slope so sizes breathe naturally
*/

h1 { font-size: clamp(1.6rem, 1.2rem + 1.2vw, 1.9rem); /* ~25.6px → 30.4px, target ~28px */ }
h2 { font-size: clamp(1.25rem, 1.05rem + 0.7vw, 1.5rem); /* ~20px → 24px, target ~22px */ }
h3 { font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.2rem); /* ~16.8px → 19.2px, target ~18px */ }
h4 { font-size: clamp(0.95rem, 0.9rem + 0.3vw, 1.05rem); /* ~15.2px → 16.8px, target ~16px */ }
h5 { font-size: clamp(0.82rem, 0.8rem + 0.2vw, 0.9rem);  /* ~13.1px → 14.4px, target ~14px */ }
h6 { font-size: clamp(0.72rem, 0.7rem + 0.2vw, 0.8rem);  /* ~11.5px → 12.8px, target ~12px */ }

/* Optional: consistent heading rhythm */
h1,h2,h3,h4,h5,h6 {
  line-height: 1.2;
  margin: 0 0 0.5em;
  font-weight: 700;
}

/* Optional cap on ultra-wide displays */
@media (min-width: 1600px) {
  h1 { font-size: 1.9rem; }
  h2 { font-size: 1.5rem; }
  h3 { font-size: 1.2rem; }
  h4 { font-size: 1.05rem; }
  h5 { font-size: 0.9rem; }
  h6 { font-size: 0.8rem; }
}

/* Ensure containers don't cause horizontal overflow */
.container {
  max-width: 100vw;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

/* Improve touch targets on mobile */
@media (max-width: 768px) {
  button, a[href] {
    min-height: 44px;
    min-width: 44px;
  }
  
  /* Better mobile scrolling */
  * {
    -webkit-overflow-scrolling: touch;
  }
  
  /* Prevent text zoom on orientation change */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }
  
  /* Prevent layout shifts */
  img, video {
    max-width: 100%;
    height: auto;
  }
  
  /* Better tap highlighting */
  * {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Ensure proper viewport behavior */
  body {
    position: relative;
    width: 100%;
    min-height: 100vh;
  }
  
  /* Fix potential width overflow issues */
  * {
    max-width: 100%;
    box-sizing: border-box;
  }
  
  html, body {
    max-width: 100vw;
  }
  
  /* Grid and flexbox mobile fixes */
  .grid, [class*="grid-"], .flex, [class*="flex-"] {
    width: 100%;
    overflow-x: hidden;
  }
  
  /* Text and content overflow prevention */
  p, h1, h2, h3, h4, h5, h6, div {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }
}

:root {
  --background: hsl(44, 62%, 96%);
  --foreground: hsl(205, 84%, 1%);
  --card: hsl(44, 62%, 96%);
  --card-foreground: hsl(205, 84%, 1%);
  --popover: hsl(0, 0%, 100%);
  --popover-foreground: hsl(205, 84%, 1%);
  --primary: hsl(87, 21%, 35%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(30, 21%, 66%);
  --secondary-foreground: hsl(0, 0%, 100%);
  --muted: hsl(0, 0%, 100%);
  --muted-foreground: hsl(0, 0%, 31%);
  --accent: hsl(30, 21%, 66%);
  --accent-foreground: hsl(0, 0%, 100%);
  --destructive: hsl(356, 91%, 54%);
  --destructive-foreground: hsl(0, 0%, 100%);
  --border: hsl(30, 21%, 66%, 0.2);
  --input: hsl(200, 23%, 97%);
  --ring: hsl(87, 21%, 35%);
  --chart-1: hsl(87, 21%, 35%);
  --chart-2: hsl(159, 100%, 36%);
  --chart-3: hsl(42, 93%, 56%);
  --chart-4: hsl(147, 79%, 42%);
  --chart-5: hsl(341, 75%, 51%);
  --sidebar: hsl(44, 62%, 96%);
  --sidebar-foreground: hsl(205, 84%, 1%);
  --sidebar-primary: hsl(87, 21%, 35%);
  --sidebar-primary-foreground: hsl(0, 0%, 100%);
  --sidebar-accent: hsl(30, 21%, 66%);
  --sidebar-accent-foreground: hsl(0, 0%, 100%);
  --sidebar-border: hsl(30, 21%, 66%, 0.2);
  --sidebar-ring: hsl(87, 21%, 35%);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: Georgia, serif;
  --font-mono: Menlo, monospace;
  --radius: 1.3rem;
  --shadow-2xs: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
  --shadow-xs: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
  --shadow-sm: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 1px 2px -1px hsl(87, 21%, 35%, 0.00);
  --shadow: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 1px 2px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-md: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 2px 4px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-lg: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 4px 6px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-xl: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 8px 10px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-2xl: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
  --tracking-normal: 0em;
  --spacing: 0.25rem;

  /* TrainingBooker Custom Colors */
  --tb-cream: hsl(48, 24%, 96%);
  --tb-dark: hsl(205, 84%, 1%);
  --tb-gray-text: hsl(0, 0%, 31%);
  --tb-warm-beige: hsl(30, 21%, 66%);
  --tb-sage: hsl(87, 21%, 35%);
  --tb-charcoal: hsl(0, 0%, 31%);
}

/* Custom input styling with 8px border-radius and solid border */
input {
  border-radius: 8px !important;
  border: 1px solid #e5e5e5 !important;
}

.dark {
  --background: hsl(0, 0%, 0%);
  --foreground: hsl(200, 7%, 91%);
  --card: hsl(228, 10%, 10%);
  --card-foreground: hsl(0, 0%, 85%);
  --popover: hsl(0, 0%, 0%);
  --popover-foreground: hsl(200, 7%, 91%);
  --primary: hsl(87, 21%, 35%);
  --primary-foreground: hsl(0, 0%, 100%);
  --secondary: hsl(195, 15%, 95%);
  --secondary-foreground: hsl(205, 84%, 1%);
  --muted: hsl(0, 0%, 9%);
  --muted-foreground: hsl(210, 3%, 46%);
  --accent: hsl(206, 70%, 8%);
  --accent-foreground: hsl(87, 21%, 35%);
  --destructive: hsl(356, 91%, 54%);
  --destructive-foreground: hsl(0, 0%, 100%);
  --border: hsl(210, 5%, 15%);
  --input: hsl(208, 28%, 18%);
  --ring: hsl(87, 21%, 35%);
  --chart-1: hsl(87, 21%, 35%);
  --chart-2: hsl(159, 100%, 36%);
  --chart-3: hsl(42, 93%, 56%);
  --chart-4: hsl(147, 79%, 42%);
  --chart-5: hsl(341, 75%, 51%);
  --sidebar: hsl(228, 10%, 10%);
  --sidebar-foreground: hsl(0, 0%, 85%);
  --sidebar-primary: hsl(87, 21%, 35%);
  --sidebar-primary-foreground: hsl(0, 0%, 100%);
  --sidebar-accent: hsl(206, 70%, 8%);
  --sidebar-accent-foreground: hsl(87, 21%, 35%);
  --sidebar-border: hsl(206, 16%, 26%);
  --sidebar-ring: hsl(87, 21%, 35%);
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: Georgia, serif;
  --font-mono: Menlo, monospace;
  --radius: 1.3rem;
  --shadow-2xs: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
  --shadow-xs: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
  --shadow-sm: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 1px 2px -1px hsl(87, 21%, 35%, 0.00);
  --shadow: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 1px 2px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-md: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 2px 4px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-lg: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 4px 6px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-xl: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00), 0px 8px 10px -1px hsl(87, 21%, 35%, 0.00);
  --shadow-2xl: 0px 2px 0px 0px hsl(87, 21%, 35%, 0.00);
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply font-sans antialiased bg-tb-cream text-tb-gray-text;
  }
}

@layer utilities {
  .text-tb-dark {
    color: var(--tb-dark);
  }
  
  .text-tb-gray-text {
    color: var(--tb-gray-text);
  }
  
  .bg-tb-cream {
    background-color: var(--tb-cream);
  }
  
  .bg-tb-sage {
    background-color: var(--tb-sage);
  }
  
  .bg-tb-warm-beige {
    background-color: var(--tb-warm-beige);
  }
  
  .bg-tb-charcoal {
    background-color: var(--tb-charcoal);
  }
  
  .border-tb-warm-beige {
    border-color: var(--tb-warm-beige);
  }
  
  .hover\:bg-tb-sage\/90:hover {
    background-color: hsl(87, 21%, 35%, 0.9);
  }
  
  .animate-scroll-smooth {
    animation: scroll-smooth 60s linear infinite;
  }
}

@keyframes scroll-smooth {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(calc(-100% / 3));
  }
}

/* Hide profession list scrollbar specifically */
.max-h-64.overflow-y-auto::-webkit-scrollbar {
  display: none;  /* Safari and Chrome */
}
