@import "tailwindcss/index.css";
@import "@nuxt/ui-pro";

/* Import fonts */
@import "./fonts.css";

@theme {
  --container-8xl: 82rem;

  /* Nuxt UI Theme Variables */
  --text-color-dimmed: var(--ui-text-dimmed);
  --text-color-muted: var(--ui-text-muted);
  --text-color-toned: var(--ui-text-toned);
  --text-color-default: var(--ui-text);
  --text-color-highlighted: var(--ui-text-highlighted);
  --text-color-inverted: var(--ui-text-inverted);
  --background-color-default: var(--ui-bg);
  --background-color-muted: var(--ui-bg-muted);
  --background-color-elevated: var(--ui-bg-elevated);
  --background-color-accented: var(--ui-bg-accented);
  --background-color-inverted: var(--ui-bg-inverted);
  --background-color-border: var(--ui-border);
  --border-color-default: var(--ui-border);
  --border-color-muted: var(--ui-border-muted);
  --border-color-accented: var(--ui-border-accented);
  --border-color-inverted: var(--ui-border-inverted);
  --border-color-bg: var(--ui-bg);
  --ring-color-default: var(--ui-border);
  --ring-color-muted: var(--ui-border-muted);
  --ring-color-accented: var(--ui-border-accented);
  --ring-color-inverted: var(--ui-border-inverted);
  --ring-color-bg: var(--ui-bg);
  --ring-offset-color-default: var(--ui-border);
  --ring-offset-color-muted: var(--ui-border-muted);
  --ring-offset-color-accented: var(--ui-border-accented);
  --ring-offset-color-inverted: var(--ui-border-inverted);
  --ring-offset-color-bg: var(--ui-bg);
  --divide-color-default: var(--ui-border);
  --divide-color-muted: var(--ui-border-muted);
  --divide-color-accented: var(--ui-border-accented);
  --divide-color-inverted: var(--ui-border-inverted);
  --divide-color-bg: var(--ui-bg);
  --outline-color-default: var(--ui-border);
  --outline-color-inverted: var(--ui-border-inverted);
  --stroke-color-default: var(--ui-border);
  --stroke-color-inverted: var(--ui-border-inverted);
  --fill-color-default: var(--ui-border);
  --fill-color-inverted: var(--ui-border-inverted);

  /* Primary Colors - Authentic Inca Gold/Sun (Inti) */
  --color-primary-50: #fef7f0;
  --color-primary-100: #fdecd8;
  --color-primary-200: #fbd5b0;
  --color-primary-300: #f8b87d;
  --color-primary-400: #f59347;
  --color-primary-500: #e67e22; /* Authentic Inca Gold - less saturated for web */
  --color-primary-600: #d35400; /* Deeper Inca Gold */
  --color-primary-700: #a04000; /* Rich Inca Gold */
  --color-primary-800: #8b4513; /* Saddle Brown - Inca Earth */
  --color-primary-900: #654321; /* Dark Brown - Inca Stone */
  --color-primary-950: #3e2723; /* Deep Brown - Inca Architecture */

  /* Secondary Colors - Andean Sky & Sacred Waters */
  --color-secondary-50: #f0f9ff;
  --color-secondary-100: #e0f2fe;
  --color-secondary-200: #bae6fd;
  --color-secondary-300: #7dd3fc;
  --color-secondary-400: #38bdf8;
  --color-secondary-500: #0ea5e9; /* Andean Sky Blue */
  --color-secondary-600: #0284c7; /* Deeper Sky */
  --color-secondary-700: #0369a1; /* Lake Titicaca Blue */
  --color-secondary-800: #075985; /* Sacred Waters */
  --color-secondary-900: #0c4a6e; /* Deep Waters */
  --color-secondary-950: #082f49; /* Night Sky */

  /* Tertiary Colors - Inca Textile Colors */
  --color-tertiary-50: #fdf2f8;
  --color-tertiary-100: #fce7f3;
  --color-tertiary-200: #fbcfe8;
  --color-tertiary-300: #f9a8d4;
  --color-tertiary-400: #f472b6;
  --color-tertiary-500: #ec4899; /* Inca Pink - from textiles */
  --color-tertiary-600: #db2777;
  --color-tertiary-700: #be185d;
  --color-tertiary-800: #9d174d;
  --color-tertiary-900: #831843;
  --color-tertiary-950: #500724;

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

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

  /* Error Colors - Inca Red (from ceramics) */
  --color-error-50: #fef2f2;
  --color-error-100: #fee2e2;
  --color-error-200: #fecaca;
  --color-error-300: #fca5a5;
  --color-error-400: #f87171;
  --color-error-500: #ef4444; /* Inca Red - from ceramics */
  --color-error-600: #dc2626;
  --color-error-700: #b91c1c;
  --color-error-800: #991b1b;
  --color-error-900: #7f1d1d;
  --color-error-950: #450a0a;

  /* Neutral Colors - Inca Stone & Earth (Light Theme) */
  --color-neutral-50: #fafaf9; /* Light Stone */
  --color-neutral-100: #f5f5f4; /* Stone Dust */
  --color-neutral-200: #e7e5e4; /* Light Stone */
  --color-neutral-300: #d6d3d1; /* Medium Stone */
  --color-neutral-400: #a8a29e; /* Stone Gray */
  --color-neutral-500: #78716c; /* Stone */
  --color-neutral-600: #57534e; /* Dark Stone */
  --color-neutral-700: #44403c; /* Deep Stone */
  --color-neutral-800: #292524; /* Inca Stone */
  --color-neutral-900: #1c1917; /* Dark Stone */
  --color-neutral-950: #0c0a09; /* Black Stone */

  /* Gray Colors - Light Theme Only */
  --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;

  /* Slate Colors - Andean Night (Dark Theme) */
  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-slate-950: #020617;

  /* Inca Earth Colors - Authentic Palette */
  --color-earth-50: #fef7f0;
  --color-earth-100: #fdecd8;
  --color-earth-200: #fbd5b0;
  --color-earth-300: #f8b87d;
  --color-earth-400: #f59347;
  --color-earth-500: #cd853f; /* Peru Earth */
  --color-earth-600: #b8860b; /* Dark Goldenrod */
  --color-earth-700: #a0522d; /* Sienna */
  --color-earth-800: #8b4513; /* Saddle Brown */
  --color-earth-900: #654321; /* Dark Brown */
  --color-earth-950: #3e2723; /* Deep Brown */
}

