/* ======================================================================
   BALDFORMA - DESIGN SYSTEM & PRESETS (nutrition.css)
   Inspiration: Apple, Stripe, Notion
   Aesthetics: Premium Sleek Dark Mode & Vibrant Nutrition Accents
   ====================================================================== */

/* --- Custom Variables & Theme Tokens --- */
:root {
    --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
    --font-heading: 'Outfit', var(--font-sans);
    
    /* Harmonious Color Palette */
    --color-bg: #111213;
    --color-card: #18191b;
    --color-border: #26282b;
    --color-text: #f3f4f6;
    --color-text-muted: #9ca3af;
    
    /* Nutrition Vibrant Greens */
    --color-accent: #10b981;
    --color-accent-hover: #059669;
    --color-accent-light: rgba(16, 185, 129, 0.1);
    
    /* Statuses */
    --color-danger: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;

    /* Shadows & Transitions */
    --shadow-premium: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
    --shadow-soft: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --border-radius-lg: 12px;
    --border-radius-md: 8px;
}

/* --- Base & Reset Rules --- */
*, ::before, ::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    height: 100%;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-text);
    min-height: 100%;
    line-height: 1.6;
    overflow-x: hidden;
}

/* --- Accessibility (WCAG 2.2) --- */
.skip-link {
    position: absolute;
    top: -100px;
    left: 10px;
    background: var(--color-accent);
    color: white;
    padding: 10px 20px;
    border-radius: var(--border-radius-md);
    font-weight: bold;
    z-index: 1000;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 10px;
    outline: 2px solid white;
}

a, button, select, input, textarea {
    outline-color: var(--color-accent);
}

/* --- Layout Utilities --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin-right: auto;
    margin-left: auto;
    padding-right: 20px;
    padding-left: 20px;
}

.max-w-lg { max-width: 800px; margin-left: auto; margin-right: auto; }
.max-w-xl { max-width: 650px; margin-left: auto; margin-right: auto; }

.flex { display: flex; }
.flex-column { flex-direction: column; }
.flex-grow { flex-grow: 1; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-start { justify-content: flex-start; }
.justify-end { justify-content: flex-end; }
.align-self-start { align-self: flex-start; }
.space-x-2 > * + * { margin-left: 8px; }
.space-x-3 > * + * { margin-left: 12px; }
.space-y-2 > * + * { margin-top: 8px; }
.space-y-3 > * + * { margin-top: 12px; }
.space-y-4 > * + * { margin-top: 16px; }

.grid { display: grid; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.col-gap-2 { column-gap: 8px; }
.col-gap-3 { column-gap: 12px; }
.col-gap-4 { column-gap: 16px; }
.col-gap-5 { column-gap: 24px; }
.row-gap-2 { row-gap: 8px; }
.row-gap-4 { row-gap: 16px; }
.col-span-2 { grid-column: span 2 / span 2; }
.col-span-3 { grid-column: span 3 / span 3; }

.py-4 { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.py-5 { padding-top: 3rem; padding-bottom: 3rem; }
.py-6 { padding-top: 5rem; padding-bottom: 5rem; }
.px-4 { padding-left: 1.5rem; padding-right: 1.5rem; }
.p-0 { padding: 0 !important; }
.p-1 { padding: 4px; }
.p-2 { padding: 8px; }
.p-3 { padding: 16px; }
.p-4 { padding: 24px; }
.p-5 { padding: 40px; }
.m-0 { margin: 0; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mb-5 { margin-bottom: 40px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
.mt-6 { margin-top: 40px; }
.mx-auto { margin-left: auto; margin-right: auto; }

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-xs { font-size: 0.8rem; }
.text-xxs { font-size: 0.7rem; }
.text-lg { font-size: 1.2rem; }
.text-xl { font-size: 1.5rem; }
.text-2xl { font-size: 2rem; }
.text-muted { color: var(--color-text-muted); }
.text-accent { color: var(--color-accent); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
.block { display: block; }
.inline-block { display: inline-block; }
.relative { position: relative; }
.rounded { border-radius: var(--border-radius-md); }
.rounded-lg { border-radius: var(--border-radius-lg); }
.rounded-full { border-radius: 50%; }
.border-b { border-bottom: 1px solid var(--color-border); }
.border-t { border-top: 1px solid var(--color-border); }
.border-l-2 { border-left: 2px solid; }
.border-l-4 { border-left: 4px solid; }
.border-muted { border-color: var(--color-border); }
.border-accent { border-color: var(--color-accent); }
.w-full { width: 100%; }
.h-full { height: 100%; }
.h-8 { height: 2rem; }
.w-24 { width: 6rem; }
.cursor-pointer { cursor: pointer; }
.overflow-hidden { overflow: hidden; }
.overflow-y-auto { overflow-y: auto; }

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--color-text);
    font-weight: 700;
    line-height: 1.25;
}

.display-title {
    font-size: 3.5rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    line-height: 1.1;
}

.section-title {
    font-size: 2.25rem;
    letter-spacing: -0.03em;
}

.h2 { font-size: 2rem; }
.h3 { font-size: 1.5rem; }
.h4 { font-size: 1.2rem; }
.lead { font-size: 1.25rem; color: var(--color-text-muted); }
a { color: var(--color-text); text-decoration: none; transition: var(--transition-smooth); }
.hover-underline:hover { text-decoration: underline; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition-smooth);
    gap: 8px;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

.btn-primary {
    background-color: var(--color-accent);
    color: #ffffff;
}
.btn-primary:hover:not(:disabled) {
    background-color: var(--color-accent-hover);
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.4);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--color-border);
    color: var(--color-text);
}
.btn-secondary:hover:not(:disabled) {
    background-color: rgba(255, 255, 255, 0.05);
    border-color: var(--color-text-muted);
}
.btn-secondary.active {
    background-color: var(--color-accent-light);
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-danger {
    background-color: var(--color-danger);
    color: #ffffff;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.btn-warning {
    background-color: var(--color-warning);
    color: #111;
}
.btn-warning:hover {
    background-color: #d97706;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-link {
    color: var(--color-accent);
    font-weight: 600;
}
.btn-link:hover {
    color: var(--color-accent-hover);
}

/* --- Cards --- */
.card {
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-soft);
    transition: var(--transition-smooth);
}

