/* =============================================================================
   style.css – Galaxy-Empire Framework
   HELLES, FREUNDLICHES THEME
   ============================================================================= */

:root {
    --bg:        #f7f5f0;
    --bg-box:    #ffffff;
    --bg-input:  #f0ede8;
    --bg-hover:  #eae7e0;
    --text:      #2c2a25;
    --text-dim:  #5a5550;
    --text-muted:#8a8580;
    --accent:    #c0392b;
    --accent-hover: #e74c3c;
    --accent2:   #d4a24e;
    --accent2-dim: #b8893a;
    --ok:        #4c9a6e;
    --warn:      #d4a24e;
    --error:     #c0392b;
    --info-bg:   #eef4eb;
    --radius:    8px;
    --border:    1px solid #d5cfc5;
    --border-dim:1px solid #e5dfd5;
    --shadow:    0 2px 12px rgba(44, 42, 37, 0.08);
    --touch-target: 44px;
    --font-display: Georgia, 'Times New Roman', serif;
    --font-body:    -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-mono:    'Courier New', monospace;
}

/* ─── GRID-LAYOUT ────────────────────────────────────────────── */
body {
    margin: 8px auto;
    padding: 0 12px;
    max-width: 72em;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.6;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-areas:
        "head"
        "nav_public"
        "nav_user"
        "main"
        "aside"
        "foot";
    gap: 16px;
    border: 1px solid #d5cfc5;
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: 0 4px 24px rgba(44, 42, 37, 0.06);
}

body.game-layout {
    grid-template-areas:
        "head"
        "nav_public"
        "nav_user"
        "nav_game"
        "main"
        "aside"
        "foot";
}

/* Tablet */
@media (min-width: 35em) {
    body {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas:
            "head        head"
            "nav_public  nav_public"
            "nav_user    nav_user"
            "main        main"
            "aside       aside"
            "foot        foot";
    }
    body.game-layout {
        grid-template-areas:
            "head        head"
            "nav_public  nav_public"
            "nav_user    nav_user"
            "nav_game    nav_game"
            "main        main"
            "aside       aside"
            "foot        foot";
    }
}

/* Desktop */
@media (min-width: 50em) {
    body {
        grid-template-columns: repeat(5, 1fr);
        grid-template-areas:
            "head        head        head        head        head"
            "nav_public  nav_public  nav_public  nav_user    nav_user"
            "main        main        main        main        aside"
            "foot        foot        foot        foot        foot";
    }
    body.game-layout {
        grid-template-areas:
            "head        head        head        head        head"
            "nav_public  nav_public  nav_public  nav_user    nav_user"
            "nav_game    main        main        main        aside"
            "foot        foot        foot        foot        foot";
    }
}

.grid-head       { grid-area: head; }
.grid-nav-public { grid-area: nav_public; }
.grid-nav-user   { grid-area: nav_user; }
.grid-nav-game   { grid-area: nav_game; }
.grid-main       { grid-area: main; min-width: 0; }
.grid-aside      { grid-area: aside; min-width: 0; }
.grid-foot       { grid-area: foot; }

/* ─── LINKS & TYPOGRAPHIE ────────────────────────────────────── */
a {
    color: var(--accent2);
    text-decoration: none;
    transition: color 0.2s ease;
}
a:hover, a:focus {
    color: var(--accent2-dim);
    text-decoration: underline;
}
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--accent2);
    outline-offset: 2px;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    color: var(--text);
    font-weight: 600;
    line-height: 1.25;
}
h2 { font-size: 1.6em; margin-top: 0; }
h3 { font-size: 1.25em; color: var(--accent); }

hr {
    border: none;
    border-top: var(--border-dim);
    margin: 24px 0;
}
small { color: var(--text-muted); }

/* ─── HEADER ──────────────────────────────────────────────────── */
#site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 8px;
    border-bottom: 2px solid var(--accent2);
}
#site-title a {
    font-family: var(--font-display);
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}
#site-title a:hover { 
    color: var(--accent); 
    text-decoration: none;
}
#site-slogan {
    display: block;
    font-size: 0.85em;
    color: var(--text-dim);
    font-style: italic;
    margin-top: 2px;
}

/* ─── HAMBURGER (CSS-ONLY) ───────────────────────────────────── */
.menu-toggle-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}
.hamburger {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: var(--touch-target);
    height: var(--touch-target);
    padding: 10px;
    cursor: pointer;
}
.hamburger span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
}

/* ─── NAVIGATION (Mobile zuerst) ─────────────────────────────── */
.grid-nav-public,
.grid-nav-user {
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 10px 0;
    border-bottom: var(--border);
}
#menu-toggle:checked ~ .grid-nav-public,
#menu-toggle:checked ~ .grid-nav-user {
    display: flex;
}