:root {
  /* Global UI Variables */
  --ui-header-height: 5rem;
  --ui-container: var(--container-8xl);

  /* Nuxt UI Light Mode Variables */
  --ui-text-dimmed: var(--color-neutral-400);
  --ui-text-muted: var(--color-neutral-500);
  --ui-text-toned: var(--color-neutral-600);
  --ui-text: var(--color-neutral-700);
  --ui-text-highlighted: var(--color-neutral-900);
  --ui-text-inverted: var(--color-white);

  --ui-bg: var(--color-white);
  --ui-bg-muted: var(--color-neutral-50);
  --ui-bg-elevated: var(--color-neutral-100);
  --ui-bg-accented: var(--color-neutral-200);
  --ui-bg-inverted: var(--color-neutral-900);

  --ui-border: var(--color-neutral-200);
  --ui-border-muted: var(--color-neutral-200);
  --ui-border-accented: var(--color-neutral-300);
  --ui-border-inverted: var(--color-neutral-900);
}

/* Custom utility classes */
.bg-stripes {
  width: 100%;
  background-size: 4px 4px;
  background-image: linear-gradient(
    -45deg,
    var(--color-neutral-200) 12.5%,
    transparent 12.5%,
    transparent 50%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-200) 62.5%,
    transparent 62.5%,
    transparent 100%
  );
}

.bg-stripes-inca {
  width: 100%;
  background-size: 4px 4px;
  background-image: linear-gradient(
    -45deg,
    var(--color-neutral-200) 12.5%,
    transparent 12.5%,
    transparent 50%,
    var(--color-neutral-200) 50%,
    var(--color-neutral-200) 62.5%,
    transparent 62.5%,
    transparent 100%
  );
}

/* Import Pattern Library */
@import "./patterns.css";

/* Import Shadow Effects */
@import "./shadows.css";

/* Import Gradient Effects */
@import "./gradients.css";

/* Force light mode globally - no dark mode */
html {
  color-scheme: light;
}

body {
  background-color: #9ca3af;
  min-height: 100vh;
  color-scheme: light;
}

/* Prevent body scroll on chat page */
body.chat-page {
  overflow: hidden;
  height: 100vh;
}

