/* ============================================
   BOTICA AI — MAIN CSS
   Global variables, reset, body, scrollbar, animations
   ============================================ */

:root {
  /* ── Botica Workspace design tokens (from Claude Design handoff) ──
     Primary: #3558F0 (precision indigo-blue)
     BG:      #F0F3FA, Card #FFFFFF
     Sidebar: #0E1525 (always dark)
     Text:    #0E1525 / #5B6685 / #9BA3BB
  */
  --color-primary: #3558F0;
  --color-primary-dark: #2545D9;
  --color-primary-10: rgba(53, 88, 240, 0.1);
  --color-primary-05: rgba(53, 88, 240, 0.05);
  --color-primary-soft: #EBF0FF;
  --color-primary-glow: rgba(53, 88, 240, 0.28);
  --color-bg: #F0F3FA;
  --color-surface: #FFFFFF;
  --color-surface-alt: #F0F3FA;
  --color-border: #E2E6F0;
  --color-border-hover: rgba(53, 88, 240, 0.25);
  --color-text: #0E1525;
  --color-text-secondary: #5B6685;
  --color-text-muted: #9BA3BB;
  --color-text-mid: #5B6685;
  --color-text-body: #0E1525;
  --color-success: #22C773;
  --color-success-bg: rgba(34, 199, 115, 0.1);
  --color-success-dark: #1EAE65;
  --color-warning: #D76E14;
  --color-warning-bg: rgba(215, 110, 20, 0.1);
  --color-error: #EF4444;
  --color-hover-bg: #F0F3FA;
  --color-border-light: #E2E6F0;

  /* Sidebar (always-dark in this design) */
  --sb-bg:       #0E1525;
  --sb-hover:    rgba(255, 255, 255, 0.055);
  --sb-active:   rgba(53, 88, 240, 0.16);
  --sb-border:   rgba(255, 255, 255, 0.08);
  --sb-txt:      #7B8BAD;
  --sb-txt-h:    #C4CEEA;
  --sb-txt-a:    #E8ECF8;

  /* Gradients */
  --gradient-primary: linear-gradient(140deg, #3558F0 0%, #6B8FFF 100%);
  --gradient-primary-soft: linear-gradient(135deg, rgba(53, 88, 240, 0.1), rgba(53, 88, 240, 0.05));

  /* Shadows — Botica scale */
  --shadow-xs: 0 1px 3px rgba(14, 21, 37, 0.05);
  --shadow-sm: 0 1px 3px rgba(14, 21, 37, 0.07), 0 1px 2px rgba(14, 21, 37, 0.04);
  --shadow-md: 0 4px 16px rgba(14, 21, 37, 0.09), 0 2px 6px rgba(14, 21, 37, 0.05);
  --shadow-lg: 0 8px 32px rgba(14, 21, 37, 0.11), 0 4px 10px rgba(14, 21, 37, 0.06);
  --shadow-primary-sm: 0 2px 10px var(--color-primary-glow);
  --shadow-primary-md: 0 4px 14px var(--color-primary-glow);
  --shadow-primary-lg: 0 8px 28px var(--color-primary-glow);

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 9px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 22px;
  --radius-full: 9999px;

  /* Sidebar */
  --sidebar-width: 248px;
}

/* ── Dark mode (Botica Workspace design) ── */
body.dark {
  /* Tells native form controls (select dropdowns, scrollbars, date pickers)
     to use dark theming so the OS-rendered option list is not white-on-white. */
  color-scheme: dark;
  --color-bg:           #0C1120;
  --color-surface:      #141C30;
  --color-surface-alt:  #0C1120;
  --color-border:       rgba(255, 255, 255, 0.08);
  --color-border-hover: rgba(53, 88, 240, 0.4);
  --color-border-light: rgba(255, 255, 255, 0.12);
  --color-text:         #E4E9F7;
  --color-text-secondary:#7B8BAD;
  --color-text-muted:   #404D6A;
  --color-text-mid:     #7B8BAD;
  --color-text-body:    #D0D8F0;
  --color-hover-bg:     rgba(255, 255, 255, 0.04);

  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35), 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 4px 18px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5), 0 4px 10px rgba(0, 0, 0, 0.3);

  /* sidebar slightly darker than main, to maintain separation */
  --sb-bg: #0A0F1E;

  /* Transitions */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 0.15s var(--ease-smooth);
  --transition-base: 0.2s var(--ease-smooth);
  --transition-slow: 0.3s var(--ease-smooth);
}

/* Global fallback for native <select> option backgrounds in dark mode — some
   browsers ignore color-scheme on body alone, so style options directly. */
body.dark select option,
body.dark select optgroup {
  background-color: #141C30;
  color: #E4E9F7;
}

/* Reset */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Rubik', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--color-bg);
  height: 100vh;
  overflow: hidden;
  color: var(--color-text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App layout */
.app-container {
  width: 100%;
  height: 100vh;
  display: flex;
}

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--color-bg);
  min-width: 0;
  overflow: hidden;
  position: relative;
}

/* Content area (Botica Workspace style) */
.content-area {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 40px 24px 160px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse 80% 50% at 50% 30%,
    rgba(53, 88, 240, 0.04) 0%, transparent 70%);
}
.content-area::-webkit-scrollbar { width: 4px; }
.content-area::-webkit-scrollbar-track { background: transparent; }
.content-area::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 2px;
}
.content-area--fullbleed {
  padding: 0 !important;
  overflow: hidden !important;
}
/* Screens without the floating chat input — drop the 160px bottom reservation. */
.content-area--no-input {
  padding-bottom: 24px;
}

/* Screen transitions */
.screen {
  display: none;
  animation: screenFadeIn 0.3s var(--ease-smooth);
}

.screen.active {
  display: block;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-light);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* Animations */
@keyframes screenFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-10px); opacity: 1; }
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes slideInDown {
  from { opacity: 0; transform: translateY(-20px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(20px) scale(0.95); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Utility */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.hidden { display: none !important; }