/* ═══ WICHTIG: Nur direkte ul-Kinder stylen, NICHT .dropdown-menu ═══ */
.grid-nav-public > ul,
.grid-nav-user > ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin: 0;
    padding: 0;
}

/* Tablet & Desktop: Navs immer sichtbar, horizontal */
@media (min-width: 35em) {
    .hamburger { display: none; }
    .grid-nav-public,
    .grid-nav-user {
        display: flex !important;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
    }
    .grid-nav-public > ul,
    .grid-nav-user > ul {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 4px;
    }
}

@media (min-width: 50em) {
    .grid-nav-public,
    .grid-nav-user {
        border-bottom: var(--border);
    }
}

/* Nav-Links */
.grid-nav-public a,
.grid-nav-user a,
.grid-nav-public strong,
.grid-nav-user strong {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-target);
    padding: 14px 14px;
    border-radius: var(--radius);
    color: var(--text-dim);
    font-size: 0.95em;
    text-decoration: none;
}
.grid-nav-public a:hover,
.grid-nav-user a:hover {
    background: var(--bg-hover);
    color: var(--text);
    text-decoration: none;
}
.grid-nav-user {
    justify-content: flex-end;
}

/* ─── DROPDOWN USER-MENÜ ────────────────────────────────────── */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    cursor: pointer;
    color: var(--accent2);
    font-weight: 600;
    padding: 8px 14px;
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-target);
    transition: color 0.2s ease;
}
.dropdown-toggle:hover {
    color: var(--accent);
}

/* ═══ DAS WAR DAS HAUPTPROBLEM ═══
   .dropdown-menu MUSS explizit display:none haben.
   Die alte Regel .grid-nav-user ul {display:flex} hat das überschrieben,
   weil sie spezifischer war (0,1,1 vs 0,1,0).
   Jetzt mit > ul trifft sie .dropdown-menu nicht mehr. */
.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2px 0;
    min-width: 220px;
    box-shadow: var(--shadow);
    z-index: 1000;
    list-style: none;
    margin: 0;
}

.dropdown-menu li {
    padding: 0;
    margin: 0;
    line-height: 1.2;         /* ← Kompakte Zeilenhöhe */
    border-bottom: none;
}
.dropdown-menu li:last-child {
    border-bottom: none;
}

.dropdown-menu a {
    display: block;
    min-height: auto;          /* ← überschreibt das 44px-Touch-Target von ".grid-nav-user a" (Nachfahren-Selektor traf hier auch mit) */
    padding: 4px 12px;        /* ← Vorher: 3px 5px – jetzt fast kein Abstand */
    color: var(--text);
    text-decoration: none;
    font-size: 0.85em;        /* ← Etwas kleinere Schrift */
    line-height: 1.25;        /* ← Nochmal etwas kompakter (vorher 1.4) */
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.dropdown-menu a:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

/* Desktop: Dropdown öffnet bei Hover / schließt sofort bei Mouse-Out */
.dropdown:hover .dropdown-menu,
.dropdown:focus-within .dropdown-menu {
    display: block;
}

/* ─── 🔥 BUGFIX: Tabellen auf Mobile unsichtbar/unerreichbar ──
   Ursache: table { width:100% } ohne jede Overflow-Behandlung. Bei
   mehrspaltigen Tabellen (z.B. Gebäude-Tabelle: Name/Stufe/Kosten/
   Bauzeit/Button) lief die Tabelle auf schmalen Screens einfach über
   den Rand hinaus - ohne Scroll-Möglichkeit landete die letzte Spalte
   (der Bau-Button!) komplett unsichtbar außerhalb des Viewports.
   Das war KEIN fehlender Button im HTML, sondern ein reines CSS-
   Overflow-Problem. Jetzt: Tabelle selbst wird zum horizontalen
   Scroll-Container statt sich unsichtbar zu überschreiben. */
@media (max-width: 34.99em) {
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        white-space: nowrap;
    }
}

/* ─── MOBILE DROPDOWN (inline, kein Overlay) ───────────────── */
@media (max-width: 34.99em) {
    .dropdown {
        display: block;
        width: 100%;
    }
    .dropdown-toggle {
        display: flex;
        width: 100%;
    }
    /* Auf Mobile: Dropdown-Menü inline sichtbar, wenn Hamburger aktiv */
    #menu-toggle:checked ~ .grid-nav-user .dropdown-menu {
        display: block;
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background: transparent;
        padding: 0 0 0 14px;
        min-width: auto;
    }
    #menu-toggle:checked ~ .grid-nav-user .dropdown-menu li {
        border-bottom: none;
    }
    #menu-toggle:checked ~ .grid-nav-user .dropdown-menu a {
        padding: 6px 12px;
    }
}

