/* ========================================
   DESIGN SYSTEM — Alliance Informatique
   Style: Moderne minimaliste
   ======================================== */

:root {
    /* Couleurs principales */
    --primary: #3665b5;
    --primary-dark: #1e3a6e;
    --primary-darker: #0f172a;
    --secondary: #ea8229;
    --secondary-dark: #c76d20;

    /* Couleurs sémantiques */
    --blue-color: rgb(54 101 181);
    --orange-color: rgb(234 130 41);
    --back-blue-color: rgb(54 101 181 / 0.08);
    --back-orange-color: rgb(234 130 41 / 0.08);

    /* Texte */
    --text-primary: #111827;
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-light: #9ca3af;

    /* Fonds */
    --bg-white: #ffffff;
    --bg-light: #f9fafb;
    --bg-gray: #f3f4f6;

    /* Ombres */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12);
    --shadow-xl: 0 20px 40px rgba(15, 23, 42, 0.15);

    /* Rayons */
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --radius-full: 999px;

    /* Typographie */
    --font-family: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    /* Transitions */
    --transition: 0.2s ease;
    --transition-slow: 0.3s ease;
}

/* ========================================
   BASE
   ======================================== */
body {
    margin: 0;
    font-family: var(--font-family);
    background-color: var(--bg-white);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

main {
    padding-top: 72px;
}

/* ========================================
   HEADER / NAVBAR
   ======================================== */
header.client-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    z-index: 1002;
    height: 72px;
    transition: background-color var(--transition), box-shadow var(--transition);
}

header.client-header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.client-header-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    max-width: 1280px;
    margin: 0 auto;
    height: 100%;
}

.client-logo img {
    height: 50px;
}

.client-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 0.75rem 2rem;
    position: relative;
    z-index: 20;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1.8rem;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    position: relative;
    padding: 0.25rem 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color var(--transition);
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition-slow);
    border-radius: 1px;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-secondary-link {
    font-size: 0.8rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-full);
    border: 1px solid #e5e7eb;
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: all var(--transition);
}

.nav-secondary-link:hover {
    background-color: var(--bg-light);
    border-color: #d1d5db;
    color: var(--text-primary);
}

/* DROPDOWN PRESTATIONS */
.nav-item {
    position: relative;
}

.nav-has-dropdown {
    position: relative;
}

.nav-link-dropdown {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95rem;
}

.nav-arrow {
    font-size: 0.7rem;
    transition: transform var(--transition-slow);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: -16px;
    width: max-content;
    min-width: 360px;
    max-width: 90vw;
    background-color: var(--bg-white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xl);
    border: 1px solid rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
}

.dropdown-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
}

.dropdown-column {
    min-width: 0;
}

