﻿/* ============================================
   ERUDY - Design System CSS
   + Knowledge Base Public (KB)
   ============================================ */

/* Reset SAFE (ne flingue pas Bootstrap/Metronic) */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
}

/* ============================================
   CSS Variables - Light Theme
   ============================================ */
:root {
    /* Colors */
    --background: hsl(0, 0%, 100%);
    --foreground: hsl(222.2, 84%, 4.9%);
    --card: hsl(0, 0%, 100%);
    --card-foreground: hsl(222.2, 84%, 4.9%);
    --popover: hsl(0, 0%, 100%);
    --popover-foreground: hsl(222.2, 84%, 4.9%);
    --primary: hsl(6, 100%, 75%);
    --primary-foreground: hsl(0, 0%, 100%);
    --secondary: hsl(24, 100%, 95%);
    --secondary-foreground: hsl(6, 80%, 50%);
    --muted: hsl(210, 40%, 96.1%);
    --muted-foreground: hsl(215.4, 16.3%, 46.9%);
    --accent: hsl(15, 100%, 70%);
    --accent-foreground: hsl(0, 0%, 100%);
    --destructive: hsl(0, 84.2%, 60.2%);
    --destructive-foreground: hsl(210, 40%, 98%);
    --border: hsl(214.3, 31.8%, 91.4%);
    --input: hsl(214.3, 31.8%, 91.4%);
    --ring: hsl(6, 100%, 75%);
    /* Radius */
    --radius: 1rem;
    --radius-sm: 0.5rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    /* Gradients */
    --gradient-hero: linear-gradient(135deg, hsl(6, 100%, 75%) 0%, hsl(15, 100%, 80%) 50%, hsl(24, 100%, 85%) 100%);
    --gradient-feature: linear-gradient(180deg, hsl(0, 0%, 100%) 0%, hsl(24, 100%, 98%) 100%);
    /* Shadows */
    --shadow-soft: 0 10px 40px -10px hsla(6, 100%, 75%, 0.2);
    --shadow-medium: 0 20px 50px -15px hsla(6, 100%, 75%, 0.3);
    --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s ease;
    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ============================================
   CSS Variables - Dark Theme
   ============================================ */
.dark, [data-theme="dark"] {
    --background: hsl(222.2, 84%, 4.9%);
    --foreground: hsl(210, 40%, 98%);
    --card: hsl(222.2, 84%, 4.9%);
    --card-foreground: hsl(210, 40%, 98%);
    --popover: hsl(222.2, 84%, 4.9%);
    --popover-foreground: hsl(210, 40%, 98%);
    --primary: hsl(6, 100%, 75%);
    --primary-foreground: hsl(0, 0%, 100%);
    --secondary: hsl(217.2, 32.6%, 17.5%);
    --secondary-foreground: hsl(210, 40%, 98%);
    --muted: hsl(217.2, 32.6%, 17.5%);
    --muted-foreground: hsl(215, 20.2%, 65.1%);
    --accent: hsl(15, 100%, 70%);
    --accent-foreground: hsl(0, 0%, 100%);
    --destructive: hsl(0, 62.8%, 30.6%);
    --destructive-foreground: hsl(210, 40%, 98%);
    --border: hsl(217.2, 32.6%, 17.5%);
    --input: hsl(217.2, 32.6%, 17.5%);
    --ring: hsl(6, 100%, 75%);
}

/* ============================================
   Base Styles
   ============================================ */
body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    color: inherit;
}

/* ============================================
   Utility Classes
   ============================================ */
.text-muted {
    color: var(--muted-foreground);
}

.text-primary {
    color: var(--primary);
}

.d-none {
    display: none !important;
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: var(--radius);
    transition: var(--transition-smooth);
    cursor: pointer;
    border: none;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
}

    .btn-primary:hover {
        opacity: 0.9;
    }

.btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--border);
    color: var(--foreground);
}

    .btn-outline:hover {
        background-color: var(--accent);
        color: var(--accent-foreground);
    }

/* ============================================
   Cards
   ============================================ */
.card {
    background-color: var(--card);
    color: var(--card-foreground);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-soft);
    overflow: hidden;
}

.card-header {
    padding: 1.25rem 1.5rem;
}

.card-content {
    padding: 1.25rem 1.5rem;
}

.card-header + .card-content {
    padding-top: 0.75rem;
}

/* ============================================
   Inputs
   ============================================ */
.input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    border: 1px solid var(--input);
    border-radius: var(--radius);
    background-color: var(--background);
    color: var(--foreground);
    transition: var(--transition-fast);
}

    .input:focus {
        outline: none;
        border-color: var(--ring);
        box-shadow: 0 0 0 2px hsla(6, 100%, 75%, 0.2);
    }

/* ============================================
   Containers
   ============================================ */
.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* ============================================
   Animations
   ============================================ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-slide-up {
    animation: slideUp 0.5s ease-out;
}

/* ============================================
   ERUDY – KB Public (Article Page)
   ============================================ */

/* Page background */
.kb-page {
    min-height: 100vh;
    padding: 2rem 0 3rem;
    background: var(--gradient-feature);
}

/* HERO */
.kb-hero {
    border-radius: var(--radius-xl);
    padding: 1.75rem;
    margin-bottom: 1.25rem;
    background: var(--gradient-hero);
    color: var(--primary-foreground);
    box-shadow: var(--shadow-medium);
    animation: fadeIn .5s ease-out;
}

