/* ====================================================================
   Airsoft-Clan-Website – Dunkles, modernes Design
   ==================================================================== */

:root {
    --accent: #6f9c3a;          /* Airsoft / Militaer-Gruen */
    --accent-dark: #557a2c;
    --danger: #c0392b;
    --card-bg: rgba(18, 20, 18, 0.82);
    --card-border: rgba(255, 255, 255, 0.08);
    --text: #e8e8e8;
    --muted: #a0a0a0;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

/* Dunkle Grundfarbe: verhindert das kurze weisse Aufblitzen bei Seitenwechseln */
html { background-color: #141414; }

body {
    margin: 0;
    font-family: "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    /* Hintergrundbild: full-screen, fixed, cover.
       Einzelne Eigenschaften statt Shorthand, damit die dunkle
       background-color als Fallback erhalten bleibt. */
    background-color: #141414;
    background-image: url("../img/Background.png");
    background-position: center center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    background-size: cover;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Leichter dunkler Schleier ueber dem Hintergrund fuer Lesbarkeit */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: -1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------------------------------------------------------- Header */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1.5rem;
    background: rgba(0, 0, 0, 0.5);   /* 50% transparenter schwarzer Balken */
    backdrop-filter: blur(4px);
    border-bottom: 1px solid var(--card-border);
}

.brand {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: #fff;
    text-transform: uppercase;
}
.brand:hover { text-decoration: none; color: var(--accent); }

.nav { display: flex; align-items: center; gap: 1.1rem; }
.nav a { color: var(--text); font-weight: 500; }
.nav a:hover { color: var(--accent); text-decoration: none; }

.nav-user { display: flex; align-items: center; gap: 0.4rem; }
.nav-avatar {
    width: 26px; height: 26px; border-radius: 50%;
    object-fit: cover; border: 1px solid var(--card-border);
}

.btn-link {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent) !important;
}
.btn-link:hover { background: var(--accent); color: #fff !important; }

/* ---------------------------------------------------------------- Layout */
.container {
    flex: 1;
    width: 100%;
    max-width: 1150px;
    margin: 0 auto;
    padding: 2rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;     /* Karten zentriert */
    gap: 1.5rem;
}

/* ----------------------------------------------------------------- Karten */
.card {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.8rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.card-narrow { max-width: 460px; }
.card.center { text-align: center; }

.card h1 { margin-top: 0; }

.hero { text-align: center; }
.hero h1 { font-size: 2.4rem; letter-spacing: 2px; text-transform: uppercase; }
.slogan { font-size: 1.1rem; color: var(--accent); margin-top: -0.5rem; }

.muted { color: var(--muted); font-size: 0.9rem; }

.feature-list { line-height: 1.9; }

/* ----------------------------------------------------------------- Buttons */
.btn {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btn:hover { background: var(--accent-dark); text-decoration: none; }
.btn-secondary { background: #444; }
.btn-secondary:hover { background: #333; }
.btn-danger { background: var(--danger); }
.btn-small { padding: 0.3rem 0.6rem; font-size: 0.8rem; }
.btn-row { display: flex; gap: 0.8rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }

/* ----------------------------------------------------------------- Formulare */
form label { display: block; margin: 1rem 0 0.3rem; font-weight: 600; font-size: 0.9rem; }
form input[type="text"],
form input[type="email"],
form input[type="password"],
form input[type="date"],
form input[type="file"],
form textarea,
form select {
    width: 100%;
    padding: 0.6rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 0.95rem;
}
form input:focus, form textarea:focus, form select:focus {
    outline: none; border-color: var(--accent);
}
form .btn { margin-top: 1.2rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; font-weight: 400; }
.checkbox input { width: auto; }

/* ----------------------------------------------------------------- Flash */
.flashes { width: 100%; max-width: 900px; }
.flash {
    padding: 0.8rem 1rem;
    border-radius: 6px;
    margin-bottom: 0.6rem;
    border-left: 4px solid;
}
.flash-success { background: rgba(46, 125, 50, 0.25); border-color: #4caf50; }
.flash-danger  { background: rgba(192, 57, 43, 0.25); border-color: var(--danger); }
.flash-warning { background: rgba(230, 160, 0, 0.22); border-color: #e6a000; }
.flash-info    { background: rgba(41, 128, 185, 0.22); border-color: #2980b9; }

/* ----------------------------------------------------------------- Footer */
.footer {
    width: 100%;
    text-align: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.5);
    color: var(--muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--card-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}
.footer-links { display: flex; gap: 1.2rem; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* Rechtliche Seiten (Impressum / Datenschutz) */
.legal { max-width: 800px; line-height: 1.6; }
.legal h2 { margin-top: 1.6rem; font-size: 1.15rem; }
.legal ul { line-height: 1.8; }
.legal-note {
    margin-top: 2rem; padding: 0.9rem 1rem; font-size: 0.85rem;
    background: rgba(230, 160, 0, 0.12); border-left: 3px solid #e6a000;
    border-radius: 6px; color: var(--muted);
}
.legal-note code {
    background: rgba(0,0,0,0.4); padding: 1px 5px; border-radius: 4px;
}

/* ----------------------------------------------------------------- Kalender */
.cal-header { display: flex; align-items: center; justify-content: space-between; }
.cal-header h1 { margin: 0; }
.cal-legend { display: flex; gap: 1rem; margin: 0.8rem 0; font-size: 0.8rem; }
.legend { padding: 0.15rem 0.6rem; border-radius: 4px; }
.legend.personal { background: rgba(41, 128, 185, 0.5); }
.legend.shared   { background: var(--accent-dark); }

.calendar { width: 100%; border-collapse: collapse; table-layout: fixed; }
.calendar th {
    padding: 0.5rem; font-size: 0.8rem; color: var(--muted);
    border-bottom: 1px solid var(--card-border);
}
.calendar td {
    height: 90px; vertical-align: top; padding: 4px;
    border: 1px solid var(--card-border);
}
.calendar td.empty { background: rgba(0,0,0,0.2); border: none; }
.calendar td.today { background: rgba(111, 156, 58, 0.18); }
.day-num { font-size: 0.8rem; color: var(--muted); margin-bottom: 3px; }

.event {
    font-size: 0.72rem; padding: 2px 4px; border-radius: 4px;
    margin-bottom: 3px; display: block; overflow: hidden;
    color: #fff; cursor: pointer;
}
.event:hover { text-decoration: none; filter: brightness(1.15); }
.event.personal { background: rgba(41, 128, 185, 0.85); }
.event.shared   { background: var(--accent); }
.ev-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }

/* ----------------------------------------------------------- Event-Detail */
.event-head { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.event-head h1 { margin: 0.5rem 0; }
.event-meta { line-height: 1.7; }
.event-desc { line-height: 1.6; white-space: pre-wrap; }
.badge-shared   { background: var(--accent); color: #fff; }
.badge-personal { background: #2980b9; color: #fff; }

.attendee-list { list-style: none; padding: 0; margin: 0.5rem 0; }
.attendee-list li {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.4rem 0; border-bottom: 1px solid var(--card-border);
}
.attendee-avatar {
    width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--card-border);
}

/* ----------------------------------------------------------------- Chat */
.chat-box {
    height: 380px; overflow-y: auto; display: flex; flex-direction: column;
    gap: 0.6rem; padding: 0.8rem; margin: 1rem 0;
    background: rgba(0, 0, 0, 0.35); border-radius: 8px;
    border: 1px solid var(--card-border);
}
.chat-msg { display: flex; gap: 0.6rem; align-items: flex-start; }
.chat-msg img {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--card-border); flex-shrink: 0;
}
.chat-body { flex: 1; }
.chat-meta { font-size: 0.78rem; color: var(--muted); }
.chat-meta .name { color: var(--accent); font-weight: 600; }
.chat-text { word-break: break-word; }
.chat-form { display: flex; gap: 0.6rem; }
.chat-form input { flex: 1; margin: 0; }
.chat-form .btn { margin: 0; }

/* ----------------------------------------------------------------- Profil */
.profile-head { display: flex; align-items: center; gap: 1.2rem; }
.profile-avatar {
    width: 90px; height: 90px; border-radius: 50%; object-fit: cover;
    border: 2px solid var(--accent);
}
.profile-desc { line-height: 1.6; }
.badge {
    display: inline-block; padding: 0.15rem 0.6rem; border-radius: 20px;
    font-size: 0.75rem; font-weight: 600; text-transform: uppercase;
}
.badge-admin  { background: var(--danger); color: #fff; }
.badge-member { background: #444; color: #fff; }
hr { border: none; border-top: 1px solid var(--card-border); margin: 1.5rem 0; }

/* ----------------------------------------------------------------- Admin */
.stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 1.5rem; }
.stat {
    flex: 1; min-width: 120px; text-align: center; padding: 1rem;
    background: rgba(0,0,0,0.3); border-radius: 8px; border: 1px solid var(--card-border);
    display: flex; flex-direction: column;
}
.stat .num { font-size: 2rem; font-weight: 700; color: var(--accent); }
.stat span:last-child { color: var(--muted); font-size: 0.85rem; }

.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 0.6rem; text-align: left; border-bottom: 1px solid var(--card-border);
    font-size: 0.9rem; vertical-align: middle;
}
.table-avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.data-table .actions { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.data-table .actions form { display: flex; gap: 0.3rem; align-items: center; margin: 0; }
.data-table .actions .btn { margin-top: 0; }   /* nicht nach unten verschieben */
.data-table select { width: auto; padding: 0.3rem; margin: 0; }

/* ----------------------------------------------------------------- 2FA */
.qr-code {
    width: 200px; height: 200px; background: #fff; padding: 8px;
    border-radius: 8px; margin: 1rem auto; display: block;
}
.secret {
    display: inline-block; background: rgba(0,0,0,0.5); padding: 0.4rem 0.8rem;
    border-radius: 6px; letter-spacing: 2px; margin-bottom: 1rem;
}

/* ----------------------------------------------------------- Dashboard */
.hero-compact { text-align: center; padding: 1.2rem 1.8rem; }
.hero-compact h1 { font-size: 1.8rem; margin: 0.2rem 0; }

.dashboard {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1.3fr 1fr;  /* Kalender | Chat | Mitglieder */
    gap: 1.3rem;
    align-items: start;
}
/* Ohne Chat (Gäste): nur Kalender | Mitglieder */
.dashboard-2col { grid-template-columns: 1fr 1fr; }
.panel {
    height: 460px;
    display: flex;
    flex-direction: column;
    padding: 1.2rem;
    overflow: hidden;
}
.panel-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 0.8rem; flex-shrink: 0;
}
.panel-head h2 { margin: 0; font-size: 1.2rem; }

/* Chat im Dashboard füllt den Panel-Rest */
.chat-box-dash { flex: 1; height: auto; min-height: 0; margin: 0 0 0.6rem; }

/* Mini-Kalender */
.mini-cal-title { text-align: center; font-weight: 600; margin-bottom: 0.5rem; }
.mini-cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
.mini-cal th { font-size: 0.7rem; color: var(--muted); padding: 2px; }
.mini-cal td { text-align: center; padding: 0; height: 38px; position: relative; }
.mini-cal td a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    height: 100%; color: var(--text); font-size: 0.8rem; border-radius: 4px;
}
.mini-cal td a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.mini-cal td.today a { background: rgba(111, 156, 58, 0.35); font-weight: 700; }
.mini-cal td.empty { background: transparent; }
.cal-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); margin-top: 2px; }

/* Benutzerliste */
.user-list {
    list-style: none; padding: 0; margin: 0;
    flex: 1; overflow-y: auto; min-height: 0;
}
.user-list li { border-bottom: 1px solid var(--card-border); }
.user-row {
    display: flex; align-items: center; gap: 0.6rem;
    padding: 0.5rem 0.3rem; color: var(--text);
}
.user-row:hover { background: rgba(255,255,255,0.06); text-decoration: none; }
.status-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
    box-shadow: 0 0 4px rgba(0,0,0,0.6);
}
.status-dot.online { background: #4caf50; }
.status-dot.offline { background: #777; }
.user-avatar {
    width: 30px; height: 30px; border-radius: 50%; object-fit: cover;
    border: 1px solid var(--card-border); flex-shrink: 0;
}
.user-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-badge {
    font-size: 0.62rem; text-transform: uppercase; background: var(--danger);
    color: #fff; padding: 1px 5px; border-radius: 10px; font-weight: 700;
}

/* ----------------------------------------------------------------- Forum */
.forum { width: 100%; }
.hidden { display: none; }
.forum-controls { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.forum-controls label { font-size: 0.85rem; }
.forum-controls select {
    width: auto; margin: 0;
    padding: 0.35rem 1.9rem 0.35rem 0.6rem;
    background-color: rgba(0, 0, 0, 0.4);
    color: var(--text);
    border: 1px solid var(--card-border);
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23a0a0a0' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 0.7rem;
}
.forum-controls select:hover { border-color: var(--accent); }
.forum-controls select:focus { outline: none; border-color: var(--accent); }
/* Dunkle Optionsliste (Popup) für alle Dropdowns */
select option { background: #1c1c1c; color: var(--text); }
.forum-search {
    width: 200px; padding: 0.35rem 0.6rem; margin: 0;
    background: rgba(0, 0, 0, 0.4); border: 1px solid var(--card-border);
    border-radius: 6px; color: var(--text); font-size: 0.9rem;
}
.forum-search:focus { outline: none; border-color: var(--accent); }

.new-post-form {
    background: rgba(0, 0, 0, 0.3); border: 1px solid var(--card-border);
    border-radius: 8px; padding: 1rem; margin-bottom: 1rem;
}

/* Maximal ~5 Beiträge sichtbar – danach scrollt nur die Liste, nicht die Seite */
.post-list {
    list-style: none; padding: 0; margin: 0;
    max-height: 22rem; overflow-y: auto;
}
.post-row {
    display: flex; gap: 0.9rem; align-items: center;
    padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--card-border);
}
.post-main { flex: 1; min-width: 0; }
.post-title { font-weight: 600; color: var(--text); }
.post-title:hover { color: var(--accent); text-decoration: none; }
.attach-icon { font-size: 0.85rem; margin-left: 0.3rem; }
.post-meta { font-size: 0.8rem; color: var(--muted); margin-top: 2px; }

/* Vote-Box */
.vote-box {
    display: flex; flex-direction: column; align-items: center;
    min-width: 42px; flex-shrink: 0;
}
.vote-btn {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 0.9rem; line-height: 1; padding: 2px;
}
.vote-btn:hover { color: var(--text); }
.vote-btn.up.active { color: var(--accent); }
.vote-btn.down.active { color: #e6505f; }
.vote-score { font-weight: 700; font-size: 0.95rem; margin: 1px 0; }
.vote-box-lg { min-width: 56px; }
.vote-box-lg .vote-btn { font-size: 1.2rem; }
.vote-box-lg .vote-score { font-size: 1.2rem; }

/* Beitrags-Detail */
.post-detail-head { display: flex; gap: 1rem; align-items: flex-start; }
.post-detail-head h1 { margin: 0 0 0.2rem; }
.post-body { line-height: 1.6; white-space: pre-wrap; margin-top: 1rem; }
.post-attachment { margin-top: 1rem; }
.attach-image {
    max-width: 100%; max-height: 420px; border-radius: 8px;
    border: 1px solid var(--card-border);
}

/* Kommentare */
.comment-form textarea, .reply-form textarea {
    width: 100%; padding: 0.6rem; background: rgba(0,0,0,0.4);
    border: 1px solid var(--card-border); border-radius: 6px; color: var(--text);
}
.comment-list, .comment-replies { list-style: none; padding: 0; margin: 1rem 0 0; }
.comment-replies {
    margin: 0.6rem 0 0 1.2rem; padding-left: 1rem;
    border-left: 2px solid var(--card-border);
}
.comment { padding: 0.5rem 0; }
.comment-head { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; }
.comment-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.comment-author { color: var(--accent); font-weight: 600; }
.comment-body { margin: 0.3rem 0 0.3rem 2rem; line-height: 1.5; white-space: pre-wrap; }
.comment-actions { display: flex; gap: 1rem; align-items: center; margin-left: 2rem; }
.comment-actions details { font-size: 0.8rem; }
.comment-actions summary { cursor: pointer; color: var(--muted); }
.comment-actions summary:hover { color: var(--accent); }
.reply-form { margin-top: 0.5rem; max-width: 500px; }
.reply-form .btn { margin-top: 0.5rem; }
.link-btn {
    background: none; border: none; color: var(--muted); cursor: pointer;
    font-size: 0.8rem; padding: 0;
}
.link-btn:hover { color: var(--danger); }

/* ------------------------------------------ Dashboard-Seite: kein Scrollen */
/* Ab Tablet/Desktop füllt die Startseite exakt den Viewport – nur die
   Panels und die Forum-Liste scrollen intern, nicht die ganze Seite. */
@media (min-width: 901px) {
    body.dashboard-page { height: 100vh; overflow: hidden; }
    body.dashboard-page .container {
        flex: 1 1 auto;
        min-height: 0;
        overflow: hidden;
        padding: 1rem;
        gap: 1rem;
    }
    body.dashboard-page .footer { flex-shrink: 0; }

    body.dashboard-page .hero-compact { flex: 0 0 auto; padding: 0.7rem 1.5rem; }
    body.dashboard-page .hero-compact h1 { font-size: 1.4rem; margin: 0.1rem 0; }

    /* Obere Reihe (Kalender | Chat | Mitglieder) füllt den größeren Teil */
    body.dashboard-page .dashboard {
        flex: 1 1 56%;
        min-height: 0;
        grid-template-rows: 1fr;
        align-items: stretch;
    }
    body.dashboard-page .panel { height: auto; min-height: 0; }

    /* Forum füllt den restlichen Platz, Liste scrollt darin */
    body.dashboard-page .forum {
        flex: 1 1 44%;
        min-height: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    body.dashboard-page .forum .post-list {
        flex: 1 1 auto;
        min-height: 0;
        max-height: none;
    }
}

/* ----------------------------------------------------------------- Mobile */
@media (max-width: 900px) {
    .dashboard { grid-template-columns: 1fr; }
    .panel { height: 400px; }
}
@media (max-width: 640px) {
    .topbar { flex-direction: column; gap: 0.6rem; }
    .nav { flex-wrap: wrap; justify-content: center; }
    .calendar td { height: 60px; }
    .hero h1 { font-size: 1.7rem; }
}