/* ─── CONTENT-BOXEN ──────────────────────────────────────────── */
#content {
    min-height: 60vh;
}
.content-box {
    background: var(--bg-box);
    border: var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: box-shadow 0.2s ease;
}
.content-box:hover {
    box-shadow: 0 4px 20px rgba(44, 42, 37, 0.10);
}

/* ─── FORMULARE ──────────────────────────────────────────────── */
form { margin: 0; }
fieldset {
    border: var(--border-dim);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
}
legend {
    color: var(--accent2);
    font-weight: 600;
    padding: 0 6px;
}
label {
    display: inline-block;
    margin-bottom: 4px;
    color: var(--text-dim);
    font-weight: 500;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="week"],
input[type="file"],
select,
textarea {
    background: var(--bg-input);
    color: var(--text);
    border: var(--border-dim);
    border-radius: var(--radius);
    padding: 8px 10px;
    min-height: var(--touch-target);
    font-family: inherit;
    font-size: 0.95em;
    width: 100%;
    max-width: 100%;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
@media (min-width: 50em) {
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="date"],
    input[type="week"],
    select {
        min-height: 0;
        width: auto;
    }
}
input:focus, select:focus, textarea:focus {
    border-color: var(--accent2);
    box-shadow: 0 0 0 3px rgba(212, 162, 78, 0.15);
}
textarea { resize: vertical; min-height: calc(var(--touch-target) * 2); }
input[type="checkbox"] {
    accent-color: var(--accent);
    width: 20px;
    height: 20px;
    vertical-align: middle;
}

/* ─── BUTTONS ────────────────────────────────────────────────── */
input[type="submit"],
button {
    background: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 8px 16px;
    min-height: var(--touch-target);
    font-size: 0.95em;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.1s ease;
}
@media (min-width: 50em) {
    input[type="submit"], button { min-height: 0; }
}
input[type="submit"]:hover,
button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    transform: translateY(-1px);
}
input[type="submit"]:active,
button:active {
    transform: translateY(0px);
}
.button, a.button {
    display: inline-flex;
    align-items: center;
    min-height: var(--touch-target);
    background: var(--accent);
    color: #ffffff;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 8px 16px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s ease, transform 0.1s ease;
}
@media (min-width: 50em) {
    .button, a.button { min-height: 0; }
}
.button:hover, a.button:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    text-decoration: none;
    transform: translateY(-1px);
}
.btn-small {
    padding: 3px 8px;
    font-size: 0.8em;
}
.btn-del-mini {
    background: transparent;
    border: none;
    color: var(--error);
    cursor: pointer;
    font-size: 0.85em;
    padding: 0 4px;
    transition: color 0.2s ease;
}
.btn-del-mini:hover { 
    color: var(--text); 
    background: transparent; 
    border: none; 
}

/* ─── MELDUNGEN ──────────────────────────────────────────────── */
p.info {
    background: var(--info-bg);
    border-left: 4px solid var(--ok);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
}
p.error {
    background: #fdf0ed;
    border-left: 4px solid var(--error);
    border-radius: var(--radius);
    padding: 10px 14px;
    color: var(--text);
}

/* ─── TABELLEN ───────────────────────────────────────────────── */
table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
}
th, td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: var(--border-dim);
}
th {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
tr:hover td { background: var(--bg-hover); }

/* ─── PAGINATION ─────────────────────────────────────────────── */
.pagination ul {
    list-style: none;
    display: flex;
    gap: 4px;
    padding: 0;
    margin: 16px 0 0;
    flex-wrap: wrap;
}
.pagination a,
.pagination .pagination-current,
.pagination .pagination-gap {
    display: inline-block;
    min-width: 32px;
    text-align: center;
    padding: 6px 8px;
    border-radius: var(--radius);
    border: var(--border-dim);
    color: var(--text-dim);
    transition: all 0.2s ease;
}
.pagination a:hover {
    border-color: var(--accent2);
    color: var(--text);
    text-decoration: none;
    background: var(--bg-hover);
}
.pagination .pagination-current {
    background: var(--accent2);
    color: #ffffff;
    border-color: var(--accent2);
}
.pagination .pagination-gap { border: none; }

/* ─── BLOG ───────────────────────────────────────────────────── */
.blog-vorschau, .rezept-karte, .flo-vorschau {
    border-bottom: var(--border-dim);
    padding: 14px 0;
}
.blog-vorschau-mit-bild {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}
.blog-vorschau-thumb {
    flex: 0 0 160px;
}
.blog-vorschau-text {
    flex: 1;
    min-width: 0;
}
@media (max-width: 600px) {
    .blog-vorschau-mit-bild { flex-direction: column; }
    .blog-vorschau-thumb { flex: none; width: 100%; }
}
.blog-vorschau:last-child,
.rezept-karte:last-child,
.flo-vorschau:last-child { border-bottom: none; }
.meta { color: var(--text-dim); font-size: 0.85em; }
.kat-filter, .flo-filter {
    margin-bottom: 16px;
    padding-bottom: 10px;
    border-bottom: var(--border-dim);
}
.kat-filter a, .flo-filter a {
    margin-right: 10px;
    color: var(--text-dim);
    transition: color 0.2s ease;
}
.kat-filter a:hover, .flo-filter a:hover {
    color: var(--accent);
}
.kat-filter a.aktiv, .flo-filter a.aktiv {
    color: var(--accent2);
    font-weight: 600;
}
.artikel-inhalt, .zubereitung-inhalt, .flo-beschreibung {
    margin-top: 12px;
    line-height: 1.7;
}
.artikel-inhalt img, .post-image {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin: 16px 0;
    display: block;
}
.post-cover-image {
    width: 100%;
    max-height: 360px;
    object-fit: cover;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 16px;
}
.post-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--radius);
    display: block;
    margin-bottom: 8px;
}
.kommentar, .kommentar-admin {
    border-left: 3px solid var(--accent2);
    padding: 8px 12px;
    margin: 10px 0;
    background: var(--bg-input);
    border-radius: var(--radius);
}
.kommentar-meta { color: var(--text-dim); font-size: 0.85em; margin: 0 0 4px; }

