/* ============================================================
   KOINON SYMMACHIE PORTAL – style.css
   Basis: Reset, CSS-Variablen, Layout, Header, Navigation, Footer
   Schema A: Anthrazit + Gedämpftes Rot + Gold
   ============================================================ */

/* -- Google Fonts -------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;500;600;700&family=Source+Sans+3:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap');

/* -- CSS Custom Properties (Design-Tokens) ------------------- */
:root {
    /* Hintergrundfarben */
    --bg-body:          #141416;
    --bg-content:       #222226;
    --bg-card:          #2a2a2f;
    --bg-input:         #18181c;
    --bg-footer:        #111113;
    --bg-outer:         #111113;

    /* Akzentfarben */
    --color-primary:    #b83227;
    --color-primary-hover: #d43d2f;
    --color-secondary:  #c9a84c;
    --color-link:       #e8e8e8;

    /* Textfarben */
    --text-primary:     #e8e8e8;
    --text-secondary:   #a0a0a0;
    --text-muted:       #666666;

    /* Status-Farben */
    --color-success:    #27ae60;
    --color-error:      #b83227;
    --color-warning:    #e67e22;

    /* Rahmen & Schatten */
    --border-color:     #3a3a40;
    --border-radius:    10px;
    --container-radius: 16px;
    --shadow:           0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg:        0 8px 32px rgba(0, 0, 0, 0.5);

    /* Schriften */
    --font-heading:     'Cinzel', serif;
    --font-body:        'Source Sans 3', sans-serif;
    --font-size-base:   0.95rem;

    /* Navigation */
    --nav-link:         #a0a0a0;
    --nav-link-hover:   #e8e8e8;
    --nav-link-active:  #b83227;

    /* Layout */
    --container-max:    1200px;
    --container-margin: 1.5rem;

    /* Farbverlaeufe (Fallbacks) */
    --gradient-news:    linear-gradient(135deg, #141416 0%, #b83227 100%);
    --gradient-sub-red: linear-gradient(45deg, #2a2a2f, #b83227);
    --gradient-sub-gold:linear-gradient(45deg, #2a2a2f, #c9a84c);
}

/* -- Reset & Grundlagen -------------------------------------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-body);
    font-size: var(--font-size-base);
    font-weight: 400;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-outer);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* -- Typografie ---------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

h1 { font-size: 1.8rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 1rem; }
h6 { font-size: 0.9rem; }

p {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--color-primary);
}

strong, b {
    font-weight: 600;
}

small {
    font-size: 0.85rem;
    color: var(--text-muted);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.25rem;
}

hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* -- Seitenstruktur / Layout --------------------------------- */
.site-wrapper {
    max-width: var(--container-max);
    margin: var(--container-margin) auto;
    background-color: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--container-radius);
    box-shadow: var(--shadow-lg);
    overflow: visible;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Unter 1280px: Kein Rahmen, volle Breite */
@media (max-width: 1280px) {
    .site-wrapper {
        max-width: 100%;
        margin: 0;
        border: none;
        border-radius: 0;
        box-shadow: none;
    }
    .site-header {
        border-radius: 0;
    }
    .site-footer {
        border-radius: 0;
    }
}

.content-area {
    flex: 1;
    background-color: var(--bg-content);
    padding: 1.5rem;
}

/* -- Header -------------------------------------------------- */
.site-header {
    background-color: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    position: relative;
    z-index: 100;
    overflow: visible;
    border-radius: var(--container-radius) var(--container-radius) 0 0;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.site-logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
    flex-shrink: 0;
}

.site-logo img {
    height: 48px;
    width: auto;
    border-radius: 6px;
}

.site-logo-text {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--color-secondary);
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.header-actions a {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius);
    transition: color 0.2s ease, background-color 0.2s ease;
}

.header-actions a:hover {
    color: var(--text-primary);
    background-color: var(--bg-card);
}

/* -- Navigation ---------------------------------------------- */
.site-nav {
    background-color: var(--bg-body);
    border-bottom: 1px solid var(--border-color);
    padding: 0 1.5rem;
}

.nav-list {
    display: flex;
    align-items: center;
    list-style: none;
    padding: 0;
    margin: 0;
    gap: 0;
    overflow: visible;
}

.nav-list li {
    margin: 0;
    flex-shrink: 0;
}

.nav-list a {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--nav-link);
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap;
}

.nav-list a:hover {
    color: var(--nav-link-hover);
}

.nav-list a.active,
.nav-list li.active > a {
    color: var(--nav-link-active);
    border-bottom-color: var(--nav-link-active);
}

/* Dropdown-Menue (fuer dynamische Seiten-Navigation) */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    z-index: 1000;
    padding: 0.5rem 0;
    list-style: none;
    margin: 0;
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
    display: block;
}