.dropdown-list {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.dropdown-item {
    display: flex;
    align-items: flex-start;
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: var(--text-secondary);
    cursor: pointer;
    gap: 0.75rem;
    transition: background-color var(--transition);
}

.dropdown-item:hover {
    background-color: var(--bg-light);
}

.dropdown-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--back-blue-color);
    color: var(--primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.dropdown-icon-secondary {
    background-color: var(--back-orange-color);
    color: var(--secondary);
}

.dropdown-icon-img {
    width: 24px;
    height: 24px;
    object-fit: contain;
    border-radius: 4px;
}

.dropdown-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.dropdown-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.dropdown-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

/* BURGER BUTTON */
.burger-button {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 28px;
    height: 22px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

.burger-line {
    width: 100%;
    height: 2.5px;
    background-color: var(--text-primary);
    border-radius: 3px;
    transition: all var(--transition-slow);
}

.burger-line.open:nth-child(1) {
    transform: translateY(9.75px) rotate(45deg);
}

.burger-line.open:nth-child(2) {
    opacity: 0;
}

.burger-line.open:nth-child(3) {
    transform: translateY(-9.75px) rotate(-45deg);
}

.dropdown-force-closed .nav-dropdown-menu {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Desktop hover dropdown */
@media (min-width: 769px) {
    .nav-has-dropdown:not(.dropdown-force-closed):hover .nav-dropdown-menu,
    .nav-has-dropdown:not(.dropdown-force-closed):focus-within .nav-dropdown-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }

    .nav-has-dropdown:not(.dropdown-force-closed) .nav-dropdown-menu:hover {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* ========================================
   PAGE HERO — Bandeau pages internes
   ======================================== */
.page-hero {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, var(--primary-darker) 100%);
    color: white;
    padding: 5rem 2rem 3.5rem;
    text-align: center;
    margin-top: -72px;
    padding-top: calc(72px + 3.5rem);
    position: relative;
    overflow: hidden;
}

.page-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(ellipse at 30% 50%, rgba(255, 255, 255, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    position: relative;
}

.page-hero p {
    font-size: 1.15rem;
    opacity: 0.8;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
    position: relative;
}

/* ========================================
   SECTIONS & CARDS
   ======================================== */
.section {
    padding: 5rem 0;
    width: 100%;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    margin-bottom: 3rem;
}

.title {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.section-subtitle {
    text-align: center;
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

.section-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-container-wide {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.card {
    background: var(--bg-white);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform var(--transition), box-shadow var(--transition);
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.card-hover {
    transition: all var(--transition-slow);
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    cursor: pointer;
}

/* ========================================
   BUTTONS
   ======================================== */
.btn {
    padding: 0.85rem 1.75rem;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all var(--transition);
    border: none;
    cursor: pointer;
    white-space: nowrap;
    letter-spacing: 0.01em;
}

.btn-primary,
.btn-primary:link,
.btn-primary:visited,
.btn-primary:focus,
.btn-primary:active {
    background-color: var(--primary);
    color: #ffffff;
    text-decoration: none;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(54, 101, 181, 0.3);
}

.btn-secondary,
.btn-secondary:link,
.btn-secondary:visited,
.btn-secondary:focus,
.btn-secondary:active {
    background-color: var(--secondary);
    color: #ffffff;
    text-decoration: none;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
    color: #ffffff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(234, 130, 41, 0.3);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    border: 2px solid #d1d5db;
    color: var(--text-secondary);
    text-decoration: none;
    display: inline-flex;
    padding: 0.65rem 1.5rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.95rem;
    transition: all var(--transition);
}

.btn-outline-secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--back-blue-color);
}

/* ========================================
   FORMS
   ======================================== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.form-control {
    width: 100%;
    padding: 0.7rem 0.85rem;
    border-radius: var(--radius-sm);
    border: 1.5px solid #e5e7eb;
    font-size: 0.95rem;
    font-family: var(--font-family);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    background: var(--bg-white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(54, 101, 181, 0.15);
}

textarea.form-control {
    resize: vertical;
    min-height: 140px;
}

.form-consent {
    margin-top: 0.5rem;
    margin-bottom: 1.5rem;
}

.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    margin-top: 0.15rem;
}

.validation-message {
    color: #dc2626;
    font-size: 0.8rem;
    margin-top: 0.25rem;
}

.error-alert {
    background: #fef2f2;
    color: #dc2626;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

/* ========================================
   FOOTER
   ======================================== */
.client-footer {
    background-color: var(--primary-darker);
    color: white;
    padding: 4rem 2rem 2rem;
}

.footer-content {
    max-width: 1280px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 2.5rem;
    margin-bottom: 3rem;
}

.footer-section h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

.footer-section p {
    color: var(--text-light);
    line-height: 1.7;
    font-size: 0.9rem;
}

.footer-section a {
    color: var(--text-light);
    text-decoration: none;
    display: block;
    margin-bottom: 0.6rem;
    font-size: 0.9rem;
    transition: color var(--transition);
}

.footer-section a:hover {
    color: white;
}

.footer-bottom {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 2rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

.control {
    padding: 10px;
}

/* ========================================
   BREADCRUMBS
   ======================================== */
.breadcrumb-nav {
    padding: 1rem 0;
}

.breadcrumb-nav.breadcrumb-light a,
.breadcrumb-nav.breadcrumb-light span {
    color: rgba(255, 255, 255, 0.7);
}

.breadcrumb-nav.breadcrumb-light a:hover {
    color: white;
}

/* ========================================
   RESPONSIVE — Tablette (≤ 1024px)
   ======================================== */
@media (max-width: 1024px) {
    .client-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-left {
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav-right {
        justify-content: center;
    }

    .page-hero h1 {
        font-size: 2.1rem;
    }
}

/* ========================================
   RESPONSIVE — Mobile (≤ 768px)
   ======================================== */
@media (max-width: 768px) {
    .burger-button {
        display: flex;
    }

    .client-logo img {
        max-height: 45px;
    }

    .client-nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background-color: var(--bg-white);
        flex-direction: column;
        padding: 80px 2rem 2rem 2rem;
        transform: translateX(-100%);
        transition: transform var(--transition-slow);
        z-index: 1000;
        overflow-y: auto;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    }

    .client-nav.mobile-open {
        transform: translateX(0);
    }

    .nav-left {
        flex-direction: column;
        width: 100%;
        gap: 0;
        align-items: stretch;
    }

    .nav-link {
        padding: 1rem 0;
        border-bottom: 1px solid #e5e7eb;
        font-size: 1.1rem;
    }

    .nav-link::after {
        display: none;
    }

    .nav-item,
    .nav-has-dropdown {
        position: relative;
        width: 100%;
    }

    .nav-link-dropdown {
        width: 100%;
        text-align: left;
        border: none;
        background: transparent;
        font-size: 1.1rem;
        color: var(--text-primary);
        padding: 1rem 0;
        border-bottom: 1px solid #e5e7eb;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }

    .nav-arrow {
        transition: transform var(--transition-slow);
    }

    .nav-arrow.rotated {
        transform: rotate(180deg);
    }

    .nav-dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        padding: 0;
        max-height: 0;
        overflow: hidden;
        opacity: 1;
        visibility: visible;
        transform: none;
        pointer-events: auto;
        transition: max-height var(--transition-slow);
        background-color: var(--bg-light);
        display: block;
    }

    .nav-dropdown-menu.dropdown-open {
        max-height: 600px;
        padding: 1rem 0;
    }

    .dropdown-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .dropdown-item {
        padding: 0.75rem 1rem;
        border-radius: 8px;
    }

    .nav-right {
        flex-direction: column;
        width: 100%;
        gap: 0.5rem;
        margin-top: 2rem;
        padding-top: 1.5rem;
        border-top: 1px solid #e5e7eb;
    }

    .nav-secondary-link {
        padding: 0.75rem 1rem;
        text-align: center;
        font-size: 1rem;
    }

    /* Page hero mobile */
    .page-hero {
        padding: 4rem 1.5rem 2.5rem;
        padding-top: calc(72px + 2.5rem);
    }

    .page-hero h1 {
        font-size: 1.8rem;
    }

    .page-hero p {
        font-size: 1rem;
    }

    /* Sections mobile */
    .section {
        padding: 3rem 0;
    }

    .title {
        font-size: 1.75rem;
    }

    .card {
        padding: 1.5rem;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    /* Footer mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

/* Mobile petit (≤ 480px) */
@media (max-width: 480px) {
    .client-logo img {
        max-height: 40px;
    }

    .client-nav {
        padding: 70px 1.5rem 1.5rem 1.5rem;
    }

    .nav-link,
    .nav-link-dropdown {
        font-size: 1rem;
        padding: 0.85rem 0;
    }

    .page-hero h1 {
        font-size: 1.6rem;
    }

    .title {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: 0.75rem 1.25rem;
    }

    .card {
        padding: 1.25rem;
    }
}

/* Hover on touch */
@media (hover: none) {
    .card-hover:hover {
        transform: none;
        box-shadow: var(--shadow-md);
    }

    .card:hover {
        transform: none;
    }

    .btn:hover {
        transform: none;
    }

    .nav-link:hover::after {
        width: 0;
    }
}

/* Print */
@media print {
    .client-header,
    .client-footer,
    .burger-button,
    .page-hero {
        display: none;
    }

    main {
        padding-top: 0;
    }
}

/* Champ piege anti-robot des formulaires publics (contact, devis) : hors ecran plutot que
   display:none (que certains robots savent ignorer) ; aria-hidden et tabindex=-1 dans le
   balisage pour que ni le clavier ni les lecteurs d'ecran ne l'atteignent. */
.form-hp {
    position: absolute !important;
    left: -10000px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
}

/* Contenus GrapesJS du site public (articles, prestations).
   Le CSS de ces contenus est cloisonne a .cms-racine (HtmlSanitizationService) : il ne peut
   cibler que ses propres elements. La containment ci-dessous ferme la derniere echappatoire :
   un element du contenu en position:fixed/absolute ou a z-index eleve reste confine au
   conteneur (layout = bloc conteneur et contexte d'empilement ; paint = rien ne deborde
   visuellement). overflow-x permet de faire defiler un contenu trop large (tableau). */
.article-editor,
.prestation-editor {
    contain: layout paint;
    isolation: isolate;
    overflow-x: auto;
}
