/* ─── CSS-Variablen ─────────────────────────────────────────────────────────── */
:root {
    --gdd-primary:      #2ecc71;
    --gdd-primary-dim:  #27ae60;
    --gdd-bg:           #0f172a;
    --gdd-surface:      #1e293b;
    --gdd-surface-2:    #334155;
    --gdd-surface-3:    #475569;
    --gdd-border:       #334155;
    --gdd-text:         #f1f5f9;
    --gdd-text-muted:   #94a3b8;
    --gdd-danger:       #ef4444;
    --gdd-warning:      #f59e0b;
    --gdd-info:         #38bdf8;
    --gdd-success:      #22c55e;
}

/* ─── Basis ──────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    background-color: var(--gdd-bg);
    color: var(--gdd-text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: .9375rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Hauptinhalt füllt verfügbaren Platz, Footer bleibt unten */
.page-main { flex: 1; }

/* ─── Login-Seite ────────────────────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #0d2b1a 50%, #0f172a 100%);
    padding: 1rem;
    flex: 1;
}

/* Ab 768px: Hintergrundbild als Cover */
@media (min-width: 768px) {
    .login-wrapper {
        background:
            linear-gradient(to right, rgba(15,23,42,.72) 0%, rgba(15,23,42,.92) 100%),
            url('../../media/login_bg.jpg') center/cover no-repeat fixed;
    }
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .5);
}

.login-logo {
    font-size: 3.5rem;
    font-weight: 900;
    letter-spacing: -.05em;
    line-height: 1;
}

.login-logo .g { color: var(--gdd-primary); }
.login-logo .dd { color: var(--gdd-text-muted); }

.login-tagline {
    color: var(--gdd-text-muted);
    font-size: .85rem;
    letter-spacing: .05em;
    text-transform: uppercase;
}

/* ─── Navbar ─────────────────────────────────────────────────────────────────── */
.navbar {
    background: var(--gdd-surface) !important;
    border-bottom: 1px solid var(--gdd-border) !important;
    padding: .6rem 1rem;
}

.navbar-brand {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -.04em;
}

.navbar-brand .g  { color: var(--gdd-primary); }
.navbar-brand .dd { color: var(--gdd-text-muted); }