.nav-dropdown-menu a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    border-bottom: none;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.nav-dropdown-menu a:hover {
    color: var(--text-primary);
    background-color: var(--bg-input);
}

/* Hamburger / Mobile Toggle */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* -- Footer -------------------------------------------------- */
.site-footer {
    background-color: var(--bg-footer);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    border-radius: 0 0 var(--container-radius) var(--container-radius);
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.footer-content p {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.8rem;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: var(--color-secondary);
}

/* -- Breadcrumb ---------------------------------------------- */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    margin-bottom: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    list-style: none;
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--color-secondary);
}

.breadcrumb .separator {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.breadcrumb .current {
    color: var(--text-primary);
}

/* -- Hilfsklassen (Utilities) -------------------------------- */
.text-primary   { color: var(--text-primary) !important; }
.text-secondary { color: var(--text-secondary) !important; }
.text-muted     { color: var(--text-muted) !important; }
.text-gold      { color: var(--color-secondary) !important; }
.text-red       { color: var(--color-primary) !important; }
.text-success   { color: var(--color-success) !important; }
.text-warning   { color: var(--color-warning) !important; }
.text-error     { color: var(--color-error) !important; }

.text-center    { text-align: center !important; }
.text-right     { text-align: right !important; }
.text-left      { text-align: left !important; }
.text-small     { font-size: 0.85rem !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }

.p-1 { padding: 0.5rem !important; }
.p-2 { padding: 1rem !important; }
.p-3 { padding: 1.5rem !important; }

.d-flex         { display: flex !important; }
.d-block        { display: block !important; }
.d-none         { display: none !important; }
.flex-wrap      { flex-wrap: wrap !important; }
.align-center   { align-items: center !important; }
.justify-between { justify-content: space-between !important; }
.gap-1          { gap: 0.5rem !important; }
.gap-2          { gap: 1rem !important; }

.w-100          { width: 100% !important; }
.overflow-hidden { overflow: hidden !important; }
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* -- Responsive: Mobile Navigation --------------------------- */
@media (max-width: 768px) {
    .site-header {
        padding: 0.75rem 1rem;
    }

    .site-logo-text {
        font-size: 1.1rem;
    }

    .site-logo img {
        height: 36px;
    }

    .nav-toggle {
        display: block;
    }

    .site-nav {
        padding: 0;
    }

    .nav-list {
        display: none;
        flex-direction: column;
        padding: 0.5rem 0;
    }

    .nav-list.open {
        display: flex;
    }

    .nav-list a {
        padding: 0.6rem 1.25rem;
        border-bottom: none;
        border-left: 3px solid transparent;
    }

    .nav-list a.active,
    .nav-list li.active > a {
        border-bottom: none;
        border-left-color: var(--nav-link-active);
    }

    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background-color: var(--bg-body);
        padding-left: 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.25rem; }
    h3 { font-size: 1.1rem; }
}

@media (max-width: 480px) {
    .site-header {
        padding: 0.5rem 0.75rem;
    }

    .site-logo-text {
        font-size: 1rem;
    }

    .site-logo img {
        height: 30px;
    }

    .header-actions a {
        font-size: 0.8rem;
        padding: 0.3rem 0.5rem;
    }

    .content-area {
        padding: 0.75rem;
    }

    h1 { font-size: 1.25rem; }
}

