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

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

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;

    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;

    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;

    --primary: 320 75% 60%;
    --primary-foreground: 0 0% 100%;
    --primary-glow: 320 75% 70%;

    --secondary: 45 93% 83%;
    --secondary-foreground: 222.2 84% 4.9%;

    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;

    --accent: 320 75% 60%;
    --accent-foreground: 0 0% 100%;

    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;

    --success: 320 75% 55%;
    --success-foreground: 0 0% 100%;
    
    --warning: 320 60% 65%;
    --warning-foreground: 0 0% 100%;
    
    --info: 320 50% 70%;
    --info-foreground: 0 0% 100%;
    
    /* Accessible badge colors with proper contrast ratios */
    --badge-highlight-bg: 320 75% 90%;
    --badge-highlight-text: 320 75% 30%;

    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 320 75% 60%;

    /* Subtle gradient for backgrounds */
    --gradient-subtle: linear-gradient(180deg, hsl(0 0% 100%), hsl(210 40% 98%));

    /* Beauty-focused gradients */
    --gradient-primary: linear-gradient(135deg, hsl(320 75% 60%), hsl(320 75% 70%));
    --gradient-secondary: linear-gradient(135deg, hsl(45 93% 83%), hsl(45 93% 90%));
    --gradient-hero: linear-gradient(135deg, hsl(320 75% 60%), hsl(320 75% 70%));
    
    /* Elegant shadows */
    --shadow-elegant: 0 20px 60px -10px hsl(320 75% 60% / 0.3);
    --shadow-glow: 0 0 40px hsl(320 75% 70% / 0.4);
    
    /* Smooth transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);

    --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: 225 15% 8%;
    --foreground: 210 20% 90%;

    --card: 224 14% 11%;
    --card-foreground: 210 20% 90%;

    --popover: 224 14% 11%;
    --popover-foreground: 210 20% 90%;

    --primary: 320 45% 55%;
    --primary-foreground: 225 15% 8%;

    --secondary: 224 12% 16%;
    --secondary-foreground: 210 20% 90%;

    --muted: 224 12% 16%;
    --muted-foreground: 215 15% 60%;

    --accent: 224 12% 20%;
    --accent-foreground: 210 20% 90%;

    --destructive: 0 65% 50%;
    --destructive-foreground: 210 20% 90%;

    --success: 142 71% 45%;
    --success-foreground: 0 0% 100%;
    
    --warning: 38 92% 50%;
    --warning-foreground: 0 0% 100%;
    
    --info: 221 83% 53%;
    --info-foreground: 0 0% 100%;
    
    /* Accessible badge colors for dark mode */
    --badge-highlight-bg: 320 45% 25%;
    --badge-highlight-text: 320 45% 85%;

    --border: 224 12% 20%;
    --input: 224 12% 20%;
    --ring: 320 45% 55%;
    --sidebar-background: 225 15% 8%;
    --sidebar-foreground: 210 20% 85%;
    --sidebar-primary: 320 45% 55%;
    --sidebar-primary-foreground: 225 15% 8%;
    --sidebar-accent: 224 12% 16%;
    --sidebar-accent-foreground: 210 20% 85%;
    --sidebar-border: 224 12% 20%;
    --sidebar-ring: 320 45% 55%;
    
    /* Dark mode gradients with softer tones */
    --gradient-subtle: linear-gradient(180deg, hsl(225 15% 8%), hsl(224 14% 11%));
    --gradient-primary: linear-gradient(135deg, hsl(320 45% 55%), hsl(320 45% 65%));
    --gradient-secondary: linear-gradient(135deg, hsl(224 12% 16%), hsl(224 12% 20%));
    --gradient-hero: linear-gradient(135deg, hsl(320 45% 55%), hsl(320 45% 65%));
    
    /* Softer shadows for dark mode */
    --shadow-elegant: 0 20px 60px -10px hsl(320 45% 55% / 0.2);
    --shadow-glow: 0 0 40px hsl(320 45% 65% / 0.3);
  }
}

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

  body {
    @apply bg-background text-foreground;
    font-display: swap;
  }

  /* Prevent layout shifts during font loading */
  h1, h2, h3, h4, h5, h6 {
    font-display: swap;
  }

  /* Stabilize hero section layout */
  .hero-container {
    min-height: 100vh;
    contain: layout style paint;
  }

  /* Mobile touch optimization */
  button, [role="button"], .cursor-pointer {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
  }

  /* Mobile responsive optimizations */
  @media (max-width: 768px) {
    /* Ensure touch targets meet accessibility standards */
    button, [role="button"] {
      min-height: 44px;
      min-width: 44px;
      position: relative;
      z-index: 1;
    }

    /* Container constraints to prevent overflow */
    .container,
    .max-w-7xl,
    .max-w-6xl,
    .max-w-5xl,
    .max-w-4xl {
      margin-left: 1rem;
      margin-right: 1rem;
      max-width: calc(100vw - 2rem);
      padding-left: 0;
      padding-right: 0;
    }

    /* Main content padding for mobile */
    main {
      padding-left: 1rem;
      padding-right: 1rem;
      padding-bottom: 80px; /* Space for bottom navigation */
    }

    /* Card responsive design */
    .card {
      margin-left: 0;
      margin-right: 0;
      border-radius: 0.75rem;
    }

    /* Calendar mobile optimizations */
    .rdp {
      font-size: 14px;
      width: 100%;
      max-width: 100%;
      margin: 0;
      min-width: 280px;
    }
    
    .rdp-table {
      width: 100%;
      table-layout: fixed;
      min-width: 280px;
    }
    
    .rdp-cell {
      padding: 1px;
      text-align: center;
      min-width: 36px;
    }
    
    .rdp-day {
      width: 32px;
      height: 32px;
      font-size: 12px;
      display: flex;
      align-items: center;
      justify-content: center;
      margin: 0 auto;
    }

    .rdp-head_cell {
      font-size: 10px;
      font-weight: 500;
      padding: 2px;
      min-width: 36px;
    }

    /* Popover mobile positioning */
    [data-radix-popper-content-wrapper] {
      transform-origin: center !important;
      z-index: 50;
    }
    
    .rdp-month {
      width: 100%;
      overflow: hidden;
    }
    
    .rdp-caption {
      padding: 0 2rem;
    }

    /* Tabs mobile responsive */
    .tabs-list {
      flex-wrap: wrap;
      gap: 4px;
      justify-content: flex-start;
    }
    
    .tabs-trigger {
      min-width: auto;
      padding: 8px 12px;
      font-size: 12px;
      flex-shrink: 0;
    }

    /* Dialog and modal mobile optimizations */
    .dialog-content,
    .sheet-content {
      max-width: calc(100vw - 1rem);
      max-height: calc(100vh - 2rem);
      margin: 0.5rem;
    }

    /* Bottom navigation safe area */
    .mobile-bottom-nav {
      padding-bottom: env(safe-area-inset-bottom);
      pointer-events: auto;
      touch-action: manipulation;
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
    }

    .safe-area-pb {
      padding-bottom: calc(env(safe-area-inset-bottom) + 0.5rem);
    }

    /* Fix mobile navigation z-index issues */
    .mobile-nav-overlay {
      position: fixed;
      inset: 0;
      z-index: 50;
      pointer-events: auto;
    }

    /* Prevent accidental zoom on inputs */
    input, select, textarea {
      font-size: 16px;
    }

    /* Improved button sizing for mobile */
    .btn-sm {
      padding: 6px 12px;
      font-size: 12px;
      min-height: 36px;
    }

    /* Text size adjustments for mobile */
    h1 { font-size: 1.875rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Spacing adjustments */
    .space-y-6 > * + * {
      margin-top: 1rem;
    }
    
    .space-y-4 > * + * {
      margin-top: 0.75rem;
    }

    /* Grid responsive adjustments */
    .grid-cols-2 {
      gap: 0.75rem;
    }
    
    .grid-cols-3 {
      grid-template-columns: repeat(2, 1fr);
      gap: 0.75rem;
    }
  }
}