/* ============================================================
   contenttool.banrado.de — Design System
   Farben: bg0 #080a0f  red #c0392b  green #22c55e  purple #a78bfa
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap');

:root {
    --bg0:   #080a0f;
    --bg1:   #0f1218;
    --bg2:   #161b24;
    --bg3:   #1e2532;
    --border:#232d3f;
    --text:  #e2e8f0;
    --muted: #8899aa;
    --red:   #c0392b;
    --red2:  #e74c3c;
    --green: #22c55e;
    --purple:#a78bfa;
    --yellow:#f59e0b;
    --blue:  #38bdf8;
    --font-mono: 'Space Mono', monospace;
    --font-body: 'DM Sans', sans-serif;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    height: 100%;
    background: var(--bg0);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

body { display: flex; }

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

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: 220px;
    min-height: 100vh;
    background: var(--bg1);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    flex-shrink: 0;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    font-family: var(--font-mono);
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo strong { color: var(--red); }
.logo-dot {
    width: 10px; height: 10px;
    background: var(--red);
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px var(--red);
}

.sidebar-nav {
    list-style: none;
    padding: 0.75rem 0;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.65rem 1.25rem;
    color: var(--muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}
.nav-link:hover { color: var(--text); background: var(--bg2); }
.nav-link.active { color: var(--text); border-left-color: var(--red); background: var(--bg2); }
.nav-icon { font-size: 1rem; width: 20px; text-align: center; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.user-info { flex: 1; overflow: hidden; }
.user-avatar {
    width: 32px; height: 32px;
    background: var(--red);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.user-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: var(--muted); }
.btn-logout {
    background: none; border: none;
    color: var(--muted); cursor: pointer;
    font-size: 1rem; padding: 0.25rem;
    transition: color 0.15s;
}
.btn-logout:hover { color: var(--red2); }

/* ── Main ────────────────────────────────────────────────── */
.main-content {
    flex: 1;
    padding: 2rem;
    overflow-x: hidden;
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}
.page-header h1 {
    font-size: 1.6rem;
    font-weight: 600;
    font-family: var(--font-mono);
    letter-spacing: -0.02em;
}
.page-sub { color: var(--muted); font-size: 0.9rem; margin-top: 0.2rem; }

/* ── Stat-Karten ─────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stats-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stats-grid-4 { grid-template-columns: repeat(4, 1fr); }

.stat-card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.25rem 1rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.2s;
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
}
.stat-ga4::before  { background: var(--blue);   }
.stat-yt::before   { background: var(--red);    }
.stat-ig::before   { background: var(--purple); }

.stat-icon  { font-size: 1.25rem; margin-bottom: 0.5rem; }
.stat-label { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1.75rem; font-family: var(--font-mono); font-weight: 700; line-height: 1.2; margin: 0.25rem 0; }
.stat-trend { font-size: 0.78rem; color: var(--muted); }
.stat-trend.up   { color: var(--green); }
.stat-trend.down { color: var(--red2); }
.stat-trend.neutral { color: var(--muted); }

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: 0.95rem; font-weight: 600; }
.card-link { font-size: 0.82rem; color: var(--purple); }

.chart-card canvas { padding: 1rem 1.25rem 1.25rem; }

/* ── Two-col layout ──────────────────────────────────────── */
.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* ── Tabellen ────────────────────────────────────────────── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.data-table th {
    padding: 0.65rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    font-weight: 500;
}
.data-table td {
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg2); }
.data-table a { color: var(--text); }
.data-table a:hover { color: var(--purple); }
.page-path { max-width: 280px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank { color: var(--muted); font-family: var(--font-mono); font-size: 0.8rem; width: 36px; }
.empty { color: var(--muted); font-style: italic; padding: 1.5rem !important; text-align: center; }

/* ── Video-Liste ─────────────────────────────────────────── */
.video-list { padding: 0.5rem 0; }
.video-item {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    align-items: flex-start;
}
.video-item:last-child { border-bottom: none; }
.video-thumb { width: 90px; height: 56px; object-fit: cover; border-radius: var(--radius-sm); flex-shrink: 0; }
.video-thumb-sm { width: 64px; height: 40px; object-fit: cover; border-radius: var(--radius-sm); }
.video-title { font-size: 0.85rem; font-weight: 500; line-height: 1.4; margin-bottom: 0.3rem; }
.video-meta { display: flex; gap: 0.75rem; font-size: 0.78rem; color: var(--muted); }
.video-info { flex: 1; overflow: hidden; }
.video-row { display: flex; gap: 0.75rem; align-items: center; }
.video-title-link { font-size: 0.88rem; font-weight: 500; color: var(--text); }
.video-title-link:hover { color: var(--purple); }

/* ── Instagram-Grid ──────────────────────────────────────── */
.ig-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 2px;
}
.ig-full-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 3px;
}
.ig-item {
    position: relative;
    aspect-ratio: 1;
    overflow: hidden;
    display: block;
    background: var(--bg3);
}
.ig-item img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.ig-item:hover img { transform: scale(1.05); }
.ig-placeholder {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; color: var(--muted);
}
.ig-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex; align-items: center; justify-content: center;
    gap: 0.75rem;
    opacity: 0; transition: opacity 0.2s;
    color: #fff; font-size: 0.82rem; font-weight: 600;
}
.ig-item:hover .ig-overlay { opacity: 1; }
.ig-overlay-full {
    flex-direction: column; justify-content: flex-end;
    padding: 0.75rem; align-items: flex-start;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
}
.ig-caption { font-size: 0.8rem; font-weight: 400; line-height: 1.4; margin-bottom: 0.4rem; }
.ig-stats { display: flex; gap: 0.75rem; font-size: 0.78rem; }
.ig-item-lg { aspect-ratio: 1; }