.nav-link {
    color: var(--gdd-text-muted) !important;
    transition: color .15s;
    font-size: .875rem;
    padding: .4rem .75rem !important;
    border-radius: .375rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.nav-link:hover,
.nav-link.active {
    color: var(--gdd-text) !important;
    background: var(--gdd-surface-2);
}

.nav-link i { width: 1rem; text-align: center; }

/* ─── Haupt-Layout ───────────────────────────────────────────────────────────── */
.page-main {
    padding: 1.5rem 1rem;
    width: 100%;          /* Pflicht in flex-column-body: margin:auto würde sonst stretch überschreiben */
    max-width: 1600px;
    margin: 0 auto;
}

/* ─── Karten ─────────────────────────────────────────────────────────────────── */
.card {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .75rem;
}

.card-header {
    background: var(--gdd-surface-2);
    border-bottom: 1px solid var(--gdd-border);
    font-weight: 600;
    padding: .875rem 1.25rem;
    border-radius: .75rem .75rem 0 0 !important;
}

.card-body { padding: 1.25rem; }

/* ─── Statistik-Kacheln ──────────────────────────────────────────────────────── */
.stat-card {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .75rem;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-card .stat-icon {
    width: 3rem;
    height: 3rem;
    border-radius: .5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: .8rem;
    color: var(--gdd-text-muted);
    margin-top: .25rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}

/* ─── Tabellen ───────────────────────────────────────────────────────────────── */
.table {
    color: var(--gdd-text);
    border-color: var(--gdd-border);
    margin-bottom: 0;
}

.table th {
    background: var(--gdd-surface-2);
    color: var(--gdd-text-muted);
    font-size: .78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    border-bottom: 1px solid var(--gdd-border) !important;
    white-space: nowrap;
    padding: .6rem .875rem;
}

.table td {
    border-color: var(--gdd-border);
    padding: .6rem .875rem;
    vertical-align: middle;
    font-size: .875rem;
}

.table tbody tr:hover { background: rgba(255, 255, 255, .03); }

/* ─── Status-Badges ──────────────────────────────────────────────────────────── */
.badge-new {
    background: rgba(239, 68, 68, .15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .3);
    font-size: .75rem;
    padding: .3em .65em;
    border-radius: .375rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-processing {
    background: rgba(245, 158, 11, .15);
    color: #fcd34d;
    border: 1px solid rgba(245, 158, 11, .3);
    font-size: .75rem;
    padding: .3em .65em;
    border-radius: .375rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-done {
    background: rgba(34, 197, 94, .15);
    color: #86efac;
    border: 1px solid rgba(34, 197, 94, .3);
    font-size: .75rem;
    padding: .3em .65em;
    border-radius: .375rem;
    font-weight: 600;
    white-space: nowrap;
}

/* ─── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
    font-size: .8125rem;
    padding: .35rem .75rem;
    border-radius: .4rem;
    font-weight: 500;
    transition: all .15s;
}

.btn-primary {
    background: var(--gdd-primary);
    border-color: var(--gdd-primary);
    color: #0f172a;
}
.btn-primary:hover {
    background: var(--gdd-primary-dim);
    border-color: var(--gdd-primary-dim);
    color: #0f172a;
}

.btn-sm { padding: .2rem .5rem; font-size: .75rem; }
.btn-lg { padding: .6rem 1.25rem; font-size: .9375rem; }

/* ─── Formular-Elemente ──────────────────────────────────────────────────────── */
.form-control,
.form-select {
    background: var(--gdd-surface-2);
    border: 1px solid var(--gdd-border);
    color: var(--gdd-text);
    border-radius: .4rem;
    font-size: .875rem;
}

.form-control:focus,
.form-select:focus {
    background: var(--gdd-surface-2);
    border-color: var(--gdd-primary);
    color: var(--gdd-text);
    box-shadow: 0 0 0 .2rem rgba(46, 204, 113, .2);
}

.form-control::placeholder { color: var(--gdd-text-muted); }

.form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--gdd-text-muted);
    margin-bottom: .35rem;
}

.form-control option,
.form-select option {
    background: var(--gdd-surface);
    color: var(--gdd-text);
}

/* ─── Nav Tabs ───────────────────────────────────────────────────────────────── */
.nav-tabs {
    border-bottom-color: var(--gdd-border);
    flex-wrap: wrap;
    gap: .25rem;
}

.nav-tabs .nav-link {
    color: var(--gdd-text-muted) !important;
    border: 1px solid transparent;
    border-radius: .4rem .4rem 0 0;
    font-size: .8125rem;
    padding: .5rem 1rem !important;
}

.nav-tabs .nav-link:hover {
    background: var(--gdd-surface-2);
    border-color: transparent;
}

.nav-tabs .nav-link.active {
    background: var(--gdd-surface-2) !important;
    border-color: var(--gdd-border) var(--gdd-border) var(--gdd-surface-2);
    color: var(--gdd-primary) !important;
}

.tab-content { padding-top: 1.25rem; }

/* ─── Filter-Leiste ──────────────────────────────────────────────────────────── */
.filter-bar {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .75rem;
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    align-items: flex-end;
}

/* ─── Dropdown-Menüs ─────────────────────────────────────────────────────────── */
.dropdown-menu {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .4);
    padding: .35rem;
}

.dropdown-item {
    color: var(--gdd-text);
    border-radius: .3rem;
    font-size: .875rem;
    padding: .45rem .875rem;
}

.dropdown-item:hover { background: var(--gdd-surface-2); color: var(--gdd-text); }
.dropdown-item.text-danger:hover { background: rgba(239,68,68,.1); }
.dropdown-divider { border-color: var(--gdd-border); }

/* ─── Alerts / Toast ─────────────────────────────────────────────────────────── */
.alert {
    border-radius: .5rem;
    font-size: .875rem;
    border-width: 1px;
}

.alert-success { background: rgba(34,197,94,.1); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-danger  { background: rgba(239,68,68,.1); border-color: rgba(239,68,68,.3); color: #fca5a5; }
.alert-warning { background: rgba(245,158,11,.1); border-color: rgba(245,158,11,.3); color: #fcd34d; }
.alert-info    { background: rgba(56,189,248,.1); border-color: rgba(56,189,248,.3); color: #7dd3fc; }

/* ─── Toast-Container ────────────────────────────────────────────────────────── */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: .5rem;
    max-width: 360px;
}

.toast-msg {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .5rem;
    padding: .875rem 1.25rem;
    font-size: .875rem;
    box-shadow: 0 4px 16px rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    gap: .75rem;
    animation: slideInRight .2s ease;
}

.toast-msg.success { border-left: 3px solid var(--gdd-success); }
.toast-msg.error   { border-left: 3px solid var(--gdd-danger); }
.toast-msg.info    { border-left: 3px solid var(--gdd-info); }

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* ─── Diagramm-Container ─────────────────────────────────────────────────────── */
.chart-container {
    position: relative;
    height: 300px;
}

.chart-container-sm {
    position: relative;
    height: 220px;
}

/* ─── Problem-Karten (Dashboard) ─────────────────────────────────────────────── */
.problem-item {
    padding: .75rem 1rem;
    border-left: 3px solid var(--gdd-border);
    background: var(--gdd-surface-2);
    border-radius: 0 .4rem .4rem 0;
    margin-bottom: .5rem;
    transition: border-color .15s;
}

.problem-item:hover { border-left-color: var(--gdd-primary); }
.problem-item.status-new        { border-left-color: var(--gdd-danger); }
.problem-item.status-processing { border-left-color: var(--gdd-warning); }

.problem-item .problem-title {
    font-weight: 600;
    font-size: .875rem;
    color: var(--gdd-text);
}

.problem-item .problem-meta {
    font-size: .78rem;
    color: var(--gdd-text-muted);
    margin-top: .2rem;
}

/* ─── Leer-Zustand ───────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: var(--gdd-text-muted);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: .4;
}

/* ─── Modals ─────────────────────────────────────────────────────────────────── */
.modal-content {
    background: var(--gdd-surface);
    border: 1px solid var(--gdd-border);
    border-radius: .75rem;
}

.modal-header {
    border-bottom-color: var(--gdd-border);
    padding: 1rem 1.25rem;
}

.modal-footer {
    border-top-color: var(--gdd-border);
    padding: 1rem 1.25rem;
}

.btn-close { filter: invert(1) grayscale(100%) brightness(200%); }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--gdd-surface);
    border-top: 1px solid var(--gdd-border);
    padding: .6rem 1rem;
    text-align: center;
    font-size: .75rem;
    color: var(--gdd-text-muted);
    margin-top: auto;
    flex-shrink: 0;
}

/* ─── Spinner ────────────────────────────────────────────────────────────────── */
.loading-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 9000;
    align-items: center;
    justify-content: center;
}

.loading-overlay.visible { display: flex; }

/* ─── Responsive Anpassungen ─────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .page-main { padding: 1rem .5rem; }
    .stat-card { flex-direction: column; text-align: center; }
    .table { font-size: .8rem; }
    .table td, .table th { padding: .4rem .5rem; }
    .btn { font-size: .75rem; padding: .3rem .55rem; }
    .filter-bar { flex-direction: column; }
    .filter-bar > * { width: 100%; }
    .login-card { padding: 1.75rem 1.25rem; }
}

/* ─── Tabellen: Stacked-Layout auf Smartphones ───────────────────────────────── */
@media (max-width: 576px) {
    .table-stack thead { display: none; }

    .table-stack tbody tr {
        display: block;
        background: var(--gdd-surface-2);
        border-radius: .5rem;
        margin-bottom: .5rem;
        border: 1px solid var(--gdd-border);
        overflow: hidden;
    }

    .table-stack tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: .45rem .75rem;
        border: none !important;
        border-bottom: 1px solid rgba(255, 255, 255, .04) !important;
        font-size: .8rem;
        white-space: normal;
        min-height: 2.2rem;
        gap: .5rem;
    }

    .table-stack tbody td:last-child {
        border-bottom: none !important;
    }

    .table-stack tbody td::before {
        content: attr(data-label);
        font-size: .72rem;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .04em;
        color: var(--gdd-text-muted);
        flex: 0 0 auto;
        white-space: nowrap;
    }

    /* Zellen ohne Label (z.B. Aktionen-Spalte) */
    .table-stack tbody td[data-label=""]::before { display: none; }
    .table-stack tbody td[data-label=""] { justify-content: flex-start; flex-wrap: wrap; }

    /* table-responsive soll weiterhin horizontal scrollen falls nötig */
    .table-responsive .table-stack { min-width: unset; }
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gdd-surface); }
::-webkit-scrollbar-thumb { background: var(--gdd-surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gdd-text-muted); }

