/* Plus-Symbol im Kamera-SVG per CSS einfärben */
.dashboard-icon-camera .plus-cutout {
    fill: var(--bg-tile, white);
}
.dashboard-icon-camera svg {
    width: 140px;
    height: 140px;
    display: block;
    object-fit: contain;
    background-color: transparent;
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 0;
}
/* =====================================================
   CSS RESET / BASIS
===================================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* =====================================================
   THEME VARIABLEN – LIGHT MODE (DEFAULT)
===================================================== */
:root {
    /* Page */
    --bg-page: #eaf2f8;

    /* Modal */
    --bg-modal: #ffffff;

    /* Tiles */
    --bg-tile: #5b8db8;
    --tile-radius: 16px;

    /* Text */
    --text-main: #2c3e50;
    --text-inverse: #ffffff;

    /* Icon */
    --icon-bg: rgba(255, 255, 255, 0.2);

    /* Effects */
    --shadow-tile: 0 6px 16px rgba(0, 0, 0, 0.18);
    --shadow-tile-hover: 0 10px 24px rgba(0, 0, 0, 0.25);
}

/* =====================================================
   DARK MODE (per Klasse vorbereit)
===================================================== */
body.dark {
    /* Page background: dark grey */
    --bg-page: #1b1b1b;

    /* Tiles / neutrale Buttons: black (blaue/rote Buttons bleiben per eigener Klasse) */
    --bg-tile: #000000;

    /* Modal */
    --bg-modal: #232323;

    --text-main: #e5e7eb;
    --text-inverse: #ffffff;

    --icon-bg: #000000;

    --shadow-tile: 0 8px 22px rgba(0, 0, 0, 0.6);
    --shadow-tile-hover: 0 14px 30px rgba(0, 0, 0, 0.75);
}

/* =====================================================
   BODY / LAYOUT
===================================================== */
body {
    background-color: var(--bg-page);
    color: var(--text-main);
}

main {
    padding: 20px;
}

/* =====================================================
   DASHBOARD LAYOUT
===================================================== */
.dashboard-container {
    width: 100%;
}


.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 150px);
    gap: 20px;
    justify-content: flex-start;
}

/* =====================================================
   DASHBOARD TILE
===================================================== */
.dashboard-tile {
    width: 150px;
    height: 200px;
    background-color: var(--bg-tile);
    border-radius: var(--tile-radius);
    box-shadow: var(--shadow-tile);
    text-decoration: none;

    display: flex;
    flex-direction: column;
    align-items: center;

    /* Wichtig: Abstand oben / unten steuern */
    justify-content: flex-start; /* Inhalt oben ausrichten */
    padding: 8px 8px; /* oben etwas weniger Padding, damit Text höher rückt */
    transition: transform 0.2s ease, box-shadow 0.2s ease;

    gap: 4px; /* Abstand zwischen Bild und Text */
}

.dashboard-tile:hover {
    transform: scale(1.04);
    box-shadow: var(--shadow-tile-hover);
}

/* =====================================================
   TILE IMAGE
===================================================== */
.dashboard-tile img {
    width: 140px;
    height: 140px;
    object-fit: contain;

    background-color: transparent; 
    border-radius: 12px;
    padding: 8px;
    margin-bottom: 0;

    filter: brightness(0) invert(1);
}

/* =====================================================
   TILE TITLE
===================================================== */
.tile-title {
    text-align: center;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-inverse);
    line-height: 1.2;

    margin-top: 0; /* Abstand jetzt nur über gap gesteuert */
}

/* =====================================================
   MOBILE FEINTUNING
===================================================== */
@media (max-width: 480px) {
    main {
        padding: 16px;
    }

    .dashboard-grid {
        gap: 16px;
    }
}

/* =====================================================
   LOGIN PAGE
===================================================== */

.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-box {
    width: 100%;
    max-width: 360px;
    background-color: #f5e6d3; /* Sandfarbe */
    padding: 30px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    position: relative;
}

.login-app-icon {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    object-fit: contain;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
}

.login-box h1 {
    text-align: center;
    margin-bottom: 20px;
    color: var(--text-main);
}

.login-box label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
}

.login-box input[type="email"],
.login-box input[type="password"] {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 16px;
    border-radius: 10px;
    border: 1px solid #ccc;
    font-size: 1rem;
}

.login-box button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background-color: var(--bg-tile);
    color: var(--text-inverse);
    font-size: 1rem;
    font-weight: 700; /* Button fett */
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-box button:hover {
    transform: scale(1.03);
    box-shadow: var(--shadow-tile-hover);
}

.login-error {
    margin-bottom: 15px;
    color: #b00020;
    text-align: center;
    font-weight: 600;
}

/* =====================================================
   DASHBOARD TOPBAR
===================================================== */
.dashboard-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between; /* links Titel, rechts Button */
    margin-bottom: 20px;
}

/* Wrapper für rechte Buttons */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* =====================================================
   SVG ICONS – DASHBOARD
