/* ==================================================================== */
/* === 1. VARIABLES GLOBALES (PALETTE COULEUR) === */
/* ==================================================================== */
:root {
    --primary: #ea580c;       /* Orange (boutons, accents) */
    --primary-dark: #c2410c;  /* Orange foncé (hover, liens texte : meilleur contraste) */
    --primary-soft: #fff7ed;  /* Orange très clair (fonds d'icônes) */
    --slate-900: #0f172a;     /* Marine (texte principal, en-têtes) */
    --slate-800: #1e293b;     /* Marine clair (dégradés) */
    --slate-200: #e2e8f0;     /* Gris clair (bordures, séparateurs) */
    --white: #ffffff;         /* Blanc */
    --bg: #f8fafc;            /* Fond de page léger (gris très clair) */
    --text-muted: #64748b;    /* Texte secondaire (gris) */
}

/* ==================================================================== */
/* === 2. STYLES DE BASE & RESET === */
/* ==================================================================== */
*, *::before, *::after { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}
body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg); 
    display: flex; 
    flex-direction: column; 
    min-height: 100vh; 
}
main {
    flex-grow: 1;
    padding: 20px;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto; /* Centrer le contenu principal */
}
.page-specific-header { margin-bottom: 20px; }


/* ==================================================================== */
/* === 3. BUTTONS (Boutons d'action) === */
/* ==================================================================== */

/* Style des boutons génériques (pour les liens Nouveau Client, Archiver, Ajouter) */
.button, .btn-pro {
    display: inline-flex; /* Permet d'aligner l'icône et le texte */
    align-items: center;
    justify-content: center;
    padding: 10px 18px; /* Espace interne standard */
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    cursor: pointer;
    border: 1px solid transparent; /* Bordure par défaut transparente */
    transition: all 0.2s ease;
}

/* Bouton primaire (Couleur principale) */
.button.button-primary, .btn-pro.btn-primary {
    background-color: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.button.button-primary:hover, .btn-pro.btn-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* Bouton secondaire (Couleur secondaire/neutre) */
.button.button-secondary, .btn-pro.btn-secondary {
    background-color: transparent;
    color: var(--text-muted); /* Couleur de texte secondaire */
    border-color: var(--slate-200); /* Bordure légère */
}
.button.button-secondary:hover, .btn-pro.btn-secondary:hover {
    background-color: var(--slate-200);
    color: var(--slate-900);
}

/* Bouton clair (sur fond marine, ex. landing page) */
.button.button-light {
    background-color: transparent;
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.35);
}
.button.button-light:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Bouton small (pour les actions de tableau comme Modifier, Archiver) */
.button.button-small {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: 6px;
}
.button.button-small i { margin-inline-end: 5px; }

/* Bouton large (formulaires d'inscription, landing page) */
.button.button-large {
    padding: 14px 26px;
    font-size: 1.05rem;
}


/* ==================================================================== */
/* === 4. TABLE STYLING (Pour clients.html) === */
/* ==================================================================== */
.table-responsive {
    overflow-x: auto;
}
.styled-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}

.styled-table th, .styled-table td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--slate-200);
}

.styled-table thead th {
    background-color: var(--bg);
    color: var(--slate-900);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.styled-table tbody tr:last-child td {
    border-bottom: none;
}
.styled-table tbody tr:hover {
    background-color: #f1f5f9; /* Survol des lignes */
}

/* Styles pour les liens à l'intérieur du tableau */
.styled-table a {
    color: var(--primary-dark);
    text-decoration: none;
}
.styled-table a:hover {
    text-decoration: underline;
}

/* Style spécifique pour la colonne Contact */
.styled-table .small {
    color: var(--text-muted);
}
.styled-table .small i {
    color: var(--primary); /* Icône en couleur primaire */
}


/* ==================================================================== */
/* === 5. FORM STYLING (Pour ajouter_dossier.html) === */
/* ==================================================================== */

/* Conteneur de formulaire (card-container) */
.card-container { 
    background: var(--white); 
    padding: 30px; 
    border-radius: 12px; 
    border: 1px solid var(--slate-200); 
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05); 
    max-width: 800px; /* Limiter la largeur du formulaire */
    margin: 30px auto;
}