.card-hover:hover {
    transform: translateY(-4px);
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: var(--shadow-premium);
}

/* --- Forms --- */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text-muted);
    margin-bottom: 6px;
}

.form-control {
    background-color: #202123;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    color: var(--color-text);
    padding: 0.75rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    transition: var(--transition-smooth);
}

.form-control:focus {
    border-color: var(--color-accent);
    box-shadow: 0 0 0 2px var(--color-accent-light);
    outline: none;
}

/* --- Headers & Nav --- */
.navbar-container {
    background-color: rgba(17, 18, 19, 0.85);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-wrap {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-logo {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
}
.logo-accent {
    color: var(--color-accent);
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 32px;
}

.navbar-links ul {
    list-style: none;
    display: flex;
    gap: 24px;
}

.nav-link {
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--color-text-muted);
}
.nav-link:hover {
    color: var(--color-text);
}

.btn-navbar {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: var(--border-radius-md);
    margin-left: 10px;
}

/* Mobile Nav Toggle */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

/* --- Hero Section & Premium Gradients --- */
.bg-gradient-hero {
    background: radial-gradient(circle at top, rgba(16, 185, 129, 0.08) 0%, rgba(17, 18, 19, 0) 70%);
}

.bg-gradient-cta {
    background: linear-gradient(180deg, rgba(17, 18, 19, 0) 0%, rgba(16, 185, 129, 0.05) 100%);
    border-top: 1px solid var(--color-border);
}

.badge-premium {
    display: inline-block;
    padding: 4px 12px;
    background: var(--color-accent-light);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--color-accent);
    font-weight: 700;
    border-radius: 50px;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
}

.absolute-bg-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 600px;
    height: 300px;
    background: radial-gradient(circle, rgba(16, 185, 129, 0.05) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: -1;
    pointer-events: none;
}

/* --- Alerts --- */
.alert {
    padding: 12px 16px;
    border-radius: var(--border-radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid transparent;
}
.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--color-danger);
}
.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.2);
    color: var(--color-accent);
}
.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.2);
    color: var(--color-warning);
}

/* --- Chatbot Floating Window --- */
.chatbot-wrapper {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
}

.chatbot-trigger {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background-color: var(--color-accent);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.chatbot-trigger:hover {
    transform: scale(1.08);
}

.chatbot-window {
    position: absolute;
    bottom: 72px;
    right: 0;
    width: 360px;
    height: 480px;
    background-color: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: var(--transition-smooth);
}

.chatbot-header {
    background-color: var(--color-accent);
    padding: 16px;
    color: white;
}
.bot-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    margin-right: 10px;
}
.chatbot-bot-info {
    display: flex;
    align-items: center;
}
.bot-name { font-size: 0.95rem; font-weight: 700; }
.bot-status { font-size: 0.7rem; opacity: 0.8; }

.chatbot-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background-color: #151617;
}

.message-bubble {
    padding: 10px 14px;
    border-radius: var(--border-radius-md);
    font-size: 0.85rem;
    max-width: 85%;
    line-height: 1.4;
}
.bot-message {
    background-color: var(--color-border);
    color: var(--color-text);
    align-self: flex-start;
}
.user-message {
    background-color: var(--color-accent);
    color: white;
    align-self: flex-end;
}

.chatbot-input-area {
    padding: 12px;
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 8px;
}
.chatbot-input-area input {
    flex-grow: 1;
    padding: 8px 12px;
    font-size: 0.85rem;
}
.chatbot-input-area button {
    background-color: var(--color-accent);
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: var(--border-radius-md);
    cursor: pointer;
}

/* --- WebRTC Video Conference Grid --- */
.video-conference-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    height: calc(100vh - 70px);
    overflow: hidden;
}

.video-grid-container {
    background-color: #0c0d0e;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.video-wrapper {
    background-color: #1a1a1a;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    position: relative;
    border: 1px solid var(--color-border);
}

