/* =========================================================
   APP-MODERN.CSS — Design System Mobile-First
   ========================================================= */

:root {
    /* Palette */
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #e0e7ff;
    --success: #10b981;
    --success-dark: #059669;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-dark: #dc2626;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #0ea5e9;
    
    /* Neutres */
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-2: #f9fafb;
    --border: #e5e7eb;
    --text: #111827;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    
    /* Espacements */
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;
    
    /* Ombres */
    --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
    --shadow-sm: 0 2px 8px rgba(0,0,0,.05);
    --shadow: 0 6px 20px rgba(0,0,0,.07);
    --shadow-lg: 0 15px 40px rgba(0,0,0,.10);
    --shadow-primary: 0 10px 30px rgba(99,102,241,.35);
    --shadow-success: 0 10px 30px rgba(16,185,129,.35);
    --shadow-danger: 0 10px 30px rgba(239,68,68,.35);
    
    /* Transitions */
    --t-fast: .15s ease;
    --t: .25s ease;
    --t-slow: .4s cubic-bezier(.22,1,.36,1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Inter', 'Exo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior-y: none;
    padding-bottom: env(safe-area-inset-bottom);
}

/* =========================================================
   TOP APP BAR
   ========================================================= */
.app-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--surface);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
}

.app-bar.with-color {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-bottom: none;
    color: #fff;
}

.app-bar-title {
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.2px;
    margin: 0;
    flex: 1;
    text-align: center;
}

.app-bar-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(0,0,0,.04);
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    font-size: 18px;
    cursor: pointer;
    transition: var(--t);
    text-decoration: none;
}

.app-bar-btn:hover { background: rgba(0,0,0,.08); }
.app-bar-btn:active { transform: scale(.94); }

.app-bar.with-color .app-bar-btn {
    background: rgba(255,255,255,.18);
    color: #fff;
}
.app-bar.with-color .app-bar-btn:hover { background: rgba(255,255,255,.28); }

/* =========================================================
   CONTENEUR
   ========================================================= */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
    min-height: calc(100vh - 68px);
}

/* =========================================================
   HERO / PROFILE HEADER
   ========================================================= */
.hero {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    padding: 22px 18px;
    margin: -16px -16px 20px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -60px;
    right: -60px;
    width: 180px;
    height: 180px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: -40px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}

.hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 14px;
}

.hero-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid rgba(255,255,255,.4);
    background: rgba(255,255,255,.2);
}

.hero-info { flex: 1; min-width: 0; }
.hero-info h2 {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hero-info p {
    font-size: 13px;
    opacity: .85;
    margin: 0;
}

.hero-actions { display: flex; gap: 8px; }
.hero-actions .btn-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,.18);
    color: #fff;
    border: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    cursor: pointer;
    transition: var(--t);
    text-decoration: none;
    position: relative;
}
.hero-actions .btn-icon:hover { background: rgba(255,255,255,.3); }
.hero-actions .btn-icon .badge {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--danger);
    color: #fff;
    font-size: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--primary-dark);
}

/* =========================================================
   CARTES
   ========================================================= */
.card-modern {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    margin-bottom: 14px;
    transition: var(--t);
}

.card-modern.no-border { border: none; box-shadow: var(--shadow); }
.card-modern.flat { box-shadow: none; background: var(--surface-2); }

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title i { color: var(--primary); font-size: 16px; }

/* =========================================================
   STAT CARDS
   ========================================================= */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-bottom: 8px;
}

.stat-card .stat-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.1;
    margin-bottom: 2px;
    font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.stat-card.primary .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-card.success .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.danger  .stat-icon { background: var(--danger-light);  color: var(--danger); }
.stat-card.warning .stat-icon { background: var(--warning-light); color: var(--warning); }

