/* ========= Basis (shared) ========= */
:root {
    --login-top-height: 280px;
}

body {
    background-color: #121212;
    color: #e0e0e0;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

.page-title {
    margin: 0;
    font-size: clamp(1.7rem, 4vw, 2rem);
    font-weight: 700;
    line-height: 2;
}

/* ========= Container (shared) ========= */
.container {
    position: relative;
    background-color: #1e1e1e;
    padding: 20px 20px 30px 20px;
    /* Login-Padding bleibt Standard */
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
    width: 260px;
    /* Startbreite */
    max-width: 1200px;
    height: 450px;
    /* Grundhöhe */
    text-align: center;
    margin: 0 auto;
    z-index: 5;
    top: clamp(150px, 20dvh, 820px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 1;
    transition: width 1s ease-in-out;
    /* Breite darf animieren */
}

/* ========= Logo (shared) ========= */
.logo-wrap {
    position: absolute;
    /* Bezug: .container */
    top: -145px;
    /* Referenzhöhe – Login & Dashboard identisch */
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
    transform-origin: top left;
    backface-visibility: hidden;
    will-change: transform;
}

.logo-img {
    width: min(400px, 90vw);
    display: block;
    transform: translateZ(0);
    transform-origin: top left;
    backface-visibility: hidden;
}

/* Effekt beim Zielzustand (Dashboard setzt die Klasse) */
.logo-img.scale-down {
    transform: translateZ(0) scale(0.32);

}

/* Titel rechts neben Logo (shared Positionierung) */
#logoWrap>.page-title.beside-logo,
.logo-wrap>.page-title.beside-logo {
    position: absolute;
    top: 40px;
    left: clamp(80px, 12vw, 100px);
    transform: translateX(calc(200px - 140px + 16px));
    white-space: nowrap;
    max-width: min(62vw, 500px);
    overflow: hidden;
    text-overflow: ellipsis;
    z-index: 20;
    pointer-events: none;
}

/* ========= Content-Visibility (shared) ========= */
.content {
    opacity: 1;
    transition: opacity .25s ease;
}

/* ========= Login-spezifisch ========= */
body.login .container {
    display: block;
    height: auto;
    min-height: 440px;
    padding-top: 0;
}

body.login .login-top {
    height: var(--login-top-height);
}

body.login .login-bottom {
    display: block;
}

body.login .logo-wrap {
    position: absolute;
}

/* Optionaler Fade am Login (beibehalten) */
body.login.do-fade .logo-wrap,
body.login.do-fade .logo-img {
    animation: fadeIn .8s ease forwards;
    opacity: 0;
    will-change: opacity;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========= Formulare & Buttons (shared) ========= */
input[type=text],
input[type=password] {
    width: 90%;
    padding: 10px;
    margin: 10px auto;
    display: block;
    border: none;
    border-radius: 5px;
    box-sizing: border-box;
}

input[type=text]:focus,
input[type=password]:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(112, 230, 121, 0.85);
}

/* Login-/Action-Buttons – gemeinsamer Stil */
button {
    width: 90%;
    padding: 10px;
    margin-top: 20px;
    background-color: #61c255;
    color: #000;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

button:hover {
    background-color: #c2e110;
}

/* Links */
a,
a:visited {
    color: #0078ff;
    text-decoration: none;
    font-weight: bold;
}

a:hover {
    color: #00bfff;
}

form {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.error {
    color: #ff5555;
}

/* ========= Modal (shared) ========= */
.modal {
    border: none;
    padding: 0;
    background: transparent;
}

.modal::backdrop {
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(2px);
}

.modal-inner {
    box-sizing: border-box;
    background: #1e1e1e;
    color: #e0e0e0;
    max-width: 100%;
    margin: 0;
    padding: 18px 18px 20px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
    overflow: hidden;
}

.modal-inner h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    line-height: 1.3;
    color: #f0f0f0;
}

.modal-inner p {
    margin: 0 0 16px;
    opacity: .9;
}

.modal-actions {
    display: flex;
    gap: 20px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    /* vorher: wrap -> lässt Buttons zu früh umbrechen */
    margin-top: 8px;
}

.modal .btn {
    appearance: none;
    border: 0;
    width: 200px;
    border-radius: 10px;
    padding: 10px 14px;
    font-weight: 600;
    cursor: pointer;
    line-height: 1;
    white-space: nowrap;

}

.modal .btn.cancel {
    background: #2a2a2a;
    color: #ddd;
}

.modal .btn.cancel:hover {
    background: #343434;
}

.modal .btn.danger {
    background: #d9534f;
    color: #fff;
}

.modal .btn.danger:hover {
    background: #c64541;
}

html:has(dialog[open]) {
    overflow-y: hidden;
}

@media (max-width: 480px) {
    .modal-actions {
        flex-wrap: wrap;
    }
}

@media (max-width: 420px) {

    #logoWrap>.page-title.beside-logo,
    .logo-wrap>.page-title.beside-logo {

        left: clamp(52px, 12vw, 56px);
        top: 46px;
    }

    .page-title {
        font-size: clamp(1.3rem, 0.6vw, 1.3rem);
    }
}