/* ─── Sonstiges ──────────────────────────────────────────────────────────────── */
.text-primary   { color: var(--gdd-primary)   !important; }
.text-muted     { color: var(--gdd-text-muted) !important; }
.border-surface { border-color: var(--gdd-border) !important; }
.bg-surface     { background: var(--gdd-surface) !important; }
.bg-surface-2   { background: var(--gdd-surface-2) !important; }

.decoder-badge {
    background: var(--gdd-surface-2);
    border: 1px solid var(--gdd-border);
    border-radius: .25rem;
    padding: .1em .45em;
    font-size: .75rem;
    font-family: monospace;
    color: var(--gdd-info);
}

a { color: var(--gdd-primary); text-decoration: none; }
a:hover { color: var(--gdd-primary-dim); text-decoration: underline; }

hr { border-color: var(--gdd-border); opacity: 1; }

.table-responsive { border-radius: 0 0 .75rem .75rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ─── Ankündigungen (Banners & Popups) ───────────────────────────────────────── */
.ann-banner {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    border-left: 4px solid;
    border-radius: .75rem;
    margin-bottom: 1rem;
}
.ann-info    { background: rgba(56,189,248,.08);  border-color: #38bdf8; color: #7dd3fc; }
.ann-warning { background: rgba(245,158,11,.08);  border-color: #f59e0b; color: #fcd34d; }
.ann-danger  { background: rgba(239,68,68,.08);   border-color: #ef4444; color: #fca5a5; }
.ann-success { background: rgba(34,197,94,.08);   border-color: #22c55e; color: #86efac; }
.ann-banner .ann-body   { flex: 1; }
.ann-banner .ann-title  { font-weight: 600; margin-bottom: 2px; }
.ann-banner .ann-msg    { font-size: .875rem; opacity: .9; }
.ann-banner .ann-close  {
    background: none; border: none; opacity: .6; cursor: pointer;
    font-size: 1.25rem; padding: 0 2px; line-height: 1; color: inherit;
    flex-shrink: 0;
}
.ann-banner .ann-close:hover { opacity: 1; }

/* ─── Popup-Modal (Stepper) ──────────────────────────────────────────────────── */
#annPopupModal .modal-dialog { max-width: 400px; }

.ann-modal-content {
    background: var(--gdd-surface) !important;
    border: 1px solid var(--gdd-border) !important;
    border-radius: 1rem !important;
    overflow: hidden;
    padding: 0;
    box-shadow: 0 24px 64px rgba(0,0,0,.55);
    position: relative;
}

.ann-modal-accent {
    height: 4px;
    transition: background .25s;
}

.ann-modal-close {
    position: absolute;
    top: .75rem;
    right: .75rem;
    background: none;
    border: none;
    color: var(--gdd-text-muted);
    font-size: .95rem;
    cursor: pointer;
    z-index: 10;
    padding: .25rem .4rem;
    border-radius: .35rem;
    line-height: 1;
    transition: color .15s, background .15s;
}
.ann-modal-close:hover { color: var(--gdd-text); background: var(--gdd-surface-2); }

/* Einzelne Slide */
.ann-slide {
    display: none;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.25rem 2rem 1.5rem;
}
.ann-slide.active { display: flex; animation: annSlideIn .22s ease; }

@keyframes annSlideIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Icon-Kreis */
.ann-slide-icon {
    width: 62px;
    height: 62px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.45rem;
    margin-bottom: 1.25rem;
    flex-shrink: 0;
}
.ann-icon-info    { background: rgba(56,189,248,.14); color: #38bdf8; box-shadow: 0 0 0 8px rgba(56,189,248,.06); }
.ann-icon-warning { background: rgba(245,158,11,.14);  color: #f59e0b; box-shadow: 0 0 0 8px rgba(245,158,11,.06); }
.ann-icon-danger  { background: rgba(239,68,68,.14);   color: #ef4444; box-shadow: 0 0 0 8px rgba(239,68,68,.06); }
.ann-icon-success { background: rgba(34,197,94,.14);   color: #22c55e; box-shadow: 0 0 0 8px rgba(34,197,94,.06); }

.ann-slide-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gdd-text);
    margin-bottom: .5rem;
    line-height: 1.3;
}
.ann-slide-msg {
    font-size: .9rem;
    color: var(--gdd-text-muted);
    line-height: 1.7;
    max-width: 30ch;
}

/* Footer-Leiste */
.ann-modal-footer {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: .875rem 1.5rem 1.25rem;
    gap: .75rem;
    border-top: 1px solid var(--gdd-border);
}

.ann-dismiss-btn {
    background: none;
    border: none;
    color: var(--gdd-text-muted);
    font-size: .8rem;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    text-underline-offset: 3px;
    white-space: nowrap;
    text-align: left;
}
.ann-dismiss-btn:hover { color: var(--gdd-text); }

/* Step-Dots */
.ann-dots { display: flex; gap: 5px; align-items: center; justify-content: center; }
.ann-dot {
    height: 6px;
    width: 6px;
    border-radius: 3px;
    background: var(--gdd-surface-3);
    transition: background .2s, width .2s;
}
.ann-dot.active { background: var(--gdd-primary); width: 14px; }

/* Weiter / Verstanden Button */
.ann-next-btn {
    background: var(--gdd-primary);
    color: #fff;
    border: none;
    border-radius: .5rem;
    padding: .45rem 1.1rem;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: .4rem;
    transition: background .15s, transform .1s;
    white-space: nowrap;
}
.ann-next-btn:hover  { background: var(--gdd-primary-dim); transform: translateY(-1px); }
.ann-next-btn:active { transform: translateY(0); }