.stat-card.gradient-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
}
.stat-card.gradient-primary .stat-icon { background: rgba(255,255,255,.2); color: #fff; }
.stat-card.gradient-primary .stat-value,
.stat-card.gradient-primary .stat-label { color: #fff; }

.stat-card.gradient-success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    border: none;
}
.stat-card.gradient-success .stat-icon { background: rgba(255,255,255,.2); color: #fff; }
.stat-card.gradient-success .stat-value,
.stat-card.gradient-success .stat-label { color: #fff; }

.stat-card.gradient-danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: #fff;
    border: none;
}
.stat-card.gradient-danger .stat-icon { background: rgba(255,255,255,.2); color: #fff; }
.stat-card.gradient-danger .stat-value,
.stat-card.gradient-danger .stat-label { color: #fff; }

/* =========================================================
   BOUTON PRÉSENCE (CERCLE GÉANT)
   ========================================================= */
.presence-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    position: relative;
}

.presence-ring {
    position: relative;
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.presence-ring::before {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px dashed rgba(99,102,241,.25);
    animation: spin 30s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.presence-btn {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    border: none;
    color: #fff;
    font-weight: 700;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: transform .15s, box-shadow .3s;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overflow: hidden;
}

.presence-btn::after {
    content: '';
    position: absolute;
    inset: 8px;
    border-radius: 50%;
    border: 2px solid rgba(255,255,255,.3);
    pointer-events: none;
}

.presence-btn:active:not(:disabled),
.presence-btn.pressing {
    transform: scale(.95);
}

.presence-btn:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.presence-btn.btn-arrival {
    background: radial-gradient(circle at 30% 30%, #34d399, var(--success-dark));
    box-shadow: var(--shadow-success), inset 0 -8px 20px rgba(0,0,0,.15);
}

.presence-btn.btn-departure {
    background: radial-gradient(circle at 30% 30%, #f87171, var(--danger-dark));
    box-shadow: var(--shadow-danger), inset 0 -8px 20px rgba(0,0,0,.15);
}

.presence-btn.btn-blocked {
    background: radial-gradient(circle at 30% 30%, #9ca3af, #4b5563);
    box-shadow: 0 10px 30px rgba(75,85,99,.3), inset 0 -8px 20px rgba(0,0,0,.15);
}

.presence-btn .p-icon {
    font-size: 56px;
    line-height: 1;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,.15));
}

.presence-btn .p-label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    opacity: .95;
}

.presence-btn .p-hint {
    font-size: 11px;
    opacity: .8;
    margin-top: 4px;
}

.presence-btn:not(:disabled):hover {
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.5), inset 0 -8px 20px rgba(0,0,0,.15); }
    70%  { box-shadow: 0 0 0 24px rgba(16,185,129,0), inset 0 -8px 20px rgba(0,0,0,.15); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0), inset 0 -8px 20px rgba(0,0,0,.15); }
}
.presence-btn.btn-departure:not(:disabled):hover {
    animation: pulse-ring-red 2s infinite;
}
@keyframes pulse-ring-red {
    0%   { box-shadow: 0 0 0 0 rgba(239,68,68,.5), inset 0 -8px 20px rgba(0,0,0,.15); }
    70%  { box-shadow: 0 0 0 24px rgba(239,68,68,0), inset 0 -8px 20px rgba(0,0,0,.15); }
    100% { box-shadow: 0 0 0 0 rgba(239,68,68,0), inset 0 -8px 20px rgba(0,0,0,.15); }
}

/* Progress ring SVG */
.progress-ring {
    position: absolute;
    inset: 0;
    transform: rotate(-90deg);
    pointer-events: none;
}
.progress-ring circle {
    fill: none;
    stroke-linecap: round;
    transition: stroke-dashoffset .1s linear;
}

/* Timer sous le bouton */
.presence-timer {
    margin-top: 18px;
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    font-variant-numeric: tabular-nums;
    letter-spacing: -.5px;
}

.presence-timer.idle {
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0;
}

/* =========================================================
   BADGES
   ========================================================= */
.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .2px;
}

.badge-soft.success { background: var(--success-light); color: var(--success-dark); }
.badge-soft.danger  { background: var(--danger-light);  color: var(--danger-dark); }
.badge-soft.warning { background: var(--warning-light); color: #b45309; }
.badge-soft.primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-soft.gray    { background: var(--surface-2); color: var(--text-muted); }

/* =========================================================
   BOUTONS
   ========================================================= */
.btn-modern {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 13px 20px;
    border-radius: 14px;
    border: none;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: .2px;
    cursor: pointer;
    transition: var(--t);
    text-decoration: none;
    width: 100%;
}

.btn-modern:active { transform: scale(.97); }

.btn-modern.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: var(--shadow-primary);
}
.btn-modern.success {
    background: linear-gradient(135deg, var(--success), var(--success-dark));
    color: #fff;
    box-shadow: var(--shadow-success);
}
.btn-modern.danger {
    background: linear-gradient(135deg, var(--danger), var(--danger-dark));
    color: #fff;
    box-shadow: var(--shadow-danger);
}
.btn-modern.outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-modern.ghost {
    background: var(--surface-2);
    color: var(--text);
}
.btn-modern.sm { padding: 9px 14px; font-size: 13px; border-radius: 12px; }

/* =========================================================
   FORMULAIRES
   ========================================================= */
.form-group { margin-bottom: 14px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.form-control-modern {
    width: 100%;
    padding: 13px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    font-size: 14px;
    color: var(--text);
    transition: var(--t);
    outline: none;
    font-family: inherit;
}

.form-control-modern:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,.12);
}

