/* ============================================================
   GLOBAL VARIABLES & BASE STYLES
   ============================================================ */

:root {
    --primary: #0078d7;
    --primary-dark: #005a9e;
    --danger: #c9302c;

    --bg-light: #f4f4f4;
    --text-dark: #222;
    --text-light: #fff;
    --radius: 10px;

    --max-width: 600px;
    --shadow: 0 2px 6px rgba(0,0,0,0.12);
    --shadow-strong: 0 8px 20px rgba(0,0,0,0.25);
}

body {
    font-family: "Open Sans", sans-serif;
    margin: 0;
    background: var(--bg-light);
    color: var(--text-dark);
    overflow-x: hidden;
}


/* ============================================================
   HEADER (fixed)
   ============================================================ */

#header {
    background: var(--primary);
    color: var(--text-light);
    height: 70px;
    padding: 0 1rem;

    display: flex;
    justify-content: space-between;
    align-items: center;

    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 10000;

    box-shadow: var(--shadow);
}

#header button {
    margin-right: 20px;
}


/* ============================================================
   NAVIGATION (fixed)
   ============================================================ */

#nav {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 10px 15px;
    background: #e9e9e9;
    border-bottom: 1px solid #ccc;

    position: fixed;
    top: 70px;
    left: 0;
    width: 100%;
    height: 45px;
    z-index: 9999;
}

#nav button {
    padding: 8px 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}


/* ============================================================
   LOGIN POPUP
   ============================================================ */

#login {
    padding: 2px 26px 16px 26px;
    width: 420px;
    max-width: 90%;
    margin: 70px auto 0 auto;

    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);

    display: flex;
    flex-direction: column;
    gap: 8px;
    box-sizing: border-box;
}

#login input[type="text"],
#login input[type="password"] {
    width: 100%;
    padding: 12px 14px;

    background: white;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    font-size: 16px;
    box-sizing: border-box;

    margin-bottom: 10px;
}

#login h2 {
    font-size: 18px;
    margin: 1;
    padding: 1;
}

#login button {
    padding: 0.8rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 16px;
}


/* ============================================================
   MAIN CONTENT
   ============================================================ */

#todos,
#users {
    margin-top: 130px;
    padding: 15px 0;
    height: calc(100vh - 160px);
    overflow-y: auto;
}


/* ============================================================
   USER AREA
   ============================================================ */

.user-area {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}


/* ============================================================
   TODO AREA
   ============================================================ */

.todo-area {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
    padding: 0 15px;
    box-sizing: border-box;
}


/* ============================================================
   USER LIST
   ============================================================ */

#user-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

#user-list li {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;

    background: white;
    padding: 0.8rem 1rem;
    margin-bottom: 0.6rem;

    border-radius: var(--radius);
    box-shadow: var(--shadow);
    font-size: 16px;
}

#user-list li button + button {
    margin-left: 8px;
}

#user-list li span {
    flex: 1;
    padding-right: 10px;
}


/* ============================================================
   TODO LIST
   ============================================================ */

#todo-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

#todo-list li {
    display: flex;
    align-items: center;
    gap: 12px;

    background: white;
    padding: 0.8rem;
    margin-bottom: 0.6rem;

    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

#todo-list li > button.delete-btn { order: 1; }
#todo-list li > span { order: 2; }
#todo-list li > input[type="checkbox"] {
    order: 3;
    margin-left: auto;
}


/* ============================================================
   DELETE BUTTON
   ============================================================ */

button:not(.delete-btn) {
    padding: 0.5rem 1rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
}

.delete-btn {
    background: var(--primary);
    color: white;
    border: none;

    border-radius: 50%;
    width: 32px;
    height: 32px;

    font-size: 18px;
    font-weight: bold;

    display: flex;
    align-items: center;
    justify-content: center;

    cursor: pointer;
    transition: 0.2s ease;
}

.delete-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.12);
}

.delete-btn:active {
    transform: scale(0.95);
}


/* ============================================================
   NEW TODO INPUT + BUTTON
   ============================================================ */

.todo-input-row {
    display: flex;
    gap: 10px;
    width: 100%;
    margin-top: 20px;
}

#new-todo {
    flex: 1;
    padding: 0.8rem 14px;
    font-size: 16px;

    background: white;
    border: 2px solid var(--primary);
    border-radius: var(--radius);
}

#add-todo-btn {
    padding: 0.8rem 16px;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .todo-input-row {
        flex-direction: column;
    }

    #add-todo-btn {
        width: 100%;
    }
}


/* ============================================================
   CHECKBOX (FIXED ✔)
   ============================================================ */

input[type="checkbox"] {
    appearance: none;
    width: 26px;
    height: 26px;

    border: 3px solid var(--primary);
    border-radius: 6px;
    cursor: pointer;
    background: white;

    position: relative; /* FIX: Haken sichtbar */
    transition: all 0.2s ease;
}

input[type="checkbox"]:checked {
    background: var(--primary);
    border-color: var(--primary);
}

input[type="checkbox"]:checked::after {
    content: "✔";
    color: white;
    font-size: 20px;
    font-weight: bold;

    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -58%);
}


/* ============================================================
   POPUP OVERLAY
   ============================================================ */

.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: rgba(0,0,0,0.45);

    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.popup-content {
    background: white;
    padding: 2px 30px 30px 30px;
    width: 420px;
    max-width: 90%;

    border-radius: var(--radius);
    box-shadow: var(--shadow-strong);

    display: flex;
    flex-direction: column;
    gap: 15px;

    animation: popupFade 0.25s ease-out;
    box-sizing: border-box;
}

.popup-content input {
    width: 100%;
    padding: 12px 14px;

    background: white;
    border: 1px solid #ccc;
    border-radius: var(--radius);
    font-size: 16px;
    box-sizing: border-box;

    margin-bottom: 10px;
}

.popup-buttons {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 5px;
    padding-top: 5px;
}

@keyframes popupFade {
    from { transform: scale(0.8); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}


/* ============================================================
   LOADING OVERLAY
   ============================================================ */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    background: rgba(0,0,0,0.45);

    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid #fff;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}




