/* =====================================================
   HaliTrace v3 - Charte graphique moderne SaaS
   ===================================================== */

:root {
    --primary: #0F6E56;
    --primary-dark: #0A5743;
    --primary-light: #E1F5EE;
    --primary-soft: #F0FAF6;
    --accent: #F4A261;
    --teal: #14B89A;
    --bg: #FAFBFC;
    --text: #1A2E2A;
    --text-muted: #6B7B78;
    --border: #E5EAEA;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 16px rgba(15,110,86,0.08);
    --shadow-lg: 0 12px 40px rgba(15,110,86,0.15);
    --radius: 12px;
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    margin: 0;
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ===== NAVBAR ===== */
.halitrace-navbar {
    background: var(--primary) !important;
    box-shadow: var(--shadow-sm);
}

.halitrace-navbar .navbar-brand { font-size: 1.25rem; font-weight: 700; }
.halitrace-navbar .nav-link {
    color: rgba(255,255,255,0.85) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 6px;
    transition: all 0.2s;
}
.halitrace-navbar .nav-link:hover,
.halitrace-navbar .nav-link.active {
    color: #fff !important;
    background: rgba(255,255,255,0.12);
}

.brand-icon {
    background: rgba(255,255,255,0.18);
    border-radius: 8px;
    padding: 4px 8px;
    margin-right: 4px;
}

.avatar-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.25);
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    margin-right: 6px;
}

/* ===== BOUTONS ===== */
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    font-weight: 600;
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
    background: var(--primary-dark) !important;
    border-color: var(--primary-dark) !important;
}
.btn-outline-primary { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ===== CARTES ===== */
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-md); }

/* ===== STAT CARDS ===== */
.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s;
}
.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.stat-card .stat-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    background: var(--primary-light);
    color: var(--primary);
    margin-bottom: 14px;
}
.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
    font-weight: 600;
}
.stat-card .stat-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
}

/* ===== TABLES ===== */
.table {
    background: #fff;
    border-radius: var(--radius);
    overflow: hidden;
}
.table thead th {
    background: var(--primary-light);
    color: var(--primary-dark);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: none;
    padding: 14px 12px;
}
.table tbody tr:hover { background: rgba(15,110,86,0.04); }

/* ===== FOOTER ===== */
.halitrace-footer {
    background: #fff;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
}

/* =====================================================
   HOME PAGE - Style SaaS Pro
   ===================================================== */
.home-wrapper {
    min-height: 100vh;
    background: #fff;
    display: flex;
    flex-direction: column;
}

/* HEADER */
.home-header {
    padding: 1.25rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(12px);
    z-index: 100;
    border-bottom: 1px solid var(--border);
}

.home-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--text);
}
.home-logo:hover { color: var(--primary); }
.home-logo img { width: 36px; height: 36px; }
.home-logo .brand-name {
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--teal));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.home-nav-buttons { display: flex; gap: 10px; align-items: center; }

.btn-nav {
    padding: 8px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: all 0.2s;
    border: none;
    cursor: pointer;
}
.btn-nav-ghost { background: transparent; color: var(--text); }
.btn-nav-ghost:hover { background: var(--primary-soft); color: var(--primary); }
.btn-nav-primary {
    background: var(--primary);
    color: #fff !important;
}
.btn-nav-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* HERO SECTION */
.hero {
    position: relative;
    padding: 6rem 2rem 4rem;
    overflow: hidden;
    background:
        radial-gradient(circle at 20% 20%, rgba(20,184,154,0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(15,110,86,0.06) 0%, transparent 50%),
        #fff;
}

.hero-bg-waves {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    pointer-events: none;
    opacity: 0.3;
}

.hero-container {
    max-width: 1100px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    z-index: 1;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--primary-soft);
    color: var(--primary);
    border-radius: 100px;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid var(--primary-light);
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.25rem;
    color: var(--text);
    letter-spacing: -1.5px;
}

.hero h1 .gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--teal) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero .subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    max-width: 700px;
    margin: 0 auto 2.5rem;
    line-height: 1.6;
}

.hero-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

.btn-hero {
    padding: 14px 32px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 15px;
    text-decoration: none;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: none;
}
.btn-hero-primary {
    background: var(--primary);
    color: #fff !important;
    box-shadow: 0 4px 20px rgba(15,110,86,0.3);
}
.btn-hero-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(15,110,86,0.4);
    background: var(--primary-dark);
}
.btn-hero-secondary {
    background: #fff;
    color: var(--text) !important;
    border: 2px solid var(--border);
}
.btn-hero-secondary:hover {
    border-color: var(--primary);
    color: var(--primary) !important;
    transform: translateY(-2px);
}

/* STATS BAR */
.stats-bar {
    padding: 3rem 2rem;
    background: var(--primary);
    color: #fff;
}
.stats-bar-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    text-align: center;
}
.stat-item .stat-num {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
    background: linear-gradient(135deg, #fff, rgba(255,255,255,0.7));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.stat-item .stat-desc {
    font-size: 14px;
    opacity: 0.85;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* FEATURES SECTION */
.features {
    padding: 6rem 2rem;
    background: #fff;
}
.features-container { max-width: 1100px; margin: 0 auto; }

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}
.section-header .eyebrow {
    color: var(--primary);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}
.section-header h2 {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--text);
    margin: 0 0 1rem;
    letter-spacing: -1px;
}
.section-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.feature-card {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.feature-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}
.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--teal));
    opacity: 0;
    transition: opacity 0.3s;
}
.feature-card:hover::before { opacity: 1; }

.feature-icon-box {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-bottom: 1.25rem;
}

