/* ===========================================
   LEGAL PAGES - Fidelis Design System
   Pages: Privacy, CGU, CGV, DPA, Subcontractors
   =========================================== */

/* --- LAYOUT PRINCIPAL --- */
.legal-container {
    min-height: 100vh;
    padding: 6rem 1.5rem 4rem;
    max-width: 1400px;
    margin: 0 auto;
}

.legal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
    align-items: start;
}

/* --- HEADER --- */
.legal-header {
    margin-bottom: 2rem;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.4));
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.legal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.legal-header:hover {
    transform: none;
}

.legal-header__content {
    text-align: center;
}

.legal-header__content h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.legal-header__subtitle {
    color: var(--text-tertiary);
    font-size: 1.125rem;
    margin-bottom: 1.5rem;
}

.legal-header__meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.legal-header__meta .badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.legal-header__meta .badge .icon {
    width: 1rem;
    height: 1rem;
}

.badge--success {
    background: rgba(16, 185, 129, 0.1);
    border-color: rgba(16, 185, 129, 0.3);
    color: #10b981;
}

/* --- SIDEBAR --- */
.legal-sidebar {
    position: sticky;
    top: 5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: calc(100vh - 6rem);
    overflow-y: auto;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--surface-light) transparent;
}

/* Scrollbar personnalisée pour Webkit (Chrome, Safari, Edge) */
.legal-sidebar::-webkit-scrollbar {
    width: 6px;
}

.legal-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.legal-sidebar::-webkit-scrollbar-thumb {
    background: var(--surface-light);
    border-radius: 3px;
}

.legal-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--surface-hover);
}

/* Cards individuelles dans la sidebar */
.legal-sidebar__card {
    background: rgba(30, 41, 59, 0.6) !important;
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-light) !important;
    padding: 1.25rem !important;
}

.legal-sidebar__card:hover {
    transform: none !important;
}

.legal-nav__title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-light);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-accent);
}

/* Navigation entre pages - Reset des styles nav globaux de base.css */
.legal-nav__pages {
    position: static;
    top: auto;
    left: auto;
    right: auto;
    z-index: auto;
    backdrop-filter: none;
    background: transparent;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.legal-nav__pages a {
    display: block;
    padding: 0.625rem 0.875rem;
    border-radius: 0.5rem;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.legal-nav__pages a:hover {
    background: var(--surface-light);
    color: var(--text-primary);
}

.legal-nav__pages a.active {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--border-accent);
    color: var(--accent-light);
}

/* Sommaire de la page */
.legal-nav__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.legal-nav__list li a {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    border-left: 2px solid transparent;
}

.legal-nav__list li a:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
    border-left-color: var(--accent-primary);
}

/* --- CONTENU PRINCIPAL --- */
.legal-content {
    background: rgba(30, 41, 59, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-light);
    padding: 2.5rem;
}

.legal-content:hover {
    transform: none;
}

/* --- SECTIONS --- */
.legal-section {
    padding-bottom: 2.5rem;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-subtle);
}

.legal-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.legal-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--accent-primary);
    display: inline-block;
}

.legal-section h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 1.75rem;
    margin-bottom: 0.75rem;
}

.legal-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-top: 1.25rem;
    margin-bottom: 0.5rem;
}

.legal-section p {
    color: var(--text-tertiary);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-section ul,
.legal-section ol {
    color: var(--text-tertiary);
    line-height: 1.75;
    margin: 1rem 0;
    padding-left: 1.5rem;
}

.legal-section li {
    margin-bottom: 0.5rem;
}

.legal-section li ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.legal-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

.legal-section a {
    color: var(--accent-light);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.legal-section a:hover {
    color: var(--accent-primary);
}

.legal-section code {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
    color: var(--accent-light);
    font-family: 'SF Mono', Monaco, 'Cascadia Code', monospace;
}

/* --- INFO BOX --- */
.info-box {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(59, 130, 246, 0.03));
    border: 1px solid var(--border-accent);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
}

.info-box h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--accent-light);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.info-box p {
    margin-bottom: 0;
    font-size: 0.9375rem;
}

.info-box ul {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}

.info-box li {
    margin-bottom: 0.25rem;
    font-size: 0.9375rem;
}

.info-box .btn {
    margin-top: 1rem;
    font-size: 0.875rem;
    padding: 0.625rem 1.25rem;
}

/* --- WARNING BOX --- */
.warning-box {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 3px solid #f59e0b;
    border-radius: 0 0.75rem 0.75rem 0;
    padding: 1.25rem 1.5rem;
    margin: 1.25rem 0;
    color: var(--text-secondary);
    font-size: 0.9375rem;
    line-height: 1.7;
}

.warning-box strong {
    color: #fbbf24;
}

.warning-box p {
    margin: 0.75rem 0 0;
}

.warning-box p:first-child {
    margin-top: 0;
}

/* --- DEFINITION LIST --- */
.definition-list {
    margin: 1.5rem 0;
}

.definition-list dt {
    font-weight: 600;
    color: var(--accent-light);
    margin-top: 1.25rem;
    margin-bottom: 0.375rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent-primary);
}

.definition-list dt:first-child {
    margin-top: 0;
}

.definition-list dd {
    margin-left: 0;
    padding-left: 1rem;
    color: var(--text-tertiary);
    line-height: 1.7;
    border-left: 2px solid var(--border-light);
}

/* --- ROLE CARD --- */
.role-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.25rem 1.5rem;
    margin: 1rem 0;
    transition: all var(--transition-fast);
}

