:root {
  --bg: #0f1222;
  --bg-soft: #151a2f;
  --card: rgba(255,255,255,0.08);
  --stroke: rgba(255,255,255,0.15);
  --text: #e9ecff;
  --muted: #a6b0d4;
  --accent-1: #6c9eff;   /* bleu électrique */
  --accent-2: #9b6cff;   /* violet néon   */
  --accent-3: #3ce7ff;   /* cyan          */
  --success: #1dd1a1;
  --danger: #ff6b6b;
  --warning: #feca57;
  --shadow-1: 0 10px 25px rgba(0,0,0,0.35);
  --shadow-2: 0 6px 18px rgba(55, 97, 255, 0.18);
  --radius-xl: 18px;
  --halo1: rgba(108, 158, 255, 0.08);
  --halo2: rgba(155, 108, 255, 0.04);
  --halo-blur: 60px;
  --halo-mode: lighten;
  --grid-color: rgba(255, 255, 255, 0.015);
  --grid-opacity: 0.3;
}

/* Light mode via [data-theme="light"] */
:root[data-theme="light"]{
  --bg: #eef1f9;
  --bg-soft: #f5f7ff;
  --card: rgba(255,255,255,0.75);
  --stroke: rgba(0,0,0,0.06);
  --text: #121526;
  --muted: #4a5073;
  --shadow-1: 0 12px 24px rgba(20,25,40,0.12);
  --shadow-2: 0 8px 20px rgba(108,158,255,0.20);
  --halo1: rgba(255, 210, 140, 0.15);
  --halo2: rgba(255, 170, 90, 0.07);
  --halo-blur: 50px;
  --halo-mode: multiply;
  --grid-color: rgba(0, 0, 0, 0.02);
  --grid-opacity: 0.2;
}

/* ========= STYLES GÉNÉRAUX ========= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Arial, sans-serif;
}

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: radial-gradient(1200px 600px at 10% -10%, rgba(108, 158, 255, 0.20), transparent 60%), radial-gradient(1000px 600px at 110% 20%, rgba(155, 108, 255, 0.16), transparent 55%), linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    touch-action: manipulation;
    color: var(--text);
    line-height: 1.4;
}



/* halo discret */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(
    400px circle at var(--x) var(--y),
    var(--halo1),
    var(--halo2),
    transparent 70%
  );
  filter: blur(var(--halo-blur));
  transition: background-position 0.2s ease-out;
  pointer-events: none;
  z-index: 0;
  mix-blend-mode: var(--halo-mode);
}

/* texture légère pour casser l’uniformité */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(transparent 98%, var(--grid-color) 2%),
    linear-gradient(90deg, transparent 98%, var(--grid-color) 2%);
  background-size: 40px 40px;
  opacity: var(--grid-opacity);
  pointer-events: none;
  z-index: -1;
}




input[type="date"] {
    background: var(--card);
    margin-top: 12px;
    border: 1px solid var(--stroke);
    border-radius: 999px;
    padding: 6px 10px;
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
}

input[type="date"]:focus {
    border-color: var(--accent);
}

.range-controls input[type="date"] {
    min-width: 150px;
}



/* ===== BOUTON ENREGISTRER ===== */
button[type="submit"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 999px;
    border: none;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: .03em;
    text-transform: uppercase;
    cursor: pointer;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #f9fafb;
    box-shadow: 0 6px 14px rgba(37, 99, 235, 0.35);
    margin-top: 10px;
    transition: transform .1s ease, box-shadow .1s ease, filter .15s ease;
}

button[type="submit"]:hover {
    filter: brightness(1.05);
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.45);
    transform: translateY(-1px);
}

button[type="submit"]:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(37, 99, 235, 0.3);
}




/* Buttons */

.btn {
    border-radius: 999px;
    /* border: 1px solid transparent; */
    padding: 6px 12px;
    font-size: 0.85rem;
    /* cursor: pointer; */
    display: inline-flex;
    align-items: center;
    gap: 6px;
    /* transition: all 0.15s ease; */
    white-space: nowrap;
}