.feature-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem;
}
.feature-card p {
    color: var(--text-muted);
    font-size: 14px;
    line-height: 1.6;
    margin: 0;
}

/* HOW IT WORKS */
.how-it-works {
    padding: 6rem 2rem;
    background: var(--primary-soft);
}
.steps-container {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}
.step-card {
    background: #fff;
    padding: 2rem;
    border-radius: var(--radius);
    text-align: center;
    border: 1px solid var(--border);
    position: relative;
}
.step-number {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem;
    box-shadow: 0 4px 12px rgba(15,110,86,0.3);
}
.step-card h4 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 0.5rem;
}
.step-card p {
    color: var(--text-muted);
    font-size: 14px;
    margin: 0;
}

/* CTA SECTION */
.cta-section {
    padding: 6rem 2rem;
    background:
        radial-gradient(circle at 50% 0%, rgba(20,184,154,0.15), transparent 60%),
        linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #fff;
    text-align: center;
}
.cta-section h2 {
    font-size: 2.5rem;
    font-weight: 800;
    margin: 0 0 1rem;
    letter-spacing: -1px;
}
.cta-section p {
    font-size: 1.15rem;
    opacity: 0.9;
    max-width: 600px;
    margin: 0 auto 2rem;
}
.btn-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 36px;
    background: #fff;
    color: var(--primary) !important;
    border-radius: 10px;
    font-weight: 700;
    font-size: 16px;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: all 0.3s;
}
.btn-cta:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.3);
    background: var(--accent);
    color: #fff !important;
}

/* HOME FOOTER */
.home-footer {
    padding: 2rem;
    background: #0A2E26;
    color: rgba(255,255,255,0.7);
    text-align: center;
    font-size: 14px;
}
.home-footer strong { color: #fff; }

/* ===== ANIMATIONS d'apparition ===== */
.fade-up {
    opacity: 0;
    transform: translateY(20px);
    animation: fadeUp 0.8s ease-out forwards;
}
.fade-up.delay-1 { animation-delay: 0.15s; }
.fade-up.delay-2 { animation-delay: 0.3s; }
.fade-up.delay-3 { animation-delay: 0.45s; }
.fade-up.delay-4 { animation-delay: 0.6s; }

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =====================================================
   AUTH PAGES (login/register)
   ===================================================== */
.auth-wrap {
    min-height: 100vh;
    background:
        radial-gradient(circle at 20% 30%, rgba(20,184,154,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(15,110,86,0.1) 0%, transparent 50%),
        linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.auth-card {
    background: #fff;
    border-radius: 20px;
    padding: 2.5rem;
    width: 100%;
    max-width: 460px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.auth-header { text-align: center; margin-bottom: 2rem; }

.auth-logo {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
}

.auth-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text);
    margin: 0;
    letter-spacing: -0.5px;
}

.auth-sub { color: var(--text-muted); font-size: 0.95rem; margin-top: 4px; }

.auth-footer-link {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}
.auth-footer-link a { color: var(--primary); font-weight: 600; text-decoration: none; }
.auth-footer-link a:hover { text-decoration: underline; }

/* ROLE SELECTOR */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 1.25rem;
}
.role-option {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #fff;
}
.role-option:hover { border-color: var(--primary); transform: translateY(-2px); }
.role-option.selected { border-color: var(--primary); background: var(--primary-light); }
.role-option .role-icon { font-size: 2rem; color: var(--primary); margin-bottom: 6px; }
.role-option .role-name { font-weight: 700; color: var(--text); font-size: 0.95rem; }
.role-option .role-desc { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

/* PROGRESS TRACK */
.progress-track {
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 12px;
    flex-wrap: wrap;
}
.prog-step { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.prog-dot {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
    font-weight: 700;
}
.prog-dot.done { background: var(--primary); color: #fff; }
.prog-dot.current { background: var(--primary-light); border: 2px solid var(--primary); color: var(--primary); }
.prog-dot.pending { background: #F0F2F4; border: 1px solid var(--border); color: var(--text-muted); }
.prog-line { width: 36px; height: 2px; background: var(--border); margin: 0 4px; }
.prog-line.done { background: var(--primary); }

/* EMPTY STATE */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 3rem; opacity: 0.3; margin-bottom: 1rem; }

/* FORMS */
.form-label { font-weight: 600; color: var(--text); font-size: 0.9rem; }
.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 0.2rem rgba(15,110,86,0.15);
}

/* LOADING SPINNER */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}
.loading-overlay.show { display: flex; }
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--primary-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* TOAST */
.toast-container {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.toast-msg {
    background: #fff;
    border-radius: 10px;
    padding: 14px 20px;
    box-shadow: var(--shadow-lg);
    border-left: 4px solid var(--primary);
    min-width: 280px;
    max-width: 400px;
    animation: slideIn 0.3s ease-out;
    font-size: 14px;
}
.toast-msg.toast-success { border-left-color: #22C55E; }
.toast-msg.toast-error { border-left-color: #EF4444; }
.toast-msg.toast-warning { border-left-color: #F59E0B; }

@keyframes slideIn {
    from { transform: translateX(400px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .hero { padding: 3rem 1.5rem 2rem; }
    .hero h1 { font-size: 2.2rem; }
    .hero .subtitle { font-size: 1rem; }
    .section-header h2 { font-size: 1.8rem; }
    .cta-section h2 { font-size: 1.8rem; }
    .auth-card { padding: 1.75rem; }
    .role-selector { grid-template-columns: 1fr; }
    .home-header { padding: 1rem; }
    .stat-card .stat-value { font-size: 24px; }
}

/* Utilities */
.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.text-muted { color: var(--text-muted) !important; }
.font-bold { font-weight: 700; }