.kb-hero-top {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: .75rem;
}

.kb-hero h1 {
    margin: 0;
    font-weight: 700;
    letter-spacing: -.2px;
    line-height: 1.15;
}

.kb-hero p {
    margin-top: .55rem;
    margin-bottom: 0;
    opacity: .92;
    font-weight: 400;
}

/* Badges */
.kb-badge {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .25rem .6rem;
    border-radius: 999px;
    background: rgba(255,255,255,.85);
    border: 1px solid rgba(0,0,0,.06);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .2px;
    color: #1f2937;
    text-decoration: none;
}

    .kb-badge:hover {
        text-decoration: underline;
    }

/* Layout grid */
.kb-layout {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
    animation: slideUp .5s ease-out;
}

@media (min-width: 992px) {
    .kb-layout {
        grid-template-columns: 2fr 1fr;
    }
}

.kb-stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Card spacing helper */
.kb-content-block {
    padding: 1.15rem 1.5rem;
}

/* Article header row */
.kb-article-meta {
    color: var(--muted-foreground);
    font-size: .875rem;
}

/* Actions */
.kb-actions-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
}

.kb-actions-left {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    color: var(--muted-foreground);
    font-size: .9rem;
    font-weight: 600;
}

.kb-icon-actions {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.kb-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.75);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform .12s ease, box-shadow .12s ease, background .12s ease;
}

    .kb-icon-btn:hover {
        transform: translateY(-1px);
        box-shadow: var(--shadow-medium);
        background: rgba(255,255,255,.92);
    }

.kb-copy-pill {
    display: none;
    align-items: center;
    gap: .35rem;
    padding: .45rem .7rem;
    border-radius: 999px;
    border: 1px solid rgba(0,0,0,.08);
    background: rgba(255,255,255,.75);
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background .12s ease, box-shadow .12s ease;
    user-select: none;
}

    .kb-copy-pill:hover {
        background: rgba(255,255,255,.92);
        box-shadow: var(--shadow-medium);
    }

.kb-muted {
    color: var(--muted-foreground);
    font-size: .9rem;
    font-weight: 400;
    opacity: .92;
}

/* Related links */
a.kb-related-link {
    color: var(--primary);
    text-decoration: none;
}

    a.kb-related-link:hover {
        color: darkorange;
        text-decoration: underline;
    }

/* Toast */
.kb-toast {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 9999;
    background: rgba(17, 24, 39, .92);
    color: #fff;
    padding: .65rem .85rem;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,.25);
    font-size: .9rem;
    transform: translateY(8px);
    opacity: 0;
    pointer-events: none;
    transition: all .18s ease;
}

    .kb-toast.show {
        transform: translateY(0);
        opacity: 1;
    }

/* ============================================
   KB Content Typo (IMPORTANT)
   Rend le ContentHtml “beau”
   ============================================ */
.kb-content {
    font-size: 0.95rem;
    line-height: 1.75;
    color: var(--foreground);
}

    /* enlève le gros vide au début (ton problème initial) */
    .kb-content > :first-child {
        margin-top: 0 !important;
    }

    /* Titres */
    .kb-content h1,
    .kb-content h2,
    .kb-content h3 {
        font-weight: 700;
        letter-spacing: -0.01em;
        line-height: 1.25;
        color: var(--foreground);
        scroll-margin-top: 90px;
    }

    .kb-content h1 {
        font-size: 1.55rem;
        margin: 1.25rem 0 .6rem;
    }

    .kb-content h2 {
        font-size: 1.2rem;
        margin: 1.35rem 0 .55rem;
    }

    .kb-content h3 {
        font-size: 1.05rem;
        margin: 1.1rem 0 .45rem;
    }

    /* Paragraphes */
    .kb-content p {
        margin: .35rem 0 .65rem;
    }

    /* Listes */
    .kb-content ul,
    .kb-content ol {
        margin: .35rem 0 .9rem;
        padding-left: 1.2rem;
    }

    .kb-content li {
        margin: .35rem 0;
    }

        .kb-content li::marker {
            color: var(--muted-foreground);
        }

    /* HR */
    .kb-content hr {
        border: 0;
        height: 1px;
        background: hsl(214.3, 31.8%, 85%);
        margin: 1.1rem 0 1.25rem;
    }

    /* Liens dans le contenu */
    .kb-content a {
        color: var(--primary);
        text-decoration: underline;
        text-underline-offset: 2px;
    }

        .kb-content a:hover {
            text-decoration-thickness: 2px;
        }

    /* (optionnel) si ton éditeur met un <br> au début */
    .kb-content br:first-child {
        display: none;
    }

/* ============================================
   Print
   ============================================ */
@media print {
    body {
        background: #fff !important;
        color: #111 !important;
    }

    .kb-page {
        padding: 0 !important;
        background: #fff !important;
        min-height: auto !important;
    }

    .kb-hero {
        background: #fff !important;
        color: #111 !important;
        box-shadow: none !important;
        border: 1px solid rgba(0,0,0,.08) !important;
        animation: none !important;
    }

    .kb-actions-card, .kb-toast {
        display: none !important;
    }

    .kb-layout {
        grid-template-columns: 1fr !important;
        animation: none !important;
    }

    .card {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .kb-print-url {
        display: block !important;
        margin-top: .5rem;
        font-size: .85rem;
        color: #444 !important;
    }
}

.kb-print-url {
    display: none;
}
