/* ==========================================================================
   MARIOSIEBERT-IT Ticket-System
   Design passend zur neuen Homepage: Inter, dunkles Blauschwarz, Akzentblau,
   Glas-Panels mit Blur, Hero-Slideshow.
   ========================================================================== */

@font-face {
    font-family: "Inter";
    src: url("fonts/inter-var.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0b0f16;
    --bg-elev: #111826;
    --panel: rgba(13, 18, 28, 0.66);
    --panel-solid: #10161f;
    --panel-border: rgba(255, 255, 255, 0.09);
    --text: #eef2f7;
    --text-muted: #a8b3c2;
    --accent: #4da3ff;
    --accent-strong: #2f8bff;
    --accent-soft: rgba(77, 163, 255, 0.14);
    --danger: #e0837a;
    --danger-bg: #a34c42;
    --danger-bg-hover: #b85c51;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
    --header-h: 76px;
    --container: 1150px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a { color: var(--accent); text-decoration: none; }
a:hover { color: #7dbcff; }

::selection { background: var(--accent); color: #06101f; }

.container {
    width: min(var(--container), 100% - 48px);
    margin-inline: auto;
}

h1, h2, h3 { line-height: 1.18; margin: 0 0 0.5em; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); }
h2 { font-size: clamp(1.2rem, 2.2vw, 1.5rem); margin-top: 1.6em; }
h3 { font-size: 1.05rem; }

.page-sub { color: var(--text-muted); margin: 0 0 30px; max-width: 70ch; }

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 18px;
}
.kicker::before {
    content: "";
    width: 34px;
    height: 2px;
    background: var(--accent);
    border-radius: 2px;
}

/* --------------------------------------------------------------- Kopfbereich */
.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    min-height: var(--header-h);
    display: flex;
    align-items: center;
    transition: background 0.35s ease, box-shadow 0.35s ease, border-color 0.35s ease;
    border-bottom: 1px solid transparent;
}
.site-header.is-scrolled {
    background: rgba(9, 13, 20, 0.82);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
    border-bottom-color: rgba(255, 255, 255, 0.07);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.header-inner {
    width: min(var(--container), 100% - 48px);
    margin-inline: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 24px;
    padding: 10px 0;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 1.12rem;
    letter-spacing: 0.06em;
    color: var(--text);
    white-space: nowrap;
}
.brand:hover { color: var(--text); }
.brand .brand-accent { color: var(--accent); margin-left: -8px; }

.brand-chip {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-soft);
    border: 1px solid rgba(77, 163, 255, 0.35);
    padding: 3px 10px;
    border-radius: 999px;
}

.main-nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.main-nav a {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 14px;
    border-radius: 10px;
    transition: color 0.2s ease, background 0.2s ease;
}
.main-nav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.main-nav a.nav-cta {
    color: #06101f;
    background: var(--accent);
    margin-left: 8px;
}
.main-nav a.nav-cta:hover { background: #7dbcff; color: #06101f; }

.nav-user {
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    padding: 0 8px;
}
.nav-logout { color: #f0a8a0 !important; }
.nav-logout:hover { background: rgba(224, 131, 122, 0.12) !important; }

/* ---------------------------------------------------------------- Hauptteil */
.main-content {
    flex: 1;
    padding-top: calc(var(--header-h) + 48px);
    padding-bottom: 72px;
}
.main-content.after-hero { padding-top: 56px; }

/* Oeffentliche Seiten schmaler halten, Admin nutzt die volle Breite */
main.main-content { width: min(920px, 100% - 48px); }
main.main-content.main-wide { width: min(var(--container), 100% - 48px); }

/* ------------------------------------------------------- Hero mit Slideshow */
.ticket-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: min(62svh, 560px);
    overflow: hidden;
    padding: calc(var(--header-h) + 48px) 0 56px;
}

.slideshow { position: absolute; inset: 0; z-index: -2; }
.slideshow .slide {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transform: scale(1.06);
    transition: opacity 1.8s ease-in-out, transform 7.5s linear;
}
.slideshow .slide.is-active { opacity: 1; transform: scale(1); }

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        linear-gradient(to bottom, rgba(7, 10, 16, 0.6), rgba(7, 10, 16, 0.38) 45%, rgba(11, 15, 22, 0.96)),
        radial-gradient(1200px 600px at 78% 30%, rgba(47, 139, 255, 0.12), transparent 60%);
}

.glass-panel {
    max-width: 640px;
    padding: clamp(26px, 4vw, 42px);
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--panel-border);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow);
}
.glass-panel > p { color: var(--text-muted); margin: 0; }
.glass-panel h1 { margin-bottom: 0.4em; }
.glass-panel p.kicker { color: var(--accent); margin-bottom: 18px; }

/* ------------------------------------------------------------------- Karten */
.card {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: clamp(24px, 3.4vw, 34px);
    margin-bottom: 24px;
}
.card h2:first-child { margin-top: 0; }