/* ─── FOOTER ──────────────────────────────────────────────────── */
#site-footer {
    border-top: var(--border-dim);
    margin-top: 32px;
    padding: 16px 0;
    color: var(--text-muted);
    font-size: 0.85em;
    text-align: center;
}
#site-footer a {
    color: var(--text-dim);
}
#site-footer a:hover {
    color: var(--accent);
}

/* ─── HOME-KACHELN ───────────────────────────────────────────── */
.home-module {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 16px;
}
@media (min-width: 35em) {
    .home-module { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 50em) {
    .home-module { grid-template-columns: repeat(4, 1fr); }
}
.home-kachel {
    background: var(--bg-input);
    border: var(--border);
    border-radius: var(--radius);
    padding: 20px 12px;
    text-align: center;
    color: var(--text);
    font-weight: 600;
    transition: all 0.2s ease;
}
.home-kachel:hover {
    background: var(--bg-hover);
    text-decoration: none;
    border-color: var(--accent2);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.home-kachel .icon { display: block; font-size: 2em; margin-bottom: 6px; }

/* ─── PM / NACHRICHTEN ───────────────────────────────────────── */
.pm-table tr.pm-unread td { font-weight: 700; }
.pm-detail th { width: 100px; color: var(--text-dim); }
.pm-inhalt {
    background: var(--bg-input);
    border: var(--border-dim);
    border-radius: var(--radius);
    padding: 12px;
    margin: 10px 0;
}

/* ─── REDUCED MOTION ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; animation: none !important; }
}

/* ─── ADMIN-DASHBOARD ────────────────────────────────────────── */
body.admin-page .grid-aside {
    display: none !important;
}
body.admin-page .grid-main {
    grid-column: 1 / -1 !important;
}
body.admin-page {
    grid-template-columns: 1fr !important;
    grid-template-areas:
        "head"
        "nav_public"
        "nav_user"
        "main"
        "foot" !important;
}

.admin-wrapper {
    grid-column: 1 / -1;
}

.admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-box);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}
.stat-number {
    display: block;
    font-size: 2.2em;
    font-weight: 700;
    color: var(--accent2);
}
.stat-label {
    display: block;
    font-size: 0.85em;
    color: var(--text-dim);
}
.stat-card small {
    display: block;
    font-size: 0.75em;
    color: var(--text-muted);
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 16px;
}
.admin-panel {
    background: var(--bg-box);
    border: 1px solid var(--border-dim);
    border-radius: var(--radius);
    padding: 16px 20px;
}
.admin-panel h3 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-dim);
    padding-bottom: 8px;
    color: var(--accent);
}
.admin-panel ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.admin-panel li {
    padding: 6px 0;
    border-bottom: 1px solid var(--border-dim);
}
.admin-panel li:last-child {
    border-bottom: none;
}

/* ─── ASIDE ──────────────────────────────────────────────────── */
.grid-aside .content-box {
    font-size: 0.9em;
}
.grid-aside .content-box h3 {
    font-size: 1.1em;
    margin-top: 0;
    color: var(--accent);
}
.grid-aside .content-box ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.grid-aside .content-box ul li {
    padding: 4px 0;
    border-bottom: var(--border-dim);
}
.grid-aside .content-box ul li:last-child {
    border-bottom: none;
}
.grid-aside .content-box hr {
    margin: 12px 0;
}