.role-card:hover {
    border-color: var(--border-accent);
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

.role-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.role-card p {
    margin-bottom: 0;
    font-size: 0.9375rem;
}

/* --- SECURITY GRID --- */
.security-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.security-card {
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8), rgba(30, 41, 59, 0.4));
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.5rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.security-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-light));
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.security-card:hover {
    border-color: var(--border-accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
}

.security-card:hover::before {
    opacity: 1;
}

.security-card__icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    display: block;
}

.security-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.security-card p {
    font-size: 0.875rem;
    color: var(--text-tertiary);
    line-height: 1.6;
    margin: 0;
}

/* --- RIGHTS GRID --- */
.rights-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
}

.right-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    padding: 1.25rem;
    transition: all var(--transition-fast);
    text-align: center;
}

.right-card:hover {
    border-color: var(--border-accent);
    background: rgba(59, 130, 246, 0.05);
}

.right-card h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-top: 0;
    margin-bottom: 0.5rem;
}

.right-card p {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    line-height: 1.5;
    margin: 0;
}

/* --- CONTACT BOX --- */
.contact-box {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

/* --- CONTACT GRID --- */
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    padding: 1.25rem;
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid var(--border-light);
    border-radius: 0.75rem;
    transition: all var(--transition-fast);
}

.contact-item:hover {
    border-color: var(--border-accent);
    background: rgba(59, 130, 246, 0.05);
}

.contact-item .icon {
    width: 1.5rem;
    height: 1.5rem;
    color: var(--accent-light);
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.contact-item strong {
    display: block;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.contact-item p {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
}

/* --- TABLEAUX --- */
.table-wrapper {
    overflow-x: auto;
    margin: 1.25rem 0;
    border-radius: 0.75rem;
    border: 1px solid var(--border-light);
}

.legal-section table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}

.legal-section thead {
    background: rgba(59, 130, 246, 0.1);
}

.legal-section th {
    padding: 1rem 1.25rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
    white-space: nowrap;
}

.legal-section td {
    padding: 0.875rem 1.25rem;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border-subtle);
    vertical-align: top;
}

.legal-section tbody tr:last-child td {
    border-bottom: none;
}

.legal-section tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

/* --- HIGHLIGHT --- */
.highlight {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid var(--accent-primary);
    padding: 0.75rem 1rem;
    border-radius: 0 0.5rem 0.5rem 0;
    margin: 1rem 0;
    font-size: 0.9375rem;
}

/* --- FOOTER --- */
.legal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-light);
}

.legal-footer .btn {
    font-size: 0.9375rem;
}

.btn--ghost {
    background: transparent;
    border: 1px solid var(--border-medium);
    color: var(--text-secondary);
}

.btn--ghost:hover {
    background: var(--surface);
    color: var(--text-primary);
    border-color: var(--border-accent);
}

/* ===========================================
   RESPONSIVE
   =========================================== */

@media (max-width: 1024px) {
    .legal-layout {
        grid-template-columns: 240px 1fr;
        gap: 1.5rem;
    }

    .rights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .legal-container {
        padding: 5rem 1rem 3rem;
    }

    .legal-layout {
        grid-template-columns: 1fr;
    }

    .legal-sidebar {
        position: static;
        order: -1;
        flex-direction: row;
        flex-wrap: wrap;
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }

    .legal-sidebar__card {
        flex: 1;
        min-width: 200px;
    }

    .legal-nav__pages {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .legal-nav__pages a {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .legal-nav__list {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 0.25rem;
    }

    .legal-content {
        padding: 1.75rem;
    }

    .security-grid {
        grid-template-columns: 1fr;
    }

    .rights-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .legal-container {
        padding: 4.5rem 0.75rem 2rem;
    }

    .legal-header {
        padding: 1.5rem;
    }

    .legal-header__content h1 {
        font-size: 1.75rem;
    }

    .legal-header__subtitle {
        font-size: 1rem;
    }

    .legal-header__meta {
        flex-direction: column;
        align-items: center;
    }

    .legal-sidebar {
        flex-direction: column;
    }

    .legal-sidebar__card {
        padding: 1rem !important;
    }

    .legal-nav__pages {
        flex-direction: column;
    }

    .legal-nav__list {
        grid-template-columns: 1fr;
    }

    .legal-content {
        padding: 1.25rem;
    }

    .legal-section {
        padding-bottom: 1.75rem;
        margin-bottom: 1.75rem;
    }

    .legal-section h2 {
        font-size: 1.25rem;
    }

    .legal-section h3 {
        font-size: 1rem;
    }

    .info-box,
    .role-card {
        padding: 1rem 1.25rem;
    }

    .security-grid,
    .rights-grid {
        grid-template-columns: 1fr;
    }

    .contact-grid,
    .contact-box {
        grid-template-columns: 1fr;
    }

    .legal-footer {
        flex-direction: column;
    }

    .legal-footer .btn {
        width: 100%;
        justify-content: center;
    }

    .table-wrapper {
        margin-left: -0.5rem;
        margin-right: -0.5rem;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .legal-section th,
    .legal-section td {
        padding: 0.75rem 1rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {
    .legal-header__content h1 {
        font-size: 1.5rem;
    }

    .legal-nav__pages a {
        padding: 0.5rem 0.625rem;
        font-size: 0.8125rem;
    }

    .badge {
        font-size: 0.8125rem;
        padding: 0.5rem 1rem;
    }
}