/* ---------------------------------------------------- */
/* --- 1. Reset & Variablen --- */
/* ---------------------------------------------------- */
*, *::before, *::after {
    box-sizing: border-box;
}

:root {
    --primary: #191970;
    --accent: #2060cc;
    --bg-page: #f4f7f9;
    --bg-card: #ffffff;
    --border: #d1d5db;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --error: #dc2626;
    --radius: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

html {
    overflow-y: scroll;
}

body {
    background-color: var(--bg-page);
    font-family: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    font-size: 16px;
    color: var(--text-main);
    line-height: 1.6;
    margin: 0;
    padding: 0;
}

/* ---------------------------------------------------- */
/* --- 2. Layout & Container --- */
/* ---------------------------------------------------- */
#mittig {
    width: 100%;
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 25px;
    margin-bottom: 25px;
    background-color: var(--bg-card);
    box-shadow: var(--shadow);
}

.note-box {
    background-color: #f8fafc;
    border-left: 4px solid var(--accent);
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.note-box ul {
    margin: 0 0 1rem 0;
    padding-left: 1.4rem;
    list-style-position: outside;
}

.note-box li {
    margin-bottom: 0.4rem;
}

.note-box {
    text-align: left;
}

.note-box ul,
.note-box li {
    text-align: left;
}

.profil {
    display: flex;
    gap: 25px;
    align-items: flex-start;
}

/* ---------------------------------------------------- */
/* --- 3. Typografie --- */
/* ---------------------------------------------------- */
h1 { font-size: 1.6rem; color: var(--primary); margin: 0 0 1rem 0; }
h2 { font-size: 1.3rem; color: var(--text-muted); font-weight: 600; margin-top: 0; }
h3 { font-size: 1.1rem; color: var(--error); font-weight: bold; }

a { color: var(--accent); text-decoration: none; transition: 0.2s; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------- */
/* --- 4. Formulare & Inputs --- */
/* ---------------------------------------------------- */
form { width: 100%; }

.form-card-inner { border: none !important; background: transparent !important; padding: 0 !important; box-shadow: none !important; }

label { display: block; font-weight: 600; color: var(--primary); margin-bottom: 5px; }

input[type="email"], input[type="password"], input[type="text"], input[type="number"], textarea, select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 15px;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box; 
}

input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(32, 96, 204, 0.1); }

/* ---------------------------------------------------- */
/* --- 5. Buttons & Navigation --- */
/* ---------------------------------------------------- */
.button-group { display: flex; flex-wrap: wrap; gap: 10px; margin: 15px 0; }