.remote-video-wrap {
    width: 100%;
    height: 100%;
    max-width: 960px;
    max-height: 540px;
}
.remote-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.local-video-wrap {
    position: absolute;
    bottom: 90px;
    right: 30px;
    width: 200px;
    height: 120px;
    z-index: 10;
}
.local-video-wrap video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-overlay-name {
    position: absolute;
    bottom: 8px;
    left: 8px;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    color: white;
}

.video-controls-bar {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(24, 25, 27, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    padding: 10px 20px;
    border-radius: 50px;
    z-index: 20;
}

.btn-video-control {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
}
.btn-video-control:hover {
    background: rgba(255, 255, 255, 0.1);
}
.btn-video-control.active {
    background: var(--color-accent);
    border-color: var(--color-accent);
}
.btn-video-control.btn-danger {
    background: var(--color-danger);
    border-color: var(--color-danger);
}

.video-chat-sidebar {
    border-left: 1px solid var(--color-border);
    height: 100%;
}

/* --- Calendar & Scheduling UI --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    text-align: center;
}

.calendar-day-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--color-text-muted);
    padding: 8px 0;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: var(--transition-smooth);
}
.calendar-day:hover:not(.empty):not(.disabled) {
    background: var(--color-border);
}
.calendar-day.active {
    background: var(--color-accent) !important;
    color: white;
}
.calendar-day.disabled {
    color: #4b5563;
    cursor: not-allowed;
    opacity: 0.4;
}
.calendar-day.today {
    border-color: var(--color-accent);
}

.slot-btn {
    padding: 8px;
    background: #202123;
    border: 1px solid var(--color-border);
    color: var(--color-text);
    border-radius: var(--border-radius-md);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.85rem;
    text-align: center;
    transition: var(--transition-smooth);
}
.slot-btn:hover {
    border-color: var(--color-accent);
}
.slot-btn.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

/* --- Page Builder Styles --- */
.page-builder-workspace {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 70px);
}

.builder-sidebar {
    height: 100%;
}

.builder-canvas {
    height: 100%;
    background-color: #0f1011;
}

.widget-tool-card {
    background-color: #202123;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 12px;
    text-align: center;
    cursor: grab;
    transition: var(--transition-smooth);
}
.widget-tool-card:hover {
    border-color: var(--color-accent);
    background: rgba(16, 185, 129, 0.02);
}

.canvas-section-box {
    border: 2px dashed var(--color-border);
    border-radius: var(--border-radius-lg);
    background-color: var(--color-card);
    padding: 20px;
    position: relative;
    transition: var(--transition-smooth);
}
.canvas-section-box.drag-over {
    border-color: var(--color-accent);
    background-color: rgba(16, 185, 129, 0.02);
}

.section-controls-bar {
    position: absolute;
    top: -12px;
    right: 12px;
    background-color: #202123;
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 2px 8px;
    display: flex;
    gap: 8px;
    z-index: 10;
}
.control-btn-xxs {
    font-size: 0.65rem;
    color: var(--color-text-muted);
    background: none;
    border: none;
    cursor: pointer;
}
.control-btn-xxs:hover {
    color: var(--color-text);
}

.canvas-column {
    border: 1px dashed rgba(255, 255, 255, 0.1);
    min-height: 80px;
    padding: 10px;
}

.canvas-widget {
    background: #202123;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    position: relative;
}
.canvas-widget:hover {
    border-color: var(--color-accent);
}

.tab-btn {
    background: none;
    border: none;
    color: var(--color-text-muted);
    cursor: pointer;
}
.tab-btn.active {
    color: var(--color-accent);
    background-color: rgba(16, 185, 129, 0.05);
}

/* --- Partners Section Grid --- */
.partners-grid {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 32px;
}

.partner-card {
    background-color: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-md);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 140px;
    transition: var(--transition-smooth);
}
.partner-logo {
    height: 35px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: var(--transition-smooth);
}
.partner-card:hover .partner-logo {
    filter: none;
    opacity: 1;
}

/* Exigence Partenaire INFORBALD (Non grisé, non réduit, mis en valeur) */
.partner-primary-highlight {
    background-color: #202123 !important;
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.2);
    transform: scale(1.05);
}

/* --- Responsive Layout Rules --- */
@media (max-width: 992px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .page-builder-workspace { grid-template-columns: 1fr; }
    .video-conference-layout { grid-template-columns: 1fr; }
    .video-chat-sidebar { display: none; }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .navbar-links {
        display: none; /* Mobile navigation toggle handles this in JS */
        flex-direction: column;
        position: absolute;
        top: 70px;
        left: 0;
        width: 100%;
        background-color: var(--color-bg);
        border-bottom: 1px solid var(--color-border);
        padding: 20px;
        gap: 20px;
    }
    .navbar-links.active {
        display: flex;
    }
    .navbar-links ul {
        flex-direction: column;
        width: 100%;
        gap: 16px;
    }
    .menu-toggle {
        display: block;
    }
    .display-title {
        font-size: 2.25rem;
    }
    .section-title {
        font-size: 1.75rem;
    }
}
