: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 {
    touch-action: manipulation;
    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%);
    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;
}

.theme-toggle{
  display: inline-grid !important;
  place-items: center !important;
  width: 40px !important; height: 40px !important;
  border-radius: 12px !important;
  border: 1px solid var(--stroke) !important;
  background: var(--stroke) !important;
  cursor: pointer !important;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease !important;
}
.theme-toggle:hover{ transform: translateY(-2px) !important; box-shadow: 0 10px 20px rgba(108,158,255,.25) !important; }

#loader-overlay {
  background: rgba(10,12,24,0.65);
  backdrop-filter: blur(6px);
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  text-align: center;
}

.loader-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.loader-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.loader-gif {
  width: 36px;
  height: 36px;
}

.loader-message {
  font-size: 18px;
  color: var(--text);
  font-weight: 500;
  font-family: sans-serif;
  margin: 0;
}


/* ========= FORMULAIRES ========= */
form {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select {
    background: var(--card);
    color: var(--text);
    width: 90%;
    padding: 12px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
}

/* ========= BOUTONS ========= */
button:not(.close-btn) {
    background: #28a745;
    color: white;
    padding: 12px;
    border: none;
    width: 90%;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

button:not(.close-btn):hover {
    background: #218838;
}

/* ========= HEADER (NAVBAR) ========= */
header {
    background-color: #0095ff96;
    padding: 10px 0;
    border-bottom: 4px solid blue;
}

.navbar {
    max-width: 1200px;
    margin: auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo a {
    font-size: 22px;
    font-weight: bold;
    color: white;
    text-decoration: none;
}

.logo img {
    height: 50px;
    width: auto;
    display: block;
}

/* ========= NAVIGATION ========= */
nav {
    padding: 10px;
    border-radius: 8px;
    display: flex;
    justify-content: center;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.nav-links li {
    margin: 0 15px;
}

.nav-links a {
    text-decoration: none;
    color: black;
    font-weight: bold;
    transition: 0.3s;
}

.nav-links a:hover {
    color: white;
}

/* ========= PROFIL DROPDOWN ========= */
.profile-menu {
    position: relative;
}

.profile-pic {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid black;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    display: block;
}

.dropbtn:hover {
    background-color: rgba(85, 85, 85, 0.24);
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #fff;
    min-width: 220px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 1000;
}

.dropdown-content li {
    list-style: none;
}

.dropdown-content li a {
    color: #333;
    padding: 12px 20px;
    text-decoration: none;
    display: block;
    font-size: 16px;
    transition: background 0.3s, color 0.3s;
}

.dropdown-content li a:hover {
    background-color: #3498db;
    color: white;
}

.dropdown:hover .dropdown-content {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

/* ========= DROPDOWN ALT ========= */
.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 50px;
    width: 180px;
    background: white;
    border-radius: 5px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 999;
}

.dropdown-menu a {
    display: block;
    padding: 10px;
    color: black;
    text-decoration: none;
    transition: background 0.3s;
    border-bottom: 1px solid #ddd;
}

.dropdown-menu a:hover {
    background-color: #f1f1f1;
}

.dropdown-menu .logout {
    background: red;
    color: white;
    text-align: center;
    font-weight: bold;
}

.dropdown-menu .logout:hover {
    background: darkred;
}

/* ========= FOOTER ========= */
footer {
    background-color: #0095ff;
    text-align: center;
    padding: 15px;
    width: 100%;
    color: white;
    font-weight: bold;
    border-top: 4px solid blue;
}

/* ========= NOTIFICATIONS ========= */
#notification-container {
  background: linear-gradient(135deg, rgba(108,158,255,.15), rgba(60,231,255,.12));
  border: 1px solid rgba(108,158,255,.35);
  border-radius: 12px;
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.notification {
    position: relative;
  padding: 10px 14px;
    border-radius: 8px;
  color: var(--text);
    font-size: 14px;
    font-weight: bold;
  box-shadow: var(--shadow-2);
    opacity: 1;
    transform: translateX(0);
    transition: opacity 0.5s, transform 0.5s;
    overflow: hidden;
}

.notification .close-btn {
    position: absolute;
    top: 8px;
    right: 10px;
    background: none !important;
    border: none !important;
    color: white !important;
    font-size: 18px !important;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.3);
    animation: progressBar linear forwards;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

.hidden {
    opacity: 0;
    transform: translateX(100%);
}

/* ========= NOTIF COULEURS ========= */
.info { background-color: #3498db; }
.success { background-color: #2ecc71; }
.warning { background-color: #f39c12; }
.error { background-color: #e74c3c; }

/* 🍔 Icône burger */
.burger-toggle {
    display: none;
    font-size: 26px;
    cursor: pointer;
    color: white;
    user-select: none;
}

.server-time {
    color: white;
    font-size: 0.95em;
    margin-right: 15px;
    display: flex;
    align-items: center;
    white-space: nowrap;
    justify-content: flex-end;
    flex-direction: row;
}

/* Pour mobile, on peut réduire un peu */
@media screen and (max-width: 768px) {
    .server-time {
        font-size: 0.8em;
        margin-right: 5px;
    }
}


/* ========= ANIMATIONS ========= */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========= RESPONSIVE ========= */
@media screen and (max-width: 768px) {
    .burger-toggle {
        display: block;
        position: absolute;
        right: 20px;
        top: 16px;
        z-index: 1001;
    }
    
    .navbar {
        flex-direction: column;
        align-items: center;
        padding: 10px 15px;
        gap: 10px;
    }

    .logo img {
        height: 40px;
    }

    .nav-links {
        display: none;
        flex-direction: column;
        gap: 10px;
        background-color: #0095ff;
        width: 100%;
        padding: 10px 0;
        border-top: 1px solid white;
        margin-top: 10px;
        animation: slideDown 0.3s ease;
    }

    .nav-links.show {
        display: flex;
    }

    .nav-links li {
        margin: 0;
        width: 100%;
        text-align: center;
    }

    .nav-links a {
        display: block;
        width: 100%;
        padding: 10px;
        border-radius: 8px;
        transition: background 0.2s;
    }

    .nav-links a:hover {
        background-color: rgba(255, 255, 255, 0.15);
    }

    .profile-menu {
        margin-top: 10px;
    }

    .add-category-btn {
        width: 100%;
        margin-top: 15px;
    }
}


/* Animation simple */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}