.form-control-modern::placeholder { color: var(--text-light); }

.form-control-modern:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    cursor: not-allowed;
}

.input-icon {
    position: relative;
}
.input-icon i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 16px;
    pointer-events: none;
}
.input-icon .form-control-modern {
    padding-left: 42px;
}

/* =========================================================
   ALERTES
   ========================================================= */
.alert-modern {
    padding: 13px 15px;
    border-radius: 12px;
    font-size: 13px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: none;
    margin-bottom: 14px;
    line-height: 1.4;
}

.alert-modern i { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.alert-modern.success { background: var(--success-light); color: var(--success-dark); }
.alert-modern.danger  { background: var(--danger-light);  color: var(--danger-dark); }
.alert-modern.warning { background: var(--warning-light); color: #b45309; }
.alert-modern.info    { background: var(--primary-light); color: var(--primary-dark); }

/* =========================================================
   TABLE / LISTES
   ========================================================= */
.list-modern {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px;
    background: var(--surface);
    border-radius: 14px;
    border: 1px solid var(--border);
    transition: var(--t);
}
.list-item:hover { border-color: var(--primary-light); }

.list-item-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.list-item-icon.primary { background: var(--primary-light); color: var(--primary); }
.list-item-icon.success { background: var(--success-light); color: var(--success); }
.list-item-icon.danger  { background: var(--danger-light);  color: var(--danger); }
.list-item-icon.warning { background: var(--warning-light); color: var(--warning); }

.list-item-body { flex: 1; min-width: 0; }
.list-item-body h6 {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.list-item-body p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0;
}

/* =========================================================
   BOTTOM NAVIGATION
   ========================================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    z-index: 40;
    box-shadow: 0 -4px 20px rgba(0,0,0,.04);
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-light);
    font-size: 10px;
    font-weight: 600;
    transition: var(--t);
    letter-spacing: .2px;
}

.bottom-nav-item i {
    font-size: 20px;
    transition: var(--t);
}

.bottom-nav-item.active {
    color: var(--primary);
    background: var(--primary-light);
}

.bottom-nav-item.active i { transform: scale(1.1); }

.bottom-nav-item:hover { color: var(--primary); }

/* =========================================================
   MODALS
   ========================================================= */
.modal-content-modern {
    border: none;
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.modal-content-modern .modal-header {
    border: none;
    padding: 20px 20px 0;
}
.modal-content-modern .modal-body { padding: 20px; }
.modal-content-modern .modal-footer {
    border: none;
    padding: 0 20px 20px;
    gap: 8px;
}

/* =========================================================
   LOGIN / AUTH PAGES
   ========================================================= */
.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(160deg, var(--primary) 0%, var(--primary-dark) 100%);
    position: relative;
    overflow: hidden;
}

.auth-page::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: rgba(255,255,255,.08);
    border-radius: 50%;
}

.auth-page::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 250px;
    height: 250px;
    background: rgba(255,255,255,.06);
    border-radius: 50%;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    box-shadow: 0 25px 60px rgba(0,0,0,.25);
    position: relative;
    z-index: 1;
}

.auth-logo {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 32px;
    box-shadow: var(--shadow-primary);
}

.auth-card h2 {
    text-align: center;
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    color: var(--text);
    letter-spacing: -.4px;
}

.auth-card .subtitle {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

/* =========================================================
   GPS INDICATOR
   ========================================================= */
.gps-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    background: var(--surface-2);
    color: var(--text-muted);
    margin: 0 auto;
}

.gps-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--warning);
    animation: blink 1.5s infinite;
}

.gps-dot.ok  { background: var(--success); animation: none; }
.gps-dot.ko  { background: var(--danger); animation: blink 1s infinite; }

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%      { opacity: .3; }
}

/* =========================================================
   PROGRESS
   ========================================================= */
.progress-modern {
    height: 8px;
    background: var(--surface-2);
    border-radius: 20px;
    overflow: hidden;
}

.progress-modern .bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    transition: width .5s;
}