.btn.primary {
    /* width: 100%; */
    /* margin-bottom: 15px; */
    /* padding: 12px; */
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    margin-top: 12px;
    color: var(--text);
    border: none;
    /* border-radius: 6px; */
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn.primary:hover {
    filter: brightness(1.1);
}

.btn.ghost {
    background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
    margin-top: 12px;
    color: var(--text);
    border: none;
    /* border-radius: 6px; */
    font-weight: bold;
    cursor: pointer;
    transition: background 0.3s;
}

.btn.ghost:hover {
    background: rgba(148, 163, 184, 0.15);
}









/* Overlay plein écran */
#loader-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(10, 12, 24, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

/* Quand le body a la classe .loaded → on cache l’overlay */
body.loaded #loader-overlay {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Carte centrale */
.loader-card {
    background: var(--card, rgba(6,10,18,0.95));
    border-radius: 24px;
    border: 1px solid var(--stroke, rgba(148,163,184,0.35));
    padding: 2rem 2.5rem;
    box-shadow: 0 18px 45px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

/* Logo */
.loader-logo img {
    height: 48px;
    width: auto;
    display: block;
}

/* Spinner */
.loader-spinner {
    width: 46px;
    height: 46px;
    border-radius: 100%;
    border: 3px solid rgba(148, 163, 184, 0.25);
    border-top-color: var(--accent-primary, #6366f1);
    border-right-color: var(--accent-primary, #6366f1);
    animation: loader-spin 1.3s linear infinite;
    margin-top: 0.2rem;
}

@keyframes loader-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Texte */
.loader-text {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-muted, #cbd5f5);
}





/* Container des toasts */
.app-notifs {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none; /* clics passent à travers sauf sur les toasts */
}

/* Toast générique */
.app-toast {
    min-width: 240px;
    max-width: 360px;
    padding: 10px 12px;
    border-radius: 10px;
    background: #0f172a;
    color: #e5e7eb;
    box-shadow: 0 18px 45px rgba(15,23,42,0.65);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.9rem;
    line-height: 1.3;
    opacity: 0;
    transform: translateX(20px) translateY(10px);
    animation: toast-in 160ms ease-out forwards;
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

/* Ligne de couleur en bord */
.app-toast::before {
    content: "";
    position: absolute;
    inset: 0;
    width: 4px;
    background: #64748b;
}

/* Types */
.app-toast--success {
    background: #022c22;
}

.app-toast--success::before {
    background: #22c55e;
}

.app-toast--error {
    background: #450a0a;
}

.app-toast--error::before {
    background: #ef4444;
}

.app-toast--warning {
    background: #451a03;
}

.app-toast--warning::before {
    background: #f97316;
}

.app-toast--info {
    background: #111827;
}

.app-toast--info::before {
    background: #38bdf8;
}

/* Contenu */
.app-toast-icon {
    margin-left: 8px;
    font-size: 18px;
    line-height: 1;
}

.app-toast-content {
    flex: 1;
}

.app-toast-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.app-toast-message {
    font-size: 0.84rem;
}

/* Bouton close */
.app-toast-close {
    border: none;
    background: transparent;
    color: #9ca3af;
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    margin-left: 6px;
}

.app-toast-close:hover {
    color: #e5e7eb;
}

/* Barre de durée */
.app-toast-progress {
    position: absolute;
    left: 4px;
    right: 0;
    bottom: 0;
    height: 3px;
    background: rgba(148,163,184,0.35);
    overflow: hidden;
}

.app-toast-progress-bar {
    height: 100%;
    background: rgba(248,250,252,0.9);
    transform-origin: left;
}

.app-toast-count {
    margin-left: 6px;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 0.78rem;
    background: rgba(148,163,184,0.25);
    color: #e5e7eb;
    font-weight: 600;
}

/* Animations */
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateX(20px) translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateX(0) translateY(0);
    }
}

@keyframes toast-out {
    to {
        opacity: 0;
        transform: translateX(10px) translateY(0);
    }
}
