/* =========================
   RESET + VARIABLES
========================= */
* {
    box-sizing: border-box;
}

:root {
    --bg: #f4f4f4;
    --card: #ffffff;
    --text: #111;
    --accent: #007bff;
    --danger: #dc3545;
}

body.dark {
    --bg: #0f1115;
    --card: #1c1f26;
    --text: #e6e6e6;
    --accent: #4da3ff;
    --danger: #ff5f5f;
}

/* =========================
   BODY
========================= */
body {
    margin: 0;
    height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, sans-serif;

    display: flex;
    justify-content: center;
    align-items: center;
}

/* Bloque TOUT si non connecté */
body.locked {
    overflow: hidden;
}

body.locked .app,
body.locked .logout-form,
body.locked #theme-toggle {
    display: none !important;
}

/* =========================
   OVERLAY
========================= */
#overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    display: none;
}

#overlay.show {
    display: block;
}

/* =========================
   LOGIN POPUP
========================= */
/* =========================
   LOGIN POPUP (CENTRÉE + DESIGN PRO)
========================= */
#login-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);

    width: 90%;
    max-width: 340px;

    background: var(--card);
    color: var(--text);
    padding: 30px 25px;
    border-radius: 16px;

    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    z-index: 1001;

    text-align: center;

    opacity: 0;
    pointer-events: none;

    transition:
        opacity 0.3s ease,
        transform 0.3s ease;
}

#login-box.show {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}


/* Titre */
#login-box h2 {
    margin-bottom: 20px;
    font-size: 22px;
    font-weight: 600;
}

/* Input */
#login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    font-size: 16px;

    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.15);

    background: transparent;
    color: var(--text);
}

/* Bouton */
#login-box button {
    width: 100%;
    padding: 12px;

    font-size: 16px;
    font-weight: bold;

    border-radius: 10px;
    border: none;

    background: var(--accent);
    color: white;

    cursor: pointer;
    transition: transform 0.1s ease, opacity 0.2s;
}

#login-box button:active {
    transform: scale(0.97);
}

.error {
    color: #ff6b6b;
    font-size: 14px;
}


/* =========================
   APP
========================= */
.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

img {
    max-width: 260px;
}

.button-container {
    display: flex;
    gap: 15px;
}

button.action {
    padding: 12px 20px;
    font-size: 16px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* =========================
   STATUS
========================= */
#status {
    font-weight: bold;
}

.status-allume {
    color: green;
}

.status-eteint {
    color: red;
}

/* =========================
   LOGOUT
========================= */
.logout-form {
    position: fixed;
    top: 15px;
    right: 20px;
}

.logout-btn {
    background: var(--danger);
    color: white;
    border: none;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
}

/* =========================
   THEME BUTTON
========================= */
#theme-toggle {
    position: fixed;
    top: 15px;
    left: 15px;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}
