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

/* === Self-hosted Geist (extrait du SingleFile Lovable) ===
   NB : les 5 poids pointent volontairement vers le même fichier — c'est
   l'état tel qu'il est dans le SingleFile. Le navigateur synthétise les
   graisses, comme sur la vraie page Lovable.
*/
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("/assets/geist-300-e5c2f810.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/geist-400-e5c2f810.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/assets/geist-500-e5c2f810.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/geist-600-e5c2f810.woff2") format("woff2");
}
@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/geist-700-e5c2f810.woff2") format("woff2");
}

@layer base {
  :root {
    /* === Brand palette (HSL) — extraite du SingleFile Lovable === */
    --brand-gold-50: 42 38% 95%;
    --brand-gold-100: 41 41% 85%;
    --brand-gold-200: 39 44% 75%;
    --brand-gold-300: 38 45% 65%;
    --brand-gold-400: 39 41% 55%;
    --brand-gold-main: 41 43% 45%;
    --brand-gold-600: 41 42% 35%;
    --brand-gold-700: 41 41% 25%;
    --brand-gold-800: 33 87% 14%;
    --brand-gold-900: 32 25% 6%;

    --brand-neutral-50: 0 0% 100%;
    --brand-neutral-white: 0 0% 98%;
    --brand-neutral-200: 0 0% 93%;
    --brand-neutral-300: 0 0% 89%;
    --brand-neutral-400: 0 0% 75%;
    --brand-neutral-500: 0 0% 60%;
    --brand-neutral-600: 0 0% 40%;
    --brand-neutral-700: 0 0% 16%;
    --brand-neutral-black: 0 0% 0%;

    --brand-green-100: 138 53% 96%;
    --brand-green-200: 142 36% 81%;
    --brand-green-500: 142 46% 33%;
    --brand-green-700: 142 76% 36%;

    --brand-orange-50: 22 100% 96%;
    --brand-orange-500: 19 71% 58%;
    --brand-orange-700: 18 64% 47%;

    --brand-blue-500: 210 62% 44%;

    /* === Surfaces additionnelles === */
    --background-subtle: 0 0% 98%;
    --background-cream: 42 38% 95%;

    /* === Gradients dorés (utilisés pour CTAs et bandeau "+ CONNECT") === */
    --grad-primary: linear-gradient(99deg, #BD9733 0%, #E5D29F 25%, #E8CC6E 50%, #E5D29F 75%, #FFF4C2 100%);
    --ds-grad-gold: linear-gradient(135deg, #CBB480 0%, #E9DFC9 25%, #BC9E5C 55%, #A38543 100%);
    --ds-grad-gold-light: linear-gradient(135deg, #F8F4ED 0%, #E9DFC9 50%, #CBB480 100%);
    --ds-grad-gold-dark: linear-gradient(135deg, #BC9E5C 0%, #A38543 50%, #7F6734 100%);
    --ds-grad-brown-btn: linear-gradient(135deg, #C4A559 0%, #D4BC7A 40%, #E5D4A0 70%, #EFE2B8 100%);
    --ds-grad-text-gold: linear-gradient(135deg, #A38543 0%, #CBB480 50%, #A38543 100%);

    /* === Typographie (alias DS → Geist) === */
    --ds-font-sans: "Geist", system-ui, sans-serif;
    --ds-font-serif: "Geist", system-ui, sans-serif;

    /* === Aliases DS → brand (compat avec classes Lovable .ds-*) === */
    --ds-gold-50: var(--brand-gold-50);
    --ds-gold-100: var(--brand-gold-100);
    --ds-gold-200: var(--brand-gold-200);
    --ds-gold-300: var(--brand-gold-300);
    --ds-gold-400: var(--brand-gold-400);
    --ds-gold-500: var(--brand-gold-600);
    --ds-gold-600: var(--brand-gold-700);
    --ds-gold-700: var(--brand-gold-800);
    --ds-gold-800: var(--brand-gold-900);
    --ds-gold-main: var(--brand-gold-main);
    --ds-neutral-50: var(--brand-neutral-50);
    --ds-neutral-200: var(--brand-neutral-200);
    --ds-neutral-300: var(--brand-neutral-300);
    --ds-neutral-400: var(--brand-neutral-400);
    --ds-neutral-500: var(--brand-neutral-500);
    --ds-neutral-600: var(--brand-neutral-600);
    --ds-neutral-700: var(--brand-neutral-700);
    --ds-neutral-black: var(--brand-neutral-black);
    --ds-neutral-white: var(--brand-neutral-white);
    --ds-green-100: var(--brand-green-100);
    --ds-green-200: var(--brand-green-200);
    --ds-green-500: var(--brand-green-500);
    --ds-green-700: var(--brand-green-700);

    /* === Tokens shadcn (mappés sur la palette brand) === */
    --background: var(--brand-neutral-50);
    --foreground: var(--brand-neutral-black);
    --card: var(--brand-neutral-white);
    --card-foreground: var(--brand-neutral-black);
    --popover: var(--brand-neutral-50);
    --popover-foreground: var(--brand-neutral-black);
    --primary: var(--brand-gold-main);
    --primary-foreground: var(--brand-neutral-black);
    --secondary: var(--brand-neutral-200);
    --secondary-foreground: var(--brand-neutral-700);
    --muted: var(--brand-neutral-200);
    --muted-foreground: var(--brand-neutral-600);
    --accent: var(--brand-gold-50);
    --accent-foreground: var(--brand-gold-800);
    --destructive: 0 72% 51%;
    --destructive-foreground: var(--brand-neutral-50);
    --border: var(--brand-neutral-300);
    --input: var(--brand-neutral-300);
    --ring: var(--brand-gold-main);
    --radius: 10px;

    /* === Sidebar tokens === */
    --sidebar-background: var(--brand-neutral-white);
    --sidebar-foreground: var(--brand-neutral-700);
    --sidebar-primary: var(--brand-gold-main);
    --sidebar-primary-foreground: var(--brand-neutral-black);
    --sidebar-accent: var(--brand-gold-50);
    --sidebar-accent-foreground: var(--brand-gold-800);
    --sidebar-border: var(--brand-neutral-300);
    --sidebar-ring: var(--brand-gold-main);
  }

  * {
    border-color: hsl(var(--border));
  }

  html,
  body {
    font-family: "Geist", system-ui, sans-serif;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
  }

}

@layer components {
  /* === DS Buttons === */
  .ds-btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--ds-grad-brown-btn);
    color: #1A1614;
    box-shadow: 0 2px 10px rgba(184,145,42,0.32), inset 0 1px 0 rgba(255,255,255,0.4);
    font-family: var(--ds-font-sans);
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
  }
  .ds-btn-gold:hover { opacity: 0.9; }

  .ds-btn-black {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: hsl(var(--brand-neutral-black));
    color: white;
    font-family: var(--ds-font-sans);
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    border-radius: 9999px;
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
    text-decoration: none;
  }
  .ds-btn-black:hover { opacity: 0.9; }

  .ds-btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: hsl(var(--brand-neutral-700));
    font-family: var(--ds-font-sans);
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--brand-neutral-300));
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
  }
  .ds-btn-outline:hover {
    background: hsl(var(--brand-neutral-200));
  }

  .ds-btn-outline-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    background: transparent;
    color: hsl(var(--brand-gold-main));
    font-family: var(--ds-font-sans);
    font-weight: 600;
    font-size: 14px;
    line-height: 20px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--brand-gold-300));
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
  }
  .ds-btn-outline-gold:hover {
    background: hsl(var(--brand-gold-50));
  }

  .ds-btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    line-height: 18px;
  }

  .ds-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
    line-height: 24px;
  }

  /* === DS Badges === */
  .ds-badge-green {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(var(--brand-green-100));
    color: hsl(var(--brand-green-700));
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .ds-badge-gold {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(var(--brand-gold-50));
    color: hsl(var(--brand-gold-main));
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--brand-gold-200));
  }

  .ds-badge-red {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(0 72% 96%);
    color: hsl(0 72% 51%);
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .ds-badge-orange {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(var(--brand-orange-50));
    color: hsl(var(--brand-orange-700));
    font-size: 12px;
    font-weight: 600;
    line-height: 16px;
    border-radius: 9999px;
  }

  .ds-badge-verified {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: hsl(var(--brand-green-100));
    color: hsl(var(--brand-green-700));
    font-size: 12px;
    font-weight: 700;
    line-height: 16px;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* === DS Chips (catégorisation) === */
  .ds-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: hsl(var(--brand-gold-50));
    color: hsl(var(--brand-gold-main));
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--brand-gold-200));
    white-space: nowrap;
  }

  .ds-chip-neutral {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: hsl(var(--brand-neutral-white));
    color: hsl(var(--brand-neutral-700));
    font-size: 12px;
    font-weight: 500;
    line-height: 16px;
    border-radius: 9999px;
    border: 1px solid hsl(var(--brand-neutral-300));
    white-space: nowrap;
  }

  /* === DS Cards === */
  .ds-card {
    background: white;
    border: 1px solid hsl(var(--brand-neutral-200));
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  }

  .ds-card-cream {
    background: hsl(var(--background-cream));
    border: 1px solid hsl(var(--brand-gold-100));
    border-radius: 12px;
    padding: 20px;
  }

  .ds-card-glass {
    background: white;
    border: 1px solid hsl(var(--brand-neutral-200));
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  }

  /* === DS Sidebar card titles (gold italic) === */
  .ds-title-gold {
    font-size: 16px;
    font-weight: 600;
    line-height: 24px;
    color: hsl(var(--brand-gold-main));
    font-style: italic;
    font-family: "Playfair Display", Georgia, serif;
  }

  /* === DS KPI cards === */
  .ds-kpi-card {
    background: white;
    border: 1px solid hsl(var(--brand-neutral-200));
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .ds-kpi-card .ds-kpi-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: hsl(var(--brand-neutral-500));
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .ds-kpi-card .ds-kpi-value {
    font-size: 28px;
    font-weight: 700;
    line-height: 32px;
    color: hsl(var(--brand-neutral-black));
  }
  .ds-kpi-card .ds-kpi-sub {
    font-size: 12px;
    color: hsl(var(--brand-neutral-500));
  }
  .ds-kpi-card .ds-kpi-sub.positive {
    color: hsl(var(--brand-green-700));
  }

  /* === DS Toggle === */
  .ds-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    background: hsl(var(--brand-neutral-300));
    border-radius: 9999px;
    cursor: pointer;
    transition: background 0.2s;
  }
  .ds-toggle.active {
    background: hsl(var(--brand-gold-main));
  }
  .ds-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 9999px;
    transition: transform 0.2s;
  }
  .ds-toggle.active::after {
    transform: translateX(20px);
  }

  /* === DS Section labels === */
  .ds-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: hsl(var(--brand-gold-main));
  }

  /* === DS Activity indicator === */
  .ds-activity-dot {
    width: 8px;
    height: 8px;
    border-radius: 9999px;
    background: hsl(var(--brand-green-500));
    display: inline-block;
  }
  .ds-activity-dot.away {
    background: hsl(var(--brand-orange-500));
  }

  /* === DS Messages card === */
  .ds-messages-card {
    background: white;
    border: 1px solid hsl(var(--brand-neutral-200));
    border-radius: 12px;
    padding: 20px;
  }

  /* === DS Availability banner === */
  .ds-availability-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    background: hsl(var(--brand-gold-50));
    border: 1px solid hsl(var(--brand-gold-200));
    border-radius: 12px;
  }

  /* === Page V2 (notre interpretation DS) — guards overflow horizontal === */
  .tp-v2-root {
    overflow-x: clip;
    max-width: 100vw;
    width: 100%;
  }
  .tp-v2-root main {
    overflow-x: clip;
    max-width: 100%;
  }
  .tp-v2-root section,
  .tp-v2-root header,
  .tp-v2-root footer {
    max-width: 100%;
  }
  .tp-v2-root h1,
  .tp-v2-root h2,
  .tp-v2-root h3,
  .tp-v2-root p {
    overflow-wrap: anywhere;
    word-break: normal;
  }
}
