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

/* Note: Stripe test mode badge cannot be hidden via CSS without breaking payment forms */

/* Global restrictions - disable select, copy, paste, context menu */
*:not(input):not(textarea):not([contenteditable="true"]) {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
  -webkit-tap-highlight-color: transparent !important;
}

/* Allow selection only in input fields */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* Mobile specific restrictions */
@media (hover: none) and (pointer: coarse) {
  html {
    touch-action: manipulation;
    -ms-touch-action: manipulation;
  }
  
  body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
  }
}

/* Definition of the design system. All colors, gradients, fonts, etc should be defined here. 
All colors MUST be HSL.
*/

@layer base {
  :root {
    --background: 45 15% 97%;
    --foreground: 25 35% 15%;

    --card: 0 0% 100%;
    --card-foreground: 25 35% 15%;

    --popover: 0 0% 100%;
    --popover-foreground: 25 35% 15%;

    --primary: 15 88% 55%;
    --primary-foreground: 45 15% 97%;

    --secondary: 35 45% 85%;
    --secondary-foreground: 25 35% 15%;

    --muted: 35 25% 92%;
    --muted-foreground: 25 20% 45%;

    --accent: 45 95% 65%;
    --accent-foreground: 25 35% 15%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 45 15% 97%;

    --border: 35 25% 88%;
    --input: 35 25% 88%;
    --ring: 15 88% 55%;

    /* Custom township-inspired tokens */
    --kota-red: 15 88% 55%;
    --kota-yellow: 45 95% 65%;
    --kota-brown: 25 35% 35%;
    --kota-cream: 45 25% 95%;
    
    /* Gradients */
    --gradient-warm: linear-gradient(135deg, hsl(var(--kota-red)), hsl(var(--kota-yellow)));
    --gradient-food: linear-gradient(180deg, hsl(var(--kota-cream)), hsl(var(--secondary)));
    --gradient-auth: linear-gradient(135deg, hsl(var(--kota-red)), hsl(var(--kota-yellow)));
    --gradient-glass: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    --gradient-button: linear-gradient(135deg, hsl(var(--kota-red)), hsl(var(--kota-yellow)));
    
    /* Shadows */
    --shadow-food: 0 8px 25px -8px hsl(var(--kota-red) / 0.2);
    --shadow-card: 0 4px 12px -4px hsl(var(--kota-brown) / 0.1);
    --shadow-glass: 0 8px 32px rgba(0, 0, 0, 0.37);
    --shadow-glow: 0 0 60px hsl(var(--kota-red) / 0.4);

    --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: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;

    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;

    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;

    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;

    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;

    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;

    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;

    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 212.7 26.8% 83.9%;
    --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 {
  * {
    @apply border-border;
  }

  html {
    scroll-behavior: smooth;
    /* Prevent content jump when scrollbar appears */
    overflow-y: scroll;
  }

  body {
    @apply bg-background text-foreground;
    /* Safe area insets for mobile devices */
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
  }

  /* Ensure anchor targets scroll to visible area below sticky header */
  [id] {
    scroll-margin-top: calc(80px + env(safe-area-inset-top, 0px));
  }

  /* Main content area - ensure it's never hidden behind header */
  main, .main-content {
    min-height: calc(100vh - 80px - env(safe-area-inset-top, 0px));
  }
}

/* Animated Navbar Styles */
.navbar-container:hover .outline-rect {
  transition: 999999s;
  stroke-dashoffset: 1;
  stroke-dasharray: 0;
}

/* Target navigation links specifically within the nav center container */
.navbar-container .flex-1 a:nth-child(1):hover ~ .absolute .outline-rect,
.navbar-container .flex-1 a:nth-child(1):hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 2 8 73.3 8 10.7;
  transition: 0.5s !important;
}

.navbar-container .flex-1 a:nth-child(2):hover ~ .absolute .outline-rect,
.navbar-container .flex-1 a:nth-child(2):hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 12.6 9.5 49.3 9.5 31.6;
  transition: 0.5s !important;
}

.navbar-container .flex-1 a:nth-child(3):hover ~ .absolute .outline-rect,
.navbar-container .flex-1 a:nth-child(3):hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 24.5 8.5 27.5 8.5 55.5;
  transition: 0.5s !important;
}

.navbar-container .flex-1 a:nth-child(4):hover ~ .absolute .outline-rect,
.navbar-container .flex-1 a:nth-child(4):hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 34.7 6.9 10.2 6.9 76;
  transition: 0.5s !important;
}

/* Alternative approach using data attributes for more reliable targeting */
.navbar-container [data-nav="home"]:hover ~ .absolute .outline-rect,
.navbar-container [data-nav="home"]:hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 2 8 73.3 8 10.7;
  transition: 0.5s !important;
}

.navbar-container [data-nav="menu"]:hover ~ .absolute .outline-rect,
.navbar-container [data-nav="menu"]:hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 12.6 9.5 49.3 9.5 31.6;
  transition: 0.5s !important;
}

.navbar-container [data-nav="order"]:hover ~ .absolute .outline-rect,
.navbar-container [data-nav="order"]:hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 24.5 8.5 27.5 8.5 55.5;
  transition: 0.5s !important;
}

.navbar-container [data-nav="contact"]:hover ~ .absolute .outline-rect,
.navbar-container [data-nav="contact"]:hover ~ * .outline-rect {
  stroke-dashoffset: 0;
  stroke-dasharray: 0 34.7 6.9 10.2 6.9 76;
  transition: 0.5s !important;
}

/* Glow pulse animation for highlighted text */
@keyframes glow-pulse {
  0%, 100% {
    filter: drop-shadow(0 0 8px rgba(255, 193, 7, 0.6));
  }
  50% {
    filter: drop-shadow(0 0 20px rgba(255, 193, 7, 0.9));
  }
}

.animate-glow-pulse {
  animation: glow-pulse 2s ease-in-out infinite;
}
