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



@layer base {
  :root {
    /* Brand: Cream background, Navy Blue primary, Amber accent */
    --background: 40 30% 97%;       /* cream */
    --foreground: 222 47% 11%;      /* navy blue */
    --card: 40 30% 99%;             /* near-white cream */
    --card-foreground: 222 47% 11%;
    --popover: 40 30% 99%;
    --popover-foreground: 222 47% 11%;
    --primary: 222 47% 20%;         /* navy blue */
    --primary-foreground: 40 30% 97%;
    --secondary: 40 20% 92%;        /* warm cream */
    --secondary-foreground: 222 47% 20%;
    --muted: 40 20% 92%;
    --muted-foreground: 222 20% 45%;
    --accent: 38 92% 50%;           /* amber */
    --accent-foreground: 222 47% 11%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 0 0% 98%;
    --border: 40 20% 86%;
    --input: 40 20% 86%;
    --ring: 222 47% 20%;
    --chart-1: 12 76% 61%;
    --chart-2: 173 58% 39%;
    --chart-3: 197 37% 24%;
    --chart-4: 43 74% 66%;
    --chart-5: 27 87% 67%;
    --radius: 0.5rem;
    --sidebar-background: 0 0% 98%;
    --sidebar-foreground: 240 5.3% 26.1%;
    --sidebar-primary: 240 5.9% 10%;
    --sidebar-primary-foreground: 0 0% 98%;
    --sidebar-accent: 240 4.8% 95.9%;
    --sidebar-accent-foreground: 240 5.9% 10%;
    --sidebar-border: 220 13% 91%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
  .dark {
    --background: 0 0% 3.9%;
    --foreground: 0 0% 98%;
    --card: 0 0% 3.9%;
    --card-foreground: 0 0% 98%;
    --popover: 0 0% 3.9%;
    --popover-foreground: 0 0% 98%;
    --primary: 0 0% 98%;
    --primary-foreground: 0 0% 9%;
    --secondary: 0 0% 14.9%;
    --secondary-foreground: 0 0% 98%;
    --muted: 0 0% 14.9%;
    --muted-foreground: 0 0% 63.9%;
    --accent: 0 0% 14.9%;
    --accent-foreground: 0 0% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 0 0% 98%;
    --border: 0 0% 14.9%;
    --input: 0 0% 14.9%;
    --ring: 0 0% 83.1%;
    --chart-1: 220 70% 50%;
    --chart-2: 160 60% 45%;
    --chart-3: 30 80% 55%;
    --chart-4: 280 65% 60%;
    --chart-5: 340 75% 55%;
    --sidebar-background: 240 5.9% 10%;
    --sidebar-foreground: 240 4.8% 95.9%;
    --sidebar-primary: 224.3 76.3% 48%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 240 3.7% 15.9%;
    --sidebar-accent-foreground: 240 4.8% 95.9%;
    --sidebar-border: 240 3.7% 15.9%;
    --sidebar-ring: 217.2 91.2% 59.8%;
  }
}



@layer base {
  * {
    max-width: 100vw;
  }
  
  html, body {
    overscroll-behavior-y: contain;
    overflow-x: hidden;
    overflow-y: auto;
    width: 100%;
    max-width: 100vw;
    viewport-fit: cover;
    min-height: -webkit-fill-available;
    -webkit-overflow-scrolling: touch;
  }

  /* Hide scrollbar on mobile, show on desktop */
  @media (max-width: 768px) {
    html, body, * {
      scrollbar-width: none;
      -ms-overflow-style: none;
    }
    html::-webkit-scrollbar,
    body::-webkit-scrollbar,
    *::-webkit-scrollbar {
      display: none;
    }
  }
  
  /* Touch target sizing - minimum 44x44px for mobile accessibility */
  button, [role="button"], a, input[type="button"], input[type="submit"], input[type="checkbox"], input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Prevent text selection on interactive elements */
  button, [role="button"], label, input[type="checkbox"], input[type="radio"], [role="tab"], .no-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Disable long-press context menu on touch elements */
  button, [role="button"], a {
    -webkit-touch-callout: none;
  }

  * {
    @apply border-border outline-ring/50;
  }
  body {
    @apply bg-background text-foreground;
  }
}

@layer utilities {
  /* Touch-responsive scrolling on all screens */
  main, body, html {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Screen reader only utility */
  .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;
  }

  .not-sr-only {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
  }

  /* Safe area utilities with fallbacks for notched Android devices */
  .safe-area-bottom {
    padding-bottom: max(constant(safe-area-inset-bottom), 1rem);
    padding-bottom: max(env(safe-area-inset-bottom), 1rem);
  }
  
  .safe-area-top {
    padding-top: max(constant(safe-area-inset-top), 0.5rem);
    padding-top: max(env(safe-area-inset-top), 0.5rem);
  }
  
  .safe-area-left {
    padding-left: max(constant(safe-area-inset-left), 0.5rem);
    padding-left: max(env(safe-area-inset-left), 0.5rem);
  }
  
  .safe-area-right {
    padding-right: max(constant(safe-area-inset-right), 0.5rem);
    padding-right: max(env(safe-area-inset-right), 0.5rem);
  }
  
  .safe-area-inset-all {
    padding-top: max(constant(safe-area-inset-top), 0.5rem);
    padding-top: max(env(safe-area-inset-top), 0.5rem);
    padding-bottom: max(constant(safe-area-inset-bottom), 1rem);
    padding-bottom: max(env(safe-area-inset-bottom), 1rem);
    padding-left: max(constant(safe-area-inset-left), 0.5rem);
    padding-left: max(env(safe-area-inset-left), 0.5rem);
    padding-right: max(constant(safe-area-inset-right), 0.5rem);
    padding-right: max(env(safe-area-inset-right), 0.5rem);
  }
  
  /* Prevent accidental text selection on UI elements */
  .no-text-select {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
  }
  
  /* Optimize touch interactions on mobile */
  .touch-optimize {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
  }
  
  .scrollable-container {
    overflow-y: auto;
    overscroll-behavior-y: contain;
    -webkit-overflow-scrolling: touch;
  }
  
  .sticky-header {
    position: sticky;
    top: 0;
    z-index: 30;
  }
  
  .sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 30;
  }
  
  .no-select {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
  }
  
  .touch-action-pan-y {
    touch-action: pan-y;
  }
  
  .touch-action-pan-x {
    touch-action: pan-x;
  }
  
  .touch-action-manipulation {
    touch-action: manipulation;
  }

  /* Explicit 44×44px touch target utility */
  .touch-min-44 {
    min-height: 44px !important;
    min-width: 44px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Shimmer animation for image placeholders */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}