.progress-modern .bar.success { background: linear-gradient(90deg, var(--success), var(--success-dark)); }
.progress-modern .bar.danger  { background: linear-gradient(90deg, var(--danger), var(--danger-dark)); }
.progress-modern .bar.warning { background: linear-gradient(90deg, var(--warning), #d97706); }

/* =========================================================
   AVATAR
   ========================================================= */
.avatar-lg {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--surface);
    box-shadow: var(--shadow);
}

.avatar-fallback {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    font-weight: 700;
    box-shadow: var(--shadow-primary);
}

/* =========================================================
   UTILITAIRES
   ========================================================= */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0 !important; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.d-flex { display: flex; }
.d-none { display: none; }
.align-items-center { align-items: center; }
.justify-content-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.w-100 { width: 100%; }
.small { font-size: 12px; }

/* Preloader moderne */
.preloader-modern {
    position: fixed;
    inset: 0;
    background: var(--primary);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .4s, visibility .4s;
}

.preloader-modern.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-dots {
    display: flex;
    gap: 8px;
}

.loader-dots span {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loader-dots span:nth-child(1) { animation-delay: -.32s; }
.loader-dots span:nth-child(2) { animation-delay: -.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40%           { transform: scale(1); }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 380px) {
    .presence-ring { width: 200px; height: 200px; }
    .presence-btn { width: 180px; height: 180px; }
    .presence-btn .p-icon { font-size: 42px; }
    .presence-btn .p-label { font-size: 11px; }
}

@media (min-width: 481px) {
    .app-container { max-width: 480px; }
}


/* =========================================================
   SWEETALERT2 — Customisation Pointeur
   ========================================================= */
.swal-pointeur-popup {
    border-radius: 20px !important;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif !important;
    padding: 24px !important;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .2) !important;
}

.swal-pointeur-popup .swal2-title {
    font-size: 20px !important;
    font-weight: 800 !important;
    letter-spacing: -.3px !important;
    color: var(--text) !important;
    margin-bottom: 8px !important;
}

.swal-pointeur-popup .swal2-html-container {
    font-size: 14px !important;
    color: var(--text-muted) !important;
    line-height: 1.6 !important;
    margin-top: 8px !important;
}

.swal-pointeur-popup .swal2-icon {
    border-width: 3px !important;
    margin: 0 auto 16px !important;
}

.swal-pointeur-popup .swal2-icon.swal2-success {
    border-color: #10b981 !important;
    color: #10b981 !important;
}

.swal-pointeur-popup .swal2-icon.swal2-error {
    border-color: #ef4444 !important;
    color: #ef4444 !important;
}

.swal-pointeur-popup .swal2-icon.swal2-warning {
    border-color: #f59e0b !important;
    color: #f59e0b !important;
}

.swal-pointeur-popup .swal2-confirm {
    border-radius: 12px !important;
    padding: 11px 24px !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    letter-spacing: .2px !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .15) !important;
    transition: all .15s !important;
}

.swal-pointeur-popup .swal2-confirm:active {
    transform: scale(.97) !important;
}

.swal-pointeur-popup .swal2-timer-progress-bar {
    background: linear-gradient(90deg, #6366f1, #4f46e5) !important;
    height: 3px !important;
}

/* Toast (en haut à droite) */
.swal2-toast {
    border-radius: 14px !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .15) !important;
    font-family: 'Inter', sans-serif !important;
    padding: 12px 16px !important;
}

.swal2-toast .swal2-title {
    font-size: 13px !important;
    font-weight: 700 !important;
}

/* =========================================================
   Mode sombre — SweetAlert2
   ========================================================= */
[data-theme="dark"] .swal-pointeur-popup {
    background: var(--surface) !important;
    color: var(--text) !important;
}

[data-theme="dark"] .swal-pointeur-popup .swal2-title {
    color: var(--text) !important;
}

[data-theme="dark"] .swal-pointeur-popup .swal2-html-container {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .swal2-toast {
    background: var(--surface) !important;
    color: var(--text) !important;
    border: 1px solid var(--border) !important;
}

[data-theme="dark"] .swal2-toast .swal2-title {
    color: var(--text) !important;
}

[data-theme="dark"] .swal2-container.swal2-backdrop-show {
    background: rgba(0, 0, 0, .7) !important;
}

/* Icônes SweetAlert en dark */
[data-theme="dark"] .swal-pointeur-popup .swal2-icon.swal2-success .swal2-success-ring {
    border-color: rgba(16, 185, 129, .3) !important;
}
[data-theme="dark"] .swal-pointeur-popup .swal2-icon.swal2-success [class^='swal2-success-line'] {
    background-color: #10b981 !important;
}

/* Responsive */
@media (max-width: 480px) {
    .swal-pointeur-popup {
        width: calc(100% - 32px) !important;
        margin: 16px !important;
        padding: 20px !important;
    }
    .swal-pointeur-popup .swal2-title {
        font-size: 18px !important;
    }
    .swal-pointeur-popup .swal2-html-container {
        font-size: 13px !important;
    }
}