/* En-tête de formulaire (icon + title) */
.text-center h2 { color: var(--slate-900); }
.text-center i { color: var(--primary); }

/* Champ client pré-sélectionné */
.bg-light { background-color: #f1f5f9 !important; }
.text-dark { color: var(--slate-900); }

/* Groupe de boutons en bas du formulaire */
.btn-group-center {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

/* Champs de formulaire (form-control, form-select) */
.form-control, .form-select {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    border: 1px solid var(--slate-200);
    font-size: 0.95rem;
    color: var(--slate-900);
    background-color: var(--white);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(234, 88, 12, 0.15);
}
.form-label {
    font-weight: 600;
    color: var(--slate-900);
    margin-bottom: 5px;
    display: block;
}
/* Astérisque des champs obligatoires */
.form-label.required::after {
    content: " *";
    color: #dc2626;
}
/* Styles pour les messages flash Bootstrap */
.alert { border-radius: 8px; }

/* ==================================================================== */
/* === 6. GÉNÉRALITÉS ET RTL === */
/* ==================================================================== */
html[dir="rtl"] { direction: rtl; }
html[dir="rtl"] body { font-family: 'Cairo', 'Inter', sans-serif; }
html[dir="rtl"] .header-nav { margin-left: 0; margin-right: 20px; }
html[dir="rtl"] .ms-auto { margin-right: auto !important; margin-left: 0 !important; }
html[dir="rtl"] .styled-table th,
html[dir="rtl"] .styled-table td { text-align: right; }
/* Note : en RTL le navigateur inverse déjà l'ordre de l'en-tête tout seul,
   l'ancienne règle « flex-direction: row-reverse » l'inversait une 2e fois : supprimée. */

/* ==================================================================== */
/* === 7. EN-TÊTE (logo, titre, navigation) === */
/* ==================================================================== */
.main-header {
    background: var(--white);
    border-bottom: 1px solid var(--slate-200);
    position: sticky;
    top: 0;
    z-index: 1000;
}
.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
}
.header-logo-title a { text-decoration: none; }
.header-logo { height: 44px; width: auto; }
.app-title {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--slate-900);
    margin-inline-start: 10px;
    white-space: nowrap;
}
.header-nav { gap: 4px; align-items: center; }
.header-nav .nav-link {
    color: var(--text-muted);
    font-weight: 500;
    padding: 8px 12px;
    border-radius: 8px;
}
.header-nav .nav-link:hover { color: var(--slate-900); background: var(--bg); }
.header-nav .nav-link.active { color: var(--primary-dark); font-weight: 700; }
.header-content .navbar-nav .nav-link { color: var(--slate-900); }

/* Boutons Bootstrap aux couleurs de la marque (« S'inscrire ») */
.btn-primary {
    --bs-btn-bg: var(--primary);
    --bs-btn-border-color: var(--primary);
    --bs-btn-hover-bg: var(--primary-dark);
    --bs-btn-hover-border-color: var(--primary-dark);
    --bs-btn-active-bg: var(--primary-dark);
    --bs-btn-active-border-color: var(--primary-dark);
    --bs-btn-disabled-bg: var(--primary);
    --bs-btn-disabled-border-color: var(--primary);
}

/* ==================================================================== */
/* === 8. PAGES D'AUTHENTIFICATION (register, login) === */
/* ==================================================================== */
.auth-container {
    background: var(--white);
    padding: 32px;
    border-radius: 12px;
    border: 1px solid var(--slate-200);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.auth-logo { height: 56px; width: auto; }

.form-section {
    border: none;
    margin-bottom: 24px;
    min-width: 0;
}
.form-section-title {
    display: block;
    width: 100%;
    font-size: 1rem;
    font-weight: 700;
    color: var(--slate-900);
    padding-bottom: 8px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--primary);
}
.extra-links a { color: var(--primary-dark); text-decoration: none; }
.extra-links a:hover { text-decoration: underline; }