/* --------------------------------------------------------------- Formulare */
.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 18px;
}
.form-grid .full { grid-column: 1 / -1; }

label {
    display: block;
    font-weight: 600;
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 7px;
}
label .optional { font-weight: 400; color: var(--text-muted); }

input[type="text"], input[type="email"], input[type="tel"], input[type="password"],
input[type="number"], input[type="url"], select, textarea {
    width: 100%;
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--panel-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
input::placeholder, textarea::placeholder { color: rgba(168, 179, 194, 0.55); }
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-soft);
}
select { color-scheme: dark; }
select option { background: var(--bg-elev); color: var(--text); }
textarea { resize: vertical; min-height: 140px; }

input[type="file"] {
    width: 100%;
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--panel-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font: inherit;
}
input[type="file"]::file-selector-button {
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    background: var(--accent-soft);
    border: none;
    border-radius: 8px;
    padding: 8px 14px;
    margin-right: 12px;
    cursor: pointer;
}

.form-hint { font-size: 0.84rem; color: var(--text-muted); margin-top: 6px; }

.checkbox-row { display: flex; align-items: flex-start; gap: 10px; font-size: 0.94rem; }
.checkbox-row input { margin-top: 4px; accent-color: var(--accent); }
.checkbox-row label { font-weight: 400; margin: 0; color: var(--text-muted); }

.hp-field { position: absolute; left: -9999px; top: -9999px; }