input[type="submit"], button {
    background-color: #f1f5f9;
    color: var(--primary);
    border: 1px solid var(--border);
    padding: 10px 25px;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

input[type="submit"]:hover, button:hover {
    background-color: var(--primary);
    color: white;
    border-color: var(--primary);
}

.btn-active {
    background-color: var(--primary) !important;
    color: white !important;
    border-color: var(--primary) !important;
}

#logout { border-color: var(--error); color: var(--error); }
#logout:hover { background-color: var(--error); color: white; }

/* ---------------------------------------------------- */
/* --- 6. Tabellen & Fotos --- */
/* ---------------------------------------------------- */
.user-table { width: 100%; border-collapse: collapse; margin-top: 10px; }
.user-table th, .user-table td { padding: 12px; border-bottom: 1px solid var(--border); text-align: left; }

.edit-area { 
    background: #f8fafc; 
    border: 2px solid var(--primary); 
    border-radius: var(--radius); 
    padding: 20px; 
    margin-bottom: 30px; 
    box-shadow: var(--shadow); 
}

.mobile-user-card { display: none; }

.foto { flex-shrink: 0; }

/* Desktop-Größen (Vorher: Hochkant 150x200, Quer 220x150) */
.foto-hoch { width: 180px; height: 240px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }
.foto-quer { width: 260px; height: 180px; object-fit: cover; border-radius: var(--radius); box-shadow: var(--shadow); display: block; }

.profile-top {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 25px;
    align-items: start;
    text-align: left;
    margin-bottom: 15px;
}

.profile-top-no-photo {
    display: block;
}

.profile-main {
    text-align: left;
    min-width: 0;
}

.profile-contact {
    text-align: left;
    margin-top: 10px;
    font-size: 0.95rem;
    white-space: normal;
}

.profile-name {
    font-size: 1.2rem;
    color: var(--primary);
    font-weight: 600;
}

/* ---------------------------------------------------- */
/* --- 7. Media Queries & Hilfsklassen --- */
/* ---------------------------------------------------- */
.flex-container { display: flex; gap: 25px; align-items: flex-start; }
.clearfix { clear: both; }

@media (max-width: 800px) {

    #mittig {
        margin: 20px auto;
        padding: 0 15px;
    }

    .button-group button,
    input[type="submit"] {
        flex: 1 1 calc(50% - 10px);
    }

    /* Tablet-Ansicht: Bleibt wie Desktop im Grid (Bild links, Text rechts) */
    .profile-top-has-photo {
        display: grid;
        grid-template-columns: auto 1fr;
        gap: 25px;
        align-items: start;
        text-align: left;
    }

    .profile-main {
        width: auto;
        text-align: left;
    }

    .profile-contact {
        width: auto;
        text-align: left;
        margin-top: 10px;
    }

    .profil {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: 15px;
        text-align: left;
    }

    .flex-container {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Deine gewünschten großen Foto-Maße fürs Tablet */
    .foto-hoch {
        width: 170px;
        height: 226px;
    }

    .foto-quer {
        width: 240px;
        height: 164px;
    }
}

@media (max-width: 600px) {

    .profil {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Erst ab hier (Mobil) greift das zentrierte Stack-Layout */
    .profile-top-has-photo {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .profile-top-no-photo {
        display: block;
        text-align: left;
    }

    .profile-main {
        width: 100%;
        text-align: center;
    }

    .profile-contact {
        width: 100%;
        text-align: left;
        margin-top: 12px;
    }

    .foto {
        margin-right: 0;
        margin-bottom: 5px;
    }

    /* Unveränderte Smartphone-Größen */
    .foto-hoch {
        width: 110px;
        height: 146px;
    }

    .foto-quer {
        width: 150px;
        height: 100px;
    }
}
/* ---------------------------------------------------- */
/* --- 8. Header & Navigation (aus oben.php) --- */
/* ---------------------------------------------------- */
.header-container {
    display: flex; 
    align-items: center; 
    justify-content: center; 
    margin-bottom: 30px; 
    gap: 20px;
    padding-top: 20px;
}

.header-logo {
    height: 65px; 
    width: auto; 
    border-radius: 10px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.header-text h1 {
    margin: 0; 
    font-size: 1.8rem; 
    color: var(--primary); 
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.header-subtitle {
    font-size: 0.85rem; 
    color: var(--text-muted); 
    font-weight: 500;
}

.nav-bar-public {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

/* ---------------------------------------------------- */
/* --- 9. Galerie 30-jähriges Abitreffen --- */
/* ---------------------------------------------------- */
.gallery-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 15px;
    margin-bottom: 20px;
}

.gallery-upload-box {
    display: none;
    margin-top: 20px;
}

.gallery-upload-box:target {
    display: block;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 25px;
}

.gallery-item {
    display: block;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    cursor: pointer;
    padding: 0;
}

.gallery-item img {
    width: 100%;
    height: 180px;
    object-fit: cover;
    display: block;
}

.gallery-empty {
    margin-top: 20px;
}

.lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    inset: 0;
    background: rgba(15, 23, 42, 0.92);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox.active {
    display: flex;
}

.lightbox-image {
    max-width: 92vw;
    max-height: 82vh;
    border-radius: var(--radius);
    box-shadow: 0 20px 40px rgba(0,0,0,0.45);
    background: white;
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
    position: fixed;
    background: rgba(255,255,255,0.92);
    color: var(--primary);
    border: 1px solid rgba(255,255,255,0.7);
    border-radius: var(--radius);
    font-weight: 700;
    cursor: pointer;
    z-index: 10000;
}

.lightbox-close {
    top: 20px;
    right: 20px;
    padding: 10px 16px;
}

.lightbox-prev,
.lightbox-next {
    top: 50%;
    transform: translateY(-50%);
    padding: 14px 18px;
    font-size: 1.4rem;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

.lightbox-counter {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,0.92);
    color: var(--primary);
    border-radius: var(--radius);
    padding: 8px 14px;
    font-weight: 700;
    z-index: 10000;
}

@media (max-width: 700px) {
    .gallery-header {
        display: block;
    }

    .gallery-header .button-group {
        margin-top: 15px;
    }

    .gallery-header .button-group a {
        width: 100%;
        text-align: center;
    }

    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }

    .gallery-item img {
        height: 150px;
    }

    .lightbox-prev,
    .lightbox-next {
        padding: 10px 13px;
        font-size: 1.1rem;
    }

    .lightbox-prev {
        left: 8px;
    }

    .lightbox-next {
        right: 8px;
    }

    .lightbox-close {
        top: 10px;
        right: 10px;
    }
}

/* ---------------------------------------------------- */
/* --- 10. Abizeitung / Flipbook --- */
/* ---------------------------------------------------- */

.abizeitung-book-wrap {
    margin-top: 25px;
    width: 100%;
    overflow: auto;
    max-height: 80vh;
    text-align: center;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
}

#abizeitung-book {
    display: block;
    width: 100%;
    margin: 0 auto;
    transform-origin: top left;
    touch-action: pan-x pan-y;
}

.abizeitung-page {
    background: white;
    overflow: hidden;
}

.abizeitung-page img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
    background: white;
}

#abizeitung-status {
    margin-top: 15px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ---------- Vollbild ---------- */

.abizeitung-book-wrap:fullscreen,
.abizeitung-book-wrap:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    max-height: none;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    background: #222;
    padding: 10px;
    border: none;
    border-radius: 0;
}

.abizeitung-book-wrap:fullscreen #abizeitung-book,
.abizeitung-book-wrap:-webkit-full-screen #abizeitung-book {
    max-width: 95vw;
    max-height: 95vh;
    transform-origin: top left;
}

/* ---------- Mobil ---------- */

@media (max-width: 700px) {

    .abizeitung-book-wrap {
        margin-top: 15px;
        max-height: 75vh;
    }

    #abizeitung-book {
        display: block;
        width: 100%;
        margin: 0 auto;
        transform-origin: top left;
        touch-action: pan-x pan-y;
    }
}