/* ==================================================================== */
/* === 9. LANDING PAGE === */
/* ==================================================================== */
.landing-hero {
    background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
    color: var(--white);
    border-radius: 16px;
    padding: 72px 32px;
    text-align: center;
    margin: 12px 0 48px;
}
.landing-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    background: rgba(234, 88, 12, 0.18);
    color: #fdba74;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 20px;
}
.landing-hero h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    font-weight: 800;
    line-height: 1.2;
    max-width: 820px;
    margin: 0 auto 18px;
    color: var(--white);
}
.landing-lead {
    color: #cbd5e1;
    max-width: 680px;
    margin: 0 auto 32px;
    font-size: 1.1rem;
    line-height: 1.6;
}
.landing-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

.landing-section { margin-bottom: 56px; }
.landing-section-title {
    text-align: center;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--slate-900);
    margin-bottom: 28px;
}
.feature-grid, .steps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}
.feature-card, .step-card {
    background: var(--white);
    border: 1px solid var(--slate-200);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.feature-icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--primary-soft);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}
.feature-card h3, .step-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--slate-900);
    margin-bottom: 6px;
}
.feature-card p, .step-card p {
    color: var(--text-muted);
    line-height: 1.55;
    margin: 0;
}
.step-number {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--slate-900);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    margin-bottom: 14px;
}
.cta-band {
    background: linear-gradient(135deg, var(--slate-900) 0%, var(--slate-800) 100%);
    color: var(--white);
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    margin-bottom: 24px;
}
.cta-band h2 {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--white);
    margin-bottom: 20px;
}

/* ==================================================================== */
/* === 10. FOOTER === */
/* ==================================================================== */
.site-footer {
    flex-shrink: 0;
    background: var(--white);
    border-block-start: 1px solid var(--slate-200);
    color: #475569;
    font-size: 0.9rem;
    line-height: 1.5;
    margin-block-start: 2rem;
}

.site-footer .footer-content {
    width: 100%;
    max-width: 1400px;
    margin-inline: auto;
    padding: 2.5rem 1.25rem 1.5rem;
}

/* --- Niveau 1 : marque + colonnes --- */
.footer-top {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 2rem 3rem;
    padding-block-end: 2rem;
}

.footer-brand {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--slate-900);
    font-weight: 700;
    font-size: 1.05rem;
    text-decoration: none;
}
.footer-logo { height: 32px; width: auto; }

.footer-tagline {
    margin: 0.75rem 0 0;
    max-width: 34ch;
}

.footer-col-title {
    margin: 0 0 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--slate-900);
}

.footer-col ul {
    list-style: none;
    display: grid;
    gap: 0.5rem;
}

.footer-col a,
.footer-credit a {
    color: #475569;
    text-decoration: none;
    transition: color 0.15s ease;
}
.footer-col a:hover,
.footer-credit a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Lien de téléchargement : seul élément mis en avant */
.footer-col .footer-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 0.9rem;
    border: 1px solid var(--slate-200);
    border-radius: 8px;
    font-weight: 600;
    color: var(--slate-900);
}
.footer-col .footer-download:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
    text-decoration: none;
}

/* --- Niveau 2 : copyright + crédit --- */
.footer-bottom {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 1.5rem;
    padding-block-start: 1.25rem;
    border-block-start: 1px solid var(--slate-200);
    font-size: 0.85rem;
}

/* --- Focus clavier --- */
.site-footer a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 3px;
    border-radius: 4px;
}

/* --- Tablette / mobile --- */
@media (max-width: 800px) {
    .footer-top { grid-template-columns: 1fr 1fr; }
    .footer-about { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .footer-top { grid-template-columns: 1fr; }
    .footer-bottom {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }
}