===================================================== */
.dashboard-tile img,
.icon-button img,
.logout-button img {
    color: #ffffff; /* SVG wird weiß */
}

.icon-button img,
.logout-button img {
    /* Wir machen beide Icons gleich groß */
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: brightness(0) invert(1);
}

/* Dark Mode – optional anders */
body.dark .dashboard-tile img,
body.dark .icon-button img,
body.dark .logout-button img {
    color: #ffffff;
}

/* =====================================================
   ICON BUTTONS (50x50)
===================================================== */
.icon-button {
    width: 50px;
    height: 50px;
    background-color: var(--bg-tile);
    border-radius: 12px;
    box-shadow: var(--shadow-tile);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: none;
}

.icon-button img {
    width: 28px;
    height: 28px;
}

/* =====================================================
   MENU DROPDOWN
===================================================== */
.menu-wrapper {
    position: relative;
}

/* =====================================================
   HOME BUTTON (Dashboard) – Dark Mode Override
   Gilt für Seiten, die #home-button mit .icon-button nutzen.
===================================================== */
body.dark #home-button.icon-button {
    background: #000;
}

body.dark #home-button.icon-button img {
    filter: brightness(0) invert(1);
}

.menu-dropdown {
    position: absolute;
    /* Wichtig: kein Abstand zum Button, sonst verschwindet das Menü beim Wegfahren */
    top: 52px;
    left: 0;
    background-color: var(--bg-tile);
    border-radius: 12px;
    box-shadow: var(--shadow-tile);
    min-width: 160px;
    display: none;
    flex-direction: column;
    overflow: hidden;
    z-index: 100;
}

/* Hover-Bridge: fängt die Maus im Zwischenraum ab (falls Browser rounding/Zoom Lücken erzeugt) */
.menu-dropdown::before {
    content: "";
    position: absolute;
    top: -14px;
    left: 0;
    right: 0;
    height: 14px;
}

.menu-dropdown a {
    padding: 12px 16px;
    color: var(--text-inverse);
    text-decoration: none;
    font-weight: 600;
}

.menu-dropdown a:hover {
    background-color: rgba(255, 255, 255, 0.15);
}

/* Menü anzeigen bei Hover */
/* Menü anzeigen bei Hover und/oder Klick (JS toggelt .open) */
.menu-wrapper:hover .menu-dropdown,
.menu-wrapper.open .menu-dropdown {
    display: flex;
}

/* =====================================================
   LOGOUT BUTTON (150x50)
===================================================== */
.logout-button {
    display: flex;
    align-items: center;
    gap: 8px;

    height: 50px;
    padding: 0 16px;

	background-color: var(--bg-tile);
    border-radius: 12px;
    box-shadow: var(--shadow-tile);
    color: var(--text-inverse);

    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
}

.logout-button svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

.logout-button:hover {
    background: #1d4ed8;
}

/* =====================================================
   RESPONSIVE: Handy Hochformat
   - Logout: nur Icon, gleiche Größe wie Settings-Button
   - In Querformat bleibt der Text sichtbar (Default Styles)
===================================================== */
@media (max-width: 600px) and (orientation: portrait) {
    .logout-button {
        width: 50px;
        height: 50px;
        padding: 0;
        justify-content: center;
        gap: 0;
    }

    .logout-button .logout-text {
        display: none;
    }

    .logout-button svg {
        width: 28px;
        height: 28px;
    }
}

/* =====================================================
   TOGGLE SWITCH
===================================================== */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc; /* hellgrau = Light Mode */
    transition: 0.4s;
    border-radius: 28px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

.switch .slider {
    background-color: #5b8db8; /* Blau im Light Mode */
}

body.dark .switch .slider {
    background-color: #d3d3d3; /* Hellgrau im Dark Mode */
}

/* Dark Mode aktiv */
input:checked + .slider {
    background-color: #1d1d1d; /* dunkler Schieber */
}

input:checked + .slider:before {
    transform: translateX(22px);
}

.darkmode-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Label */
.darkmode-label {
    font-weight: 600;
    color: var(--text-main);
}

/* Bearbeiten / Speichern Button */
.btn-edit {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.btn-edit:enabled {
    background-color: #5b8db8; /* Blau wie Hinzufügen */
    color: #fff;
}

.btn-edit:disabled {
    background-color: #ccc; /* Grau, wenn nicht aktiv */
    color: #666;
    cursor: not-allowed;
}

.modal {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: var(--bg-modal);
    padding: 20px;
    border-radius: 12px;
    width: 320px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.modal-content p {
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--text-main);
}

.modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.modal-buttons button {
    min-width: 150px;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 600;
}

@media (max-width: 480px) {
    .modal-buttons {
        flex-direction: column;
    }

    .modal-buttons button {
        width: 100%;
        min-width: 0;
    }
}

#save-exit { background-color: #5b8db8; color: #fff; }
#exit-no-save { background-color: #d9534f; color: #fff; }
#cancel-exit { background-color: #ccc; color: #666; }