/* SPDX-License-Identifier: AGPL-3.0-only
 * Copyright (C) 2026 Vivian Epiney (AP-EdNum, HEP-VS) */
/* ============================================================
   legal.css — Styles unifiés des pages réglementaires et légales
   (cgu.html, confidentialite.html, mentions-legales.html)
   ============================================================ */

:root {
    --primary: #a52a23;
    --primary-hover: #cc362d;
    --secondary: #475569;
    --bg: #f8fafc;
    --card-bg: rgba(255, 255, 255, 0.8);
    --card-border: rgba(165, 42, 35, 0.15);
    --text-main: #0f172a;
    --text-light: #64748b;
    --border: #e2e8f0;
    --header-bg: linear-gradient(135deg, #a52a23, #cc362d);
    --header-text: #ffffff;
    --hero-bg: linear-gradient(135deg, rgba(165, 42, 35, 0.08), rgba(204, 54, 45, 0.03));
    --hero-border: rgba(165, 42, 35, 0.15);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.02);
}

body.dark {
    --primary: #cc362d;
    --primary-hover: #da5c55;
    --secondary: #94a3b8;
    --bg: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --card-border: rgba(218, 92, 85, 0.15);
    --text-main: #e2e8f0;
    --text-light: #94a3b8;
    --border: #334155;
    --header-bg: linear-gradient(135deg, #0f172a, #a52a23);
    --header-text: #f8fafc;
    --hero-bg: linear-gradient(135deg, rgba(204, 54, 45, 0.15), rgba(15, 23, 42, 0.4));
    --hero-border: rgba(204, 54, 45, 0.25);
    --card-shadow: 0 10px 35px -10px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    touch-action: manipulation;
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6;
}

body > header,
body > main {
    animation: fadeInCascade 0.5s var(--spring-easing, cubic-bezier(0.175, 0.885, 0.32, 1.275)) forwards;
}

@keyframes fadeInCascade {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Header structure --- */
header {
    background: var(--header-bg);
    color: var(--header-text);
    padding: 1.5rem 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 10;
}

.header-main {
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-back-btn,
.icon-action-btn {
    background: rgba(255, 255, 255, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #ffffff;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s var(--spring-easing, ease);
    flex-shrink: 0;
}

.header-back-btn:hover,
.icon-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
    color: #ffffff;
}

.header-back-btn:hover {
    transform: translateX(-3px);
}

.header-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    color: #ffffff;
    flex-shrink: 0;
}

.header-text-group h1 {
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.2;
    color: #ffffff;
}

.header-text-group p {
    font-size: 0.95rem;
    opacity: 0.9;
    margin-top: 0.2rem;
    color: #ffffff;
}

main {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    flex: 1;
    width: 100%;
}

/* --- Sous-navigation des pages légales --- */
.legal-nav {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.legal-nav-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border-radius: 9999px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text-light);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    transition: all 0.2s var(--spring-easing, ease);
}

.legal-nav-pill:hover {
    color: var(--primary);
    border-color: var(--primary);
    transform: translateY(-2px);
}

.legal-nav-pill.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(165, 42, 35, 0.25);
}

/* --- Badge de version & date --- */
.legal-meta-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.85rem;
    background: rgba(165, 42, 35, 0.08);
    border: 1px solid var(--card-border);
    border-radius: 9999px;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
}

body.dark .legal-meta-badge {
    background: rgba(204, 54, 45, 0.15);
    color: #fca5a5;
}

/* --- Sections et cartes de contenu --- */
.legal-hero {
    background: var(--hero-bg);
    border: 1px solid var(--hero-border);
    border-radius: var(--radius-lg, 16px);
    padding: 1.5rem 1.75rem;
    margin-bottom: 2rem;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.legal-hero h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.5rem;
}

.legal-card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.legal-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg, 16px);
    padding: 1.75rem;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(12px) saturate(180%);
    -webkit-backdrop-filter: blur(12px) saturate(180%);
    transition: border-color 0.2s;
    scroll-margin-top: 2rem;
}

.legal-card:hover {
    border-color: rgba(165, 42, 35, 0.35);
}

.card-header-group {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    margin-bottom: 1rem;
}

.card-icon-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(165, 42, 35, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.legal-card h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-main);
}

.legal-card p,
.legal-card ul {
    color: var(--text-main);
    font-size: 0.96rem;
    margin-bottom: 0.85rem;
}

.legal-card ul {
    padding-left: 1.5rem;
}

.legal-card li {
    margin-bottom: 0.4rem;
}

.legal-card a {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 600;
}

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

.badge-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(165, 42, 35, 0.12);
    color: var(--primary);
    margin-right: 0.4rem;
    vertical-align: middle;
}

/* --- Anti-bot e-mail & copy wrapper (Mentions légales & Contact) --- */
.email-contact-wrapper {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.4rem;
}

.email-obfuscated {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.85rem;
    background: rgba(165, 42, 35, 0.08);
    border: 1px dashed var(--primary);
    border-radius: 8px;
    color: var(--primary);
    font-family: monospace;
    font-size: 0.95rem;
    cursor: pointer;
    text-decoration: none !important;
    transition: all 0.2s ease;
}

.email-obfuscated:hover {
    background: var(--primary);
    color: #ffffff !important;
    border-style: solid;
}

.copy-email-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.copy-email-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* --- Footer standardisé --- */
footer {
    margin-top: auto;
    padding: 2.5rem 1rem;
    text-align: center;
    color: var(--text-light);
    font-size: 0.875rem;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 10%;
    right: 10%;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0.3;
}

footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: color 0.2s;
}

footer a:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}

body.dark footer a {
    color: #f87171 !important;
    text-decoration: underline;
    text-underline-offset: 2px;
}

body.dark footer a:hover {
    color: #fca5a5 !important;
}

body.dark footer span {
    color: #94a3b8;
}

/* --- Impression optimisée --- */
@media print {
    .no-print,
    .header-back-btn,
    .header-actions,
    .legal-nav,
    .copy-email-btn,
    footer {
        display: none !important;
    }

    body {
        background: #ffffff !important;
        color: #000000 !important;
    }

    header {
        background: none !important;
        color: #000000 !important;
        padding: 1rem 0 !important;
        box-shadow: none !important;
        border-bottom: 2px solid #a52a23 !important;
    }

    .header-icon {
        border: 1px solid #a52a23 !important;
        color: #a52a23 !important;
        background: none !important;
    }

    .header-text-group h1,
    .header-text-group p {
        color: #000000 !important;
    }

    main {
        padding: 1rem 0 !important;
        max-width: 100% !important;
    }

    .legal-hero,
    .legal-card {
        background: #ffffff !important;
        border: 1px solid #cbd5e1 !important;
        box-shadow: none !important;
        color: #000000 !important;
        break-inside: avoid;
        page-break-inside: avoid;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    .legal-card a {
        color: #000000 !important;
        text-decoration: underline !important;
    }
}

/* --- Mobile responsiveness --- */
@media (max-width: 600px) {
    header {
        padding: 1.25rem 1rem;
    }

    .header-left {
        gap: 0.85rem;
    }

    .header-icon {
        width: 44px;
        height: 44px;
        font-size: 22px;
    }

    .header-text-group h1 {
        font-size: 1.4rem;
    }

    main {
        padding: 1.25rem 1rem;
    }

    .legal-card {
        padding: 1.25rem;
    }
}
