/* ============================================
   AKOLABS - Global Styles & Reset
   ============================================ */

/* === RESET === */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: var(--font-regular);
    font-size: var(--text-base);
    line-height: var(--line-height-normal);
    color: var(--color-text-primary);
    background: var(--color-bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Empêcher le zoom sur double-tap */
    touch-action: manipulation;
    /* Empêcher la sélection de texte non voulue */
    -webkit-user-select: none;
    user-select: none;
    /* Empêcher le pull-to-refresh du navigateur (on a le nôtre) */
    overscroll-behavior-y: contain;
}

/* Autoriser la sélection sur les inputs et textes importants */
input, textarea, .selectable {
    -webkit-user-select: text;
    user-select: text;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font-family: inherit;
    font-size: inherit;
    border: none;
    background: none;
    cursor: pointer;
    outline: none;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, select, textarea {
    font-family: inherit;
    font-size: var(--text-base);
    outline: none;
    border: none;
    background: transparent;
}

ul, ol {
    list-style: none;
}

/* === SCROLLBAR CUSTOM === */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(var(--color-accent-rgb), 0.3);
    border-radius: var(--radius-full);
}

/* === SPLASH SCREEN === */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    background: var(--gradient-primary-vertical);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-splash);
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.splash-screen.fade-out {
    opacity: 0;
    visibility: hidden;
}

.splash-content {
    text-align: center;
    animation: splashPulse 2s ease-in-out infinite;
}

.splash-logo {
    width: 120px;
    height: 120px;
    object-fit: contain;
    /* La magie est ici : margin: 0 auto centre l'élément block */
    margin: 0 auto var(--space-xl); 
    filter: drop-shadow(var(--shadow-gold));
}

.splash-text {
    font-family: var(--font-heading);
    color: var(--color-accent-light);
    font-size: var(--text-sm);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-top: var(--space-lg);
}

.splash-loader {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(var(--color-accent-rgb), 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    margin: 0 auto;
    animation: spin 0.8s linear infinite;
}

/* === APP CONTAINER === */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    max-width: var(--content-max-width);
    margin: 0 auto;
    position: relative;
    overflow: hidden;
}
/* === HEADER === */
.app-header {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--content-max-width);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-base);
    background: var(--gradient-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 2px 20px rgba(75,0,130,0.25);
    z-index: var(--z-header);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.header-logo {
    height: 36px;
    width: auto;
    object-fit: contain;
    -webkit-user-select: none;
    user-select: none;
    pointer-events: none;
}

.header-brand-name {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--color-accent-light);
    font-weight: var(--font-bold);
    letter-spacing: 1px;
    -webkit-user-select: none;
    user-select: none;
}

.header-title {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    color: var(--color-accent-light);
    font-weight: var(--font-bold);
}

/* Protection globale contre le téléchargement d'images */
img {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    pointer-events: none;
}

/* Réactiver les clics sur les images qui en ont besoin */
img.clickable,
.profile-avatar img,
#user-avatar,
.section-card img,
.formation-card img,
.affil-history-avatar {
    pointer-events: auto;
    -webkit-touch-callout: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-btn {
    position: relative;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
    background: rgba(255,255,255,0.12);
    color: rgba(255,255,255,0.90);
    font-size: var(--text-lg);
    transition: all var(--transition-base);
}

.header-btn:active {
    transform: scale(0.92);
    background: var(--glass-bg-strong);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-error);
    color: var(--color-white);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid transparent;
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    overflow: hidden;
    border: 2px solid var(--color-accent);
    cursor: pointer;
    transition: transform var(--transition-base);
}

.header-avatar:active {
    transform: scale(0.92);
}

.header-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-top: var(--header-height);
    padding: var(--space-base);
    padding-bottom: calc(var(--bottom-nav-height) + var(--space-xl));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    /* Height exacte = viewport - header - nav, avec padding-bottom pour le contenu du bas */
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    /* Assure que le scroll va jusqu'au bas du dernier élément */
    scroll-padding-bottom: var(--bottom-nav-height);
}
/* === BOTTOM NAV === */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--content-max-width);
    height: var(--bottom-nav-height);
    display: flex;
    align-items: center;
    justify-content: space-around;
    background: var(--gradient-header);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-top: 1px solid rgba(255,255,255,0.10);
    box-shadow: 0 -2px 20px rgba(75,0,130,0.20);
    z-index: var(--z-bottom-nav);
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: var(--space-xs) var(--space-sm);
    color: rgba(255,255,255,0.45);
    font-size: var(--text-xs);
    transition: all var(--transition-base);
    position: relative;
    min-width: 60px;
}

.nav-item i {
    font-size: var(--text-xl);
    transition: all var(--transition-spring);
}

.nav-item span {
    font-weight: var(--font-medium);
}

.nav-item.active {
    color: var(--color-accent-light);
}

.nav-item.active i {
    transform: translateY(-2px) scale(1.15);
    text-shadow: 0 0 12px rgba(var(--color-accent-rgb), 0.5);
}

.nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%) scaleX(0);
    width: 30px;
    height: 3px;
    background: var(--color-accent);
    border-radius: 0 0 var(--radius-full) var(--radius-full);
    transition: transform var(--transition-spring);
}

.nav-item.active::before {
    transform: translateX(-50%) scaleX(1);
}

.nav-item:active {
    transform: scale(0.9);
}

