/**
 * @project: kwASSET
 * @asset: praxis
 * @version: 0.1.5
 * @encoding: UTF-8
 * @compliance: GDPR, EU-Accessibility, Data Sovereignty
 * @copyright: (c) 2025-2026 kwargs SRL
 * @description: Base styles — layout, components, accessibility.
 */

/* ── PRAXIS : STYLES DE BASE ──────────────────────────────────── */

:root {
    --ks-font-main: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
    --ks-border-radius: 0;
}

body {
    font-family: var(--ks-font-main);
    font-weight: 420; /* Hanken Grotesk variable : entre regular (400) et medium (500) */
}

/* ── Navbar ──────────────────────────────────────────────────── */

.navbar {
    background-color: var(--bs-body-bg);
}

/* ── Sections ────────────────────────────────────────────────── */

.section {
    padding-top: 3rem;
}

/* ── Cards ────────────────────────────────────────────────────── */

.card {
    box-shadow: var(--bs-box-shadow-lg);
    border-radius: var(--ks-border-radius);
}

/* ── Scroll to top ───────────────────────────────────────────── */

#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    inset-inline-end: 20px; /* RTL-safe : right en LTR, left en RTL */
    display: none; /* Géré par JS — bascule vers flex via craft-ui.js */
    z-index: 1000;
    width: 40px;
    height: 40px;
    padding: 0;
    align-items: center;
    justify-content: center;
    background-color: var(--ks-primary);
    border: none;
    border-radius: var(--ks-border-radius);
    box-shadow: none;
    transition: var(--ks-transition);
}

#btn-back-to-top:hover {
    background-color: var(--ks-secondary);
    transform: translateY(-5px);
}

#btn-back-to-top:focus-visible {
    outline: 2px solid var(--ks-secondary);
    outline-offset: 2px;
}

/* ── Messages ────────────────────────────────────────────────── */

.message-container {
    position: fixed;
    bottom: 0;
    inset-inline-start: 0; /* RTL-safe : left en LTR, right en RTL */
    margin: 0 10px 10px;
    z-index: 1050;
    display: flex;
    flex-direction: column-reverse; /* Empile de bas en haut */
}

.message-alert {
    padding-inline-start: 10px; /* RTL-safe */
    margin-bottom: 3px;
}

.message-alert .alert {
    opacity: 1;
    transition: opacity 0.5s ease-out;
    border: none;
    border-inline-start: 4px solid var(--bs-alert-color); /* RTL-safe */
}

/* ── Icônes de la navbar ─────────────────────────────────────── */
/* Remplace les styles inline et les longues chaînes utilitaires. */

.navbar-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.5rem;
    font-size: 1.2rem;
    background: none;
    border: none;
    color: var(--bs-body-color);
    text-decoration: none;
    box-shadow: none;
    cursor: pointer;
    transition: var(--ks-transition);
}

.navbar-icon:hover,
.navbar-icon:focus-visible {
    color: var(--ks-primary);
}

/* ── Cookie banner RGPD ─────────────────────────────────────── */

#rgpd-cookie-banner {
    position: fixed;
    bottom: 0;
    inset-inline-start: 0; /* RTL-safe */
    inset-inline-end: 0;
    padding: 1rem;
    z-index: 1055;
    display: none; /* Géré par JS */
}

#rgpd-cookie-banner .bi-shield-check {
    color: var(--ks-success);
}

/* ── Tables (craft-table) ───────────────────────────────────── */

.craft-table-toolbar {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.75rem;
}

.craft-table-search {
    max-width: 280px;
}

.craft-table-pagination {
    margin-top: 0.75rem;
}

/* Indicateur de tri dans les en-têtes */
[data-craft-table] thead th[aria-sort] {
    position: relative;
    padding-inline-end: 1.5rem;
    user-select: none;
}

[data-craft-table] thead th[aria-sort]::after {
    position: absolute;
    inset-inline-end: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
    content: '⇅';
}

[data-craft-table] thead th[aria-sort="ascending"]::after {
    content: '↑';
    opacity: 1;
}

[data-craft-table] thead th[aria-sort="descending"]::after {
    content: '↓';
    opacity: 1;
}

/* ── Profil ──────────────────────────────────────────────────── */

.profile-avatar {
    width: 75px;
    height: 75px;
    object-fit: cover;
}

/* ── Composants ergonomiques ─────────────────────────────────── */
/* Patterns réutilisables inspirés du template Front v4.3.1.     */

/* Label de section (uppercase, semi-bold, petit) */
.text-cap {
    display: block;
    font-size: .8125rem;
    font-weight: 600;
    letter-spacing: .03125rem;
    text-transform: uppercase;
    margin-bottom: .75rem;
}

/* Cercle d'icône (conteneur rond pour Bootstrap Icons) */
.icon-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
}

/* Carte avec effet de survol (élévation) */
.card-transition {
    transition: transform .2s ease-in-out, box-shadow .2s ease-in-out;
}

.card-transition:hover {
    transform: translateY(-.1875rem);
    box-shadow: 0 .5rem 1.5rem rgba(0, 0, 0, .1) !important;
}

/* ── Step (timeline horizontale / verticale) ────────────────── */

.step {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.step-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    font-weight: 700;
    font-size: 1.125rem;
    flex-shrink: 0;
}

.step-icon-soft-primary {
    background-color: var(--bs-body-bg);
    box-shadow: inset 0 0 0 100px rgba(var(--ks-primary-rgb, 13, 110, 253), .1);
    color: var(--ks-primary, var(--bs-primary));
    position: relative;
    z-index: 2;
}

/* Layout horizontal centré (md+) */
@media (min-width: 768px) {
    .step-centered {
        display: flex;
    }

    .step-centered .step-item {
        flex: 1;
        text-align: center;
        position: relative;
    }

    .step-centered .step-item + .step-item::before {
        content: '';
        position: absolute;
        top: 1.75rem;
        left: 0;
        right: 50%;
        height: 2px;
        background-color: rgba(var(--ks-primary-rgb, 13, 110, 253), .2);
        z-index: 0;
    }

    .step-centered .step-item:not(:last-child)::after {
        content: '';
        position: absolute;
        top: 1.75rem;
        left: 50%;
        right: 0;
        height: 2px;
        background-color: rgba(var(--ks-primary-rgb, 13, 110, 253), .2);
        z-index: 0;
    }

    .step-centered .step-icon {
        position: relative;
        z-index: 1;
    }

    .step-centered .step-content p {
        text-align: start;
    }
}

/* Layout vertical (mobile) */
@media (max-width: 767.98px) {
    .step-item {
        display: flex;
        align-items: flex-start;
        gap: 1rem;
    }

    .step-item + .step-item {
        margin-top: 1.5rem;
    }
}

/* ── Accessibilité ───────────────────────────────────────────── */

/* Focus visible pour la navigation clavier (WCAG 2.1 AA) */
:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

/* Désactiver les animations si l'utilisateur le demande (EAA) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