/* Ensure chat container takes full height */
.chat-container {
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Mobile-First Improvements for Peru Market */
@media (max-width: 640px) {
  /* Ensure minimum touch targets - only for native buttons, not Nuxt UI components */
  button:not([class*="u-"]):not([data-nuxt-ui]),
  [role="button"]:not([class*="u-"]):not([data-nuxt-ui]),
  input[type="submit"],
  input[type="button"] {
    min-height: 44px;
    min-width: 44px;
  }

  /* Improve text readability on small screens */
  body {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Optimize form inputs for mobile */
  input,
  textarea,
  select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Better mobile spacing - reduced padding/margins */
  .container {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }

  /* Optimize card spacing for mobile */
  .u-card {
    padding: 0.75rem;
  }

  /* Better mobile typography */
  h1 {
    font-size: 1.25rem; /* 20px */
    line-height: 1.75rem;
  }

  h2 {
    font-size: 1.125rem; /* 18px */
    line-height: 1.5rem;
  }

  p {
    font-size: 0.875rem; /* 14px */
    line-height: 1.25rem;
  }
}

/* Touch-friendly improvements */
.touch-manipulation {
  touch-action: manipulation;
}

/* Ensure body allows touch events on mobile */
body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Prevent loading screen from blocking interactions */
#initial-loading.fading,
#initial-loading.hidden {
  pointer-events: none !important;
  touch-action: none !important;
}

/* Fix button alignment issues on mobile - only for native buttons, not Nuxt UI components */
@media (max-width: 640px) {
  /* Apply alignment fix only to native buttons, not any Nuxt UI components */
  button:not([class*="u-"]):not([data-nuxt-ui]),
  [role="button"]:not([class*="u-"]):not([data-nuxt-ui]) {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  /* Fix icon alignment in native buttons only */
  button:not([class*="u-"]):not([data-nuxt-ui]) .u-icon,
  [role="button"]:not([class*="u-"]):not([data-nuxt-ui]) .u-icon {
    margin: 0 !important;
  }
}

/* Prevent text selection on interactive elements */
.select-none {
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Remove shadows from specific chat elements - exclude Nuxt UI switches and their children */
.u-chat-message-content,
.u-chat-prompt,
.u-chat-palette,
[class*="shadow"]:not([class*="u-switch"]):not([data-nuxt-ui-switch]) {
  box-shadow: none !important;
}

/* Ensure switches and their children keep their shadows */
[class*="u-switch"] [class*="shadow"],
[data-nuxt-ui-switch] [class*="shadow"] {
  box-shadow: revert !important;
}

/* chat height and scroll bar - RESPONSIVE HEIGHT */
.sidebar-conversations,
.flex-1.overflow-y-auto.bg-white {
  /* Mobile: reasonable height */
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
  overflow-y: auto !important;
}

/* Desktop: fixed height for better layout control */
@media (min-width: 640px) {
  .sidebar-conversations,
  .flex-1.overflow-y-auto.bg-white {
    height: calc(100vh - 240px) !important;
    max-height: calc(100vh - 240px) !important;
  }
}

/* Chat height utilities */
.chat-height-mobile {
  /* Mobile: reasonable height */
  height: calc(100vh - 120px);
  max-height: calc(100vh - 120px);
}

.chat-height-desktop {
  /* Desktop: fixed height */
  height: calc(100vh - 240px) !important;
  max-height: calc(100vh - 240px) !important;
}

/* Ensure messages container has fixed height on desktop */
@media (min-width: 640px) {
  .chat-messages-container {
    height: calc(
      100vh - 320px
    ) !important; /* Account for header, input, and padding */
    max-height: calc(100vh - 320px) !important;
    overflow-y: auto !important;
    flex-shrink: 0 !important;
  }
}

/* Performance optimizations for slow connections */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

/* Optimize image loading */
img[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s;
}

img[loading="lazy"].loaded {
  opacity: 1;
}

/* Reduce layout shifts */
.aspect-ratio {
  position: relative;
  width: 100%;
  height: 0;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
}

.aspect-ratio > * {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Optimize font loading */
@font-face {
  font-display: block;
}

/* Layout stability to prevent CLS */
html,
body {
  margin: 0;
  padding: 0;
}

#__nuxt {
  min-height: 100vh;
}

/* Font stability - use system fonts to prevent loading shifts */
html {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

body {
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
}

/* Prevent layout shifts during loading */
* {
  box-sizing: border-box;
}

/* Page loader animations */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.animate-spin {
  animation: spin 1s linear infinite;
}