/* === PAGE LOADER === */
.page-loader {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 60vh;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(var(--color-accent-rgb), 0.2);
    border-top-color: var(--color-accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* === TOAST NOTIFICATIONS === */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    max-width: calc(var(--content-max-width) - 32px);
    width: calc(100% - 32px);
    padding: var(--space-md) var(--space-base);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-weight: var(--font-medium);
    z-index: var(--z-toast);
    opacity: 0;
    transition: all var(--transition-spring);
    backdrop-filter: var(--glass-blur);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-success {
    background: rgba(40, 167, 69, 0.95);
    color: var(--color-white);
    border: 1px solid rgba(40, 167, 69, 0.5);
}

.toast-error {
    background: rgba(220, 53, 69, 0.95);
    color: var(--color-white);
    border: 1px solid rgba(220, 53, 69, 0.5);
}

.toast-info {
    background: rgba(var(--color-primary-rgb), 0.95);
    color: #FFFFFF;
    border: 1px solid rgba(255,255,255,0.15);
}

.toast-warning {
    background: rgba(255, 193, 7, 0.95);
    color: var(--color-dark);
    border: 1px solid rgba(255, 193, 7, 0.5);
}

.toast i {
    font-size: var(--text-lg);
}

/* === SKELETON LOADING === */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--color-gray-100) 25%,
        var(--color-gray-200) 50%,
        var(--color-gray-100) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
}

.skeleton-text {
    height: 14px;
    margin-bottom: 8px;
    width: 100%;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-title {
    height: 22px;
    width: 80%;
    margin-bottom: 12px;
}

.skeleton-image {
    width: 100%;
    height: 180px;
    margin-bottom: 12px;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-full);
}

.skeleton-button {
    height: 44px;
    width: 140px;
    border-radius: var(--radius-full);
}

/* === ANIMATIONS === */
@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes splashPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.05); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes confettiFall {
    0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
    100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === PAGE TRANSITIONS === */
.page-enter {
    animation: fadeInUp 0.35s ease forwards;
}

.page-exit {
    animation: fadeIn 0.2s ease reverse forwards;
}

/* === UTILITY CLASSES === */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.text-accent { color: var(--color-accent); }
.text-primary { color: var(--color-primary); }
.text-muted { color: var(--color-gray-500); }
.text-success { color: var(--color-success); }
.text-error { color: var(--color-error); }
.text-white { color: var(--color-white); }

.font-heading { font-family: var(--font-heading); }
.font-body { font-family: var(--font-body); }

.fw-light { font-weight: var(--font-light); }
.fw-regular { font-weight: var(--font-regular); }
.fw-medium { font-weight: var(--font-medium); }
.fw-semibold { font-weight: var(--font-semibold); }
.fw-bold { font-weight: var(--font-bold); }

.d-flex { display: flex; }
.d-block { display: block; }
.d-none { display: none; }
.d-grid { display: grid; }

.flex-col { flex-direction: column; }
.flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.gap-xs { gap: var(--space-xs); }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-base { gap: var(--space-base); }
.gap-lg { gap: var(--space-lg); }
.gap-xl { gap: var(--space-xl); }

.mt-sm { margin-top: var(--space-sm); }
.mt-base { margin-top: var(--space-base); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-base { margin-bottom: var(--space-base); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

.p-sm { padding: var(--space-sm); }
.p-base { padding: var(--space-base); }
.p-lg { padding: var(--space-lg); }
.p-xl { padding: var(--space-xl); }

.w-full { width: 100%; }
.h-full { height: 100%; }

.rounded-md { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.overflow-hidden { overflow: hidden; }
.relative { position: relative; }
.absolute { position: absolute; }

.truncate {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === HIDDEN ELEMENTS === */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* === BOTTOM SHEET MODAL === */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-modal-backdrop);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-base);
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%) translateY(100%);
    width: 100%;
    max-width: var(--content-max-width);
    max-height: 85vh;
    background: var(--color-gray-900);
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    z-index: var(--z-modal);
    transition: transform var(--transition-spring);
    overflow-y: auto;
}

.bottom-sheet.active {
    transform: translateX(-50%) translateY(0);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--color-gray-600);
    border-radius: var(--radius-full);
    margin: var(--space-sm) auto var(--space-base);
}

.bottom-sheet-content {
    padding: 0 var(--space-xl) var(--space-xl);
}

/* === CONFETTI === */
.confetti-container {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    top: -10px;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s linear forwards;
}
/* ============================================
   GLOBAL PATCH - THÈME LIGHT PREMIUM
   ============================================ */

/* Spinner sur fond clair */
.spinner {
    border: 3px solid rgba(75,0,130,0.12);
    border-top-color: var(--color-primary);
}

/* Pull-to-refresh */
.pull-refresh-indicator {
    background: var(--color-surface);
    color: var(--color-primary);
    box-shadow: var(--shadow-md);
}

/* Page loader */
.page-loader {
    background: var(--color-bg);
}

/* Nav item texte inactif - visible mais discret */
.nav-item {
    color: rgba(255,255,255,0.50);
}
.nav-item.active {
    color: var(--color-accent-light);
}
.nav-item span {
    font-size: 10px;
    font-weight: var(--font-medium);
}

/* Header badge notification */
.notification-badge {
    border: 2px solid var(--color-primary-dark) !important;
}

/* Scrollbar discrète */
::-webkit-scrollbar {
    width: 3px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--color-border-strong);
    border-radius: var(--radius-full);
}