/* ----------------------------------------------------------------- Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.98rem;
    font-family: inherit;
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    background: var(--accent);
    color: #06101f;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px); }
.btn:hover { background: #7dbcff; color: #06101f; }

.btn-dark { background: var(--accent); color: #06101f; }
.btn-dark:hover { background: #7dbcff; color: #06101f; }

.btn-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.18);
    color: var(--text);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); color: var(--text); }

.btn-danger { background: var(--danger-bg); color: #fff; }
.btn-danger:hover { background: var(--danger-bg-hover); color: #fff; }

.btn-sm { padding: 9px 16px; font-size: 0.88rem; }

/* ------------------------------------------------------------------ Alerts */
.alert {
    border-radius: 14px;
    padding: 15px 19px;
    margin-bottom: 18px;
    font-size: 0.95rem;
    border: 1px solid transparent;
}
.alert-success { background: rgba(87, 196, 109, 0.1);  border-color: rgba(87, 196, 109, 0.35);  color: #a5e2b2; }
.alert-error   { background: rgba(224, 131, 122, 0.1); border-color: rgba(224, 131, 122, 0.4);  color: #f0b3ab; }
.alert-info    { background: rgba(77, 163, 255, 0.09); border-color: rgba(77, 163, 255, 0.35);  color: #a9cdf5; }

/* ----------------------------------------------------------- Status-Badges */
.badge {
    display: inline-block;
    background: color-mix(in srgb, var(--badge-color) 16%, transparent);
    color: color-mix(in srgb, var(--badge-color) 62%, white);
    border: 1px solid color-mix(in srgb, var(--badge-color) 42%, transparent);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    padding: 4px 12px;
    border-radius: 999px;
    white-space: nowrap;
}

.prio { font-size: 0.82rem; font-weight: 700; }
.prio-niedrig  { color: var(--text-muted); }
.prio-normal   { color: var(--accent); }
.prio-hoch     { color: #e8a33d; }
.prio-kritisch { color: var(--danger); }

/* ----------------------------------------------- Ticket-Verlauf (Nachrichten) */
.thread { display: flex; flex-direction: column; gap: 14px; }

.msg {
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    overflow: hidden;
}

.msg-head {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 18px;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid var(--panel-border);
}

.msg-sender { font-weight: 700; color: var(--text); }
.msg-date { color: var(--text-muted); }
.msg-body { padding: 15px 18px; overflow-wrap: anywhere; color: var(--text-muted); }
.msg-body { color: var(--text); }

.msg-admin { border-left: 3px solid var(--accent); }
.msg-customer { border-left: 3px solid #e8a33d; }
.msg-internal { border-left: 3px solid #c9b45e; background: rgba(201, 180, 94, 0.07); }
.msg-internal .msg-head { background: rgba(201, 180, 94, 0.12); }
.msg-system { border-left: 3px solid var(--panel-border); }
.msg-system .msg-body { color: var(--text-muted); font-size: 0.92rem; }

.msg-attachments { padding: 4px 18px 14px; display: flex; flex-wrap: wrap; gap: 8px; }

.attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--panel-border);
    border-radius: 999px;
    padding: 5px 14px;
    font-size: 0.85rem;
    color: var(--text);
}
.attachment-chip:hover { border-color: rgba(77, 163, 255, 0.45); color: var(--text); }
.attachment-chip .muted { margin-left: 2px; }

/* --------------------------------------------- Ticket-Infoleiste (Kundenseite) */
.ticket-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px 20px;
    margin: 4px 0 0;
}
.ticket-meta div { font-size: 0.94rem; }
.ticket-meta dt {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}
.ticket-meta dd { margin: 4px 0 0; }

/* ------------------------------------------------- Admin: Dashboard-Kacheln */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 14px;
    margin-bottom: 26px;
}

.stat-tile {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
    border: 1px solid var(--panel-border);
    border-top: 3px solid var(--badge-color, var(--accent));
    border-radius: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.stat-tile:hover { transform: translateY(-4px); border-color: rgba(77, 163, 255, 0.45); }
.stat-tile .num { font-size: 1.7rem; font-weight: 800; color: var(--text); }
.stat-tile .lbl { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }

/* --------------------------------------------------- Admin: Ticket-Tabelle */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 18px;
}
.filter-bar select, .filter-bar input { width: auto; padding: 10px 14px; }
.filter-bar input[type="text"] { min-width: 240px; }

.table-wrap {
    background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
    border: 1px solid var(--panel-border);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

table.tickets { width: 100%; border-collapse: collapse; font-size: 0.92rem; }

table.tickets th {
    text-align: left;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 13px 16px;
    white-space: nowrap;
    border-bottom: 1px solid var(--panel-border);
}
table.tickets td {
    padding: 13px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    vertical-align: middle;
}
table.tickets tbody tr:hover { background: rgba(77, 163, 255, 0.06); }

table.tickets a.tlink { color: var(--text); font-weight: 700; }
table.tickets a.tlink:hover { color: var(--accent); }

.row-unread { background: rgba(232, 163, 61, 0.07); }
.dot-new {
    display: inline-block;
    width: 8px; height: 8px;
    background: var(--accent);
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: 1px;
    box-shadow: 0 0 8px rgba(77, 163, 255, 0.8);
}

.muted { color: var(--text-muted); }
.small { font-size: 0.86rem; }
.nowrap { white-space: nowrap; }

.code-box {
    display: block;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--panel-border);
    border-radius: 10px;
    padding: 11px 15px;
    font-size: 0.86rem;
    color: var(--text);
    overflow-wrap: anywhere;
}

/* -------------------------------------------- Admin: Detailseite zweispaltig */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 330px;
    gap: 24px;
    align-items: start;
}

.sidebar .card { padding: 22px 24px; margin-bottom: 18px; }
.sidebar h3 { font-size: 0.95rem; margin: 0 0 14px; }

.kv { font-size: 0.92rem; margin: 0; }
.kv dt {
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    margin-top: 12px;
}
.kv dt:first-child { margin-top: 0; }
.kv dd { margin: 3px 0 0; overflow-wrap: anywhere; }

.status-log { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.status-log li { padding: 8px 0; border-bottom: 1px dashed rgba(255, 255, 255, 0.1); }
.status-log li:last-child { border-bottom: none; }
.status-log .when { color: var(--text-muted); font-size: 0.78rem; display: block; }

/* ------------------------------------------- Zwei-Faktor-Authentifizierung */
.mfa-setup {
    display: flex;
    flex-wrap: wrap;
    gap: 22px;
    align-items: flex-start;
}

.qr-box {
    background: #ffffff;
    border-radius: 14px;
    padding: 10px;
    display: inline-flex;
    color: #333;
    font-size: 0.85rem;
}
.qr-box img { display: block; }

.mfa-setup > div:last-child { flex: 1; min-width: 260px; }

.backup-codes {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.backup-codes code {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    padding: 8px 10px;
    text-align: center;
    font-size: 0.92rem;
    letter-spacing: 0.06em;
    color: var(--text);
}

.mfa-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--panel-border);
}
.mfa-actions h3 { margin: 0 0 10px; }
.mfa-actions input { max-width: 280px; }

@media (max-width: 700px) {
    .mfa-actions { grid-template-columns: 1fr; }
}

/* -------------------------------------------------------------------- Login */
.login-wrap { max-width: 440px; margin: 24px auto 0; }
.login-wrap .card { padding: 36px 36px 32px; }
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .brand { font-size: 1.3rem; }
.login-logo .sub { display: block; color: var(--text-muted); font-size: 0.88rem; margin-top: 6px; }

/* -------------------------------------------------------------- Fussbereich */
.site-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.07);
    padding: 34px 0;
    background: #080b11;
    margin-top: auto;
}
.footer-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}
.footer-inner p { margin: 0; color: var(--text-muted); font-size: 0.88rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.footer-nav a { color: var(--text-muted); font-size: 0.88rem; font-weight: 500; }
.footer-nav a:hover { color: var(--text); }

/* -------------------------------------------------------------- Responsive */
@media (max-width: 900px) {
    .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .header-inner { justify-content: center; }
    .footer-inner { justify-content: center; text-align: center; }
    .btn { width: 100%; justify-content: center; }
    .btn-sm, .filter-bar .btn { width: auto; }
    .main-content { padding-top: calc(var(--header-h) + 56px); }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .slideshow .slide { transition: opacity 0.5s ease; transform: none; }
}