/* ── Chart-Legend ────────────────────────────────────────── */
.chart-legend { display: flex; gap: 1rem; font-size: 0.8rem; color: var(--muted); }
.legend-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 4px;
}
.legend-sessions { background: var(--red); }
.legend-views    { background: var(--purple); }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.55rem 1.1rem;
    border-radius: var(--radius-sm);
    font-size: 0.87rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s;
    text-decoration: none;
}
.btn-primary   { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red2); color: #fff; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--bg2); color: var(--text); }
.btn-full { width: 100%; justify-content: center; }
.btn-xs   { padding: 0.3rem 0.65rem; font-size: 0.78rem; background: var(--bg3); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm); }

/* ── Formulare ───────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.82rem; color: var(--muted); margin-bottom: 0.4rem; }
.form-group input,
.form-select {
    width: 100%;
    padding: 0.6rem 0.85rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.9rem;
    font-family: var(--font-body);
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--purple);
}

/* ── Alerts ──────────────────────────────────────────────── */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 1rem;
}
.alert-error   { background: rgba(192,57,43,0.15); border: 1px solid var(--red); color: #f87171; }
.alert-success { background: rgba(34,197,94,0.12); border: 1px solid var(--green); color: var(--green); }

/* ── Auth-Seiten ─────────────────────────────────────────── */
.auth-page { display: block; background: var(--bg0); min-height: 100vh; }
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}
.auth-logo {
    font-family: var(--font-mono);
    font-size: 1.2rem;
    display: flex; align-items: center; gap: 0.5rem;
    margin-bottom: 2rem;
}
.auth-logo strong { color: var(--red); }
.auth-card {
    background: var(--bg1);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.3rem; margin-bottom: 1.5rem; font-family: var(--font-mono); }
.auth-link { text-align: center; font-size: 0.85rem; color: var(--muted); margin-top: 1rem; }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.badge-admin { background: rgba(192,57,43,0.2); color: var(--red2); }
.badge-user  { background: var(--bg3); color: var(--muted); }

/* ── Code-Block ──────────────────────────────────────────── */
.code-block {
    background: var(--bg0);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--green);
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 1200px) {
    .stats-grid         { grid-template-columns: repeat(2, 1fr); }
    .stats-grid-4       { grid-template-columns: repeat(2, 1fr); }
    .ig-grid            { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
    .sidebar            { width: 56px; }
    .sidebar-logo span,
    .nav-link span:last-child,
    .user-name, .user-role { display: none; }
    .nav-link           { justify-content: center; padding: 0.75rem; }
    .sidebar-logo       { justify-content: center; }
    .sidebar-footer     { justify-content: center; }
    .two-col            { grid-template-columns: 1fr; }
    .ig-full-grid       { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
    .stats-grid         { grid-template-columns: 1fr 1fr; }
    .main-content       { padding: 1rem; }
    .ig-grid            { grid-template-columns: repeat(3, 1fr); }
    .ig-full-grid       { grid-template-columns: repeat(2, 1fr); }
}