/* -- Animationen --------------------------------------------- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

/* -- Druckstile ---------------------------------------------- */
@media print {
    .site-nav,
    .site-footer,
    .header-actions,
    .nav-toggle {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .site-wrapper {
        border: none;
        box-shadow: none;
        margin: 0;
        max-width: 100%;
    }

    a {
        color: black;
        text-decoration: underline;
    }
}

/* -- Nav-Link Aliase (Kompatibilität mit PHP-Templates) ------- */
.nav-link {
    color: var(--nav-link);
    text-decoration: none;
    font-weight: 500;
    padding: 0.25rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}
.nav-link:hover {
    color: var(--nav-link-hover);
}
.nav-active {
    color: var(--nav-link-active) !important;
    border-bottom-color: var(--nav-link-active) !important;
}

/* -- Hilfsklassen --------------------------------------------- */
.text-muted { color: var(--text-muted); }
.text-gold { color: var(--color-secondary); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mb-sm { margin-bottom: 0.5rem; }
.mb-md { margin-bottom: 1rem; }
.mb-lg { margin-bottom: 1.5rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-lg { margin-top: 1.5rem; }

/* -- TinyMCE Anpassungen ------------------------------------- */
.tox-tinymce {
    border-radius: var(--border-radius) !important;
    border-color: var(--border-color) !important;
}

/* Tabellen im Content */
.page-content table,
.forum-post-body table,
.news-detail-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 1rem 0;
}
.page-content th, .page-content td,
.forum-post-body th, .forum-post-body td,
.news-detail-content th, .news-detail-content td {
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    text-align: left;
}
.page-content th,
.forum-post-body th,
.news-detail-content th {
    background-color: var(--bg-card);
    font-weight: 600;
}

/* -- Install-Seite -------------------------------------------- */
.install-wrapper {
    max-width: 600px;
    margin: 2rem auto;
    padding: 0 1rem;
}
.install-step {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
}

/* -- Legacy-Aliase für bestehende PHP-Templates --------------- */
.site-main {
    flex: 1;
    background-color: var(--bg-content);
}
.site-main > .container {
    max-width: 100%;
    padding: 1.5rem;
}
.container {
    width: 100%;
}

/* -- Site Footer ---------------------------------------------- */
.site-footer {
    background-color: var(--bg-footer);
    border-top: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: 0 0 var(--container-radius) var(--container-radius);
}
.footer-inner {
    max-width: 100%;
}

/* -- Auth Cards (Login/Register) ------------------------------ */
.auth-card {
    max-width: 420px;
    margin: 2rem auto;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
}
.auth-card h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

/* -- Admin Header (Titel + Button Zeile) ---------------------- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}
.admin-header h1 {
    margin-bottom: 0;
}

/* -- Nav-Item Aliase (Kompatibilität mit PHP-Templates) ------- */
.nav-item {
    position: relative;
    list-style: none;
    flex-shrink: 0;
}
.nav-dropdown {
    position: relative;
}
.nav-dropdown-toggle {
    cursor: pointer;
}
.nav-arrow {
    font-size: 0.65rem;
    margin-left: 2px;
}
.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 180px;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    padding: 0.4rem 0;
    list-style: none;
    margin: 0;
}
.nav-dropdown.open .nav-dropdown-menu {
    display: block;
}
.nav-dropdown-link {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text-secondary) !important;
    font-size: 0.85rem;
    border-bottom: none !important;
    transition: color 0.2s ease, background-color 0.2s ease;
}
.nav-dropdown-link:hover {
    color: var(--text-primary) !important;
    background-color: var(--bg-input);
}

/* -- Hamburger-Menü (Mobile) ---------------------------------- */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    flex-direction: column;
    gap: 5px;
}
.nav-toggle-bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s ease;
}

/* -- Card Header ---------------------------------------------- */
.card-header {
    background-color: var(--bg-input);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    margin: -1rem -1rem 1rem -1rem;
}
.card-header h2 {
    margin-bottom: 0;
    font-size: 1.1rem;
}

/* -- Form Hint ------------------------------------------------ */
.form-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
.form-group {
    margin-bottom: 1rem;
}

/* -- Responsive Navigation ------------------------------------ */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }
    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-body);
        border-bottom: 1px solid var(--border-color);
        z-index: 99;
    }
    .main-nav.nav-open {
        display: block;
    }
    .nav-list {
        flex-direction: column;
    }
    .nav-dropdown-menu {
        position: static;
        box-shadow: none;
        border: none;
        background: var(--bg-input);
        border-radius: 0;
    }
}
