/* ==============================================================
   Security Awareness Platform — Design System v1.0
   Fonts: Barlow Condensed (headings) + Barlow (UI) + IBM Plex Mono (data)
   ============================================================== */

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

/* ── Variables ─────────────────────────────────────────────── */
:root {
    /* Provided palette */
    --border:       rgba(255, 174, 3, 0.14);
    --border2:      rgba(255, 174, 3, 0.28);
    --light-text:   #f9e7e7;
    --dark-text:    #141618;
    --primary:         #ffae03;
    --primary-dark:    #ff9900;
    --green-dark:   #113600;
    --green:        #aad400;
    --blue-dark:    #3066be;
    --blue-light:   #3da5d9;
    --vio-dark:     #800033;
    --vio-light:    #aa0044;
    --red-dark:     #e9190f;
    --red-light:    #ff4000;
    --petrol-light: #006D77;
    --petrol-dark:  #001214;
    --petrol-black: #009090;
    --bg:           #00171f;
    --bg-error:     #5a0000;

    /* Derived semantic tokens */
    --surface-1:    rgba(0, 18, 26, 0.95);   /* card / panel background */
    --surface-2:    rgba(0, 12, 18, 0.90);   /* input / inset background */
    --surface-3:    rgba(255, 174, 3, 0.05); /* hover tint */

    --text-primary:   var(--light-text);
    --text-secondary: rgba(249, 231, 231, 0.55);
    --text-muted:     rgba(249, 231, 231, 0.28);
    --text-accent:    var(--primary);

    --radius-sm: 0px;   /* tactical: sharp corners everywhere */
    --radius-md: 2px;
    --radius-lg: 4px;

    --shadow-card: 0 8px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--border);

    --transition: 0.18s ease;
    --font-head: 'Barlow Condensed', sans-serif;
    --font-body: 'Barlow', sans-serif;
    --font-mono: 'IBM Plex Mono', monospace;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

img, svg { display: block; max-width: 100%; }
a { color: var(--primary)!important; text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--light-text); }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-head);
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-primary);
    letter-spacing: 0.04em;
}
h1 { font-size: 2.2rem; }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }
h5 { font-size: 0.95rem; text-transform: uppercase; letter-spacing: 0.15em; }

.text-mono  { font-family: var(--font-mono); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent    { color: var(--primary); }
.text-success   { color: var(--green); }
.text-danger    { color: var(--red-light); }
.text-sm  { font-size: 0.8125rem; }
.text-xs  { font-size: 0.75rem; }
.label {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: rgba(255, 174, 3, 0.65);
}

/* ── Layout ─────────────────────────────────────────────────── */
.app-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}
.app-layout.sidebar-collapsed { grid-template-columns: 64px 1fr; }

.main-content {
    grid-column: 2;
    padding: 28px 32px;
    overflow-y: auto;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 24px; }
.container-sm { max-width: 720px; margin: 0 auto; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    grid-row: 1 / -1;
    background: var(--petrol-dark);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border2) transparent;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.sidebar-logo { width: 36px; height: auto; flex-shrink: 0; }

.sidebar-name {
    font-family: var(--font-head);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.12em;
    color: var(--primary);
    text-transform: uppercase;
    line-height: 1;
}
.sidebar-version {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    margin-top: 3px;
    letter-spacing: 0.1em;
}

.sidebar-nav { flex: 1; padding: 12px 0; }

.nav-section-title {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    letter-spacing: 0.25em;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 16px 20px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 20px;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 400;
    transition: background var(--transition), color var(--transition);
    border-left: 2px solid transparent;
    cursor: pointer;
}
.nav-item:hover {
    background: var(--surface-3);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(255, 174, 3, 0.08);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 500;
}
.nav-item svg { flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
    grid-column: 2;
    height: 56px;
    background: rgba(0, 12, 18, 0.9);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }

.page-title {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.06em;
    color: var(--text-primary);
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.06em;
}
.breadcrumb-sep { opacity: 0.4; }
.breadcrumb-current { color: var(--primary); }

/* ── Cards & Panels ──────────────────────────────────────────── */
.card {
    background: var(--surface-1);
    border: 1px solid var(--border2);
    border-top: 2px solid var(--primary);
    padding: 0;
}

.card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.card-title {
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: 0.08em;
    color: var(--text-primary);
}
.card-body    { padding: 24px; }
.card-footer  { padding: 16px 24px; border-top: 1px solid var(--border); }

/* ── Forms ───────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    color: rgba(255, 174, 3, 0.65);
    text-transform: uppercase;
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border2);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.875rem;
    padding: 10px 14px;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    border-radius: var(--radius-sm);
    appearance: none;
}
.form-control::placeholder { color: var(--text-muted); font-family: var(--font-mono); font-size: 0.75rem; }
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(255, 174, 3, 0.07);
}
.form-control:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.form-control.is-invalid { border-color: var(--red-light); }
.form-control.is-valid   { border-color: var(--green); }

.form-hint {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--text-muted);
    margin-top: 5px;
    letter-spacing: 0.04em;
}
.form-error {
    font-family: var(--font-mono);
    font-size: 0.6875rem;
    color: var(--red-light);
    margin-top: 5px;
}

.input-group { position: relative; }
.input-group .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 174, 3, 0.35);
    pointer-events: none;
}
.input-group .form-control { padding-left: 38px; }

select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='rgba(255,174,3,0.5)' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 20px;
    font-family: var(--font-head);
    font-weight: 600;
    font-size: 0.875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    cursor: pointer;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    transition: opacity var(--transition), transform 0.1s ease;
    white-space: nowrap;
    text-decoration: none;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: var(--dark-text);
    border-color: transparent;
}
.btn-primary:hover { opacity: 0.88; color: var(--dark-text); }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--border2);
}
.btn-outline:hover { background: var(--surface-3); border-color: var(--primary); color: var(--primary); }

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text-primary); }

.btn-danger {
    background: rgba(90, 0, 0, 0.6);
    color: var(--red-light);
    border-color: rgba(233, 25, 15, 0.35);
}
.btn-danger:hover { background: rgba(90, 0, 0, 0.9); }

.btn-sm { padding: 5px 12px; font-size: 0.75rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }

/* ── Badges & Status ─────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    font-family: var(--font-mono);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    border-radius: 2px;
}
.badge-gold    { background: rgba(255,174,3,0.15); color: var(--primary); border: 1px solid var(--border2); }
.badge-green   { background: rgba(170,212,0,0.12); color: var(--green); border: 1px solid rgba(170,212,0,0.25); }
.badge-red     { background: rgba(90,0,0,0.5); color: var(--red-light); border: 1px solid rgba(233,25,15,0.3); }
.badge-petrol  { background: rgba(0,109,119,0.2); color: var(--petrol-black); border: 1px solid rgba(0,144,144,0.3); }
.badge-muted   { background: rgba(249,231,231,0.06); color: var(--text-muted); border: 1px solid var(--border); }

.status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
}
.status-dot.active   { background: var(--green); box-shadow: 0 0 6px rgba(170,212,0,0.5); animation: pulse-dot 2s ease-in-out infinite; }
.status-dot.inactive { background: var(--text-muted); }
.status-dot.error    { background: var(--red-light); }
.status-dot.warning  { background: var(--primary); }

@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 4px rgba(170,212,0,0.4); }
    50%       { box-shadow: 0 0 10px rgba(170,212,0,0.7); }
}

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}
.table th {
    font-family: var(--font-mono);
    font-size: 0.625rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255, 174, 3, 0.6);
    padding: 10px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border2);
    white-space: nowrap;
}
.table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    vertical-align: middle;
}
.table tbody tr:hover td { background: var(--surface-3); }
.table tbody tr:last-child td { border-bottom: none; }
.table .col-actions { text-align: right; width: 1%; white-space: nowrap; }

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-left: 3px solid;
    font-size: 0.875rem;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}
.alert-error   { background: rgba(90,0,0,0.5); border-color: var(--red-dark); color: #ff9090; }
.alert-success { background: rgba(17,54,0,0.5); border-color: var(--green); color: var(--green); }
.alert-warning { background: rgba(255,174,3,0.08); border-color: var(--primary); color: var(--primary); }
.alert-info    { background: rgba(0,109,119,0.2); border-color: var(--petrol-light); color: #7ec8d0; }

/* ── Utility ─────────────────────────────────────────────────── */
.d-flex   { display: flex; }
.d-grid   { display: grid; }
.d-none   { display: none; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.flex-1 { flex: 1; }

.mt-1 { margin-top: 4px; }  .mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }

.mb-2 { margin-bottom: 8px; } .mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ── Divider ─────────────────────────────────────────────────── */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

/* ── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,174,3,0.4); }

/* ── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes spin { to { transform: rotate(360deg); } }

.animate-fade-in     { animation: fadeIn 0.3s ease; }
.animate-fade-in-up  { animation: fadeInUp 0.35s ease; }

.spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,174,3,0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.65s linear infinite;
    display: inline-block;
}

/* ── Print ───────────────────────────────────────────────────── */
@media print {
    .sidebar, .topbar { display: none; }
    .main-content { padding: 0; }
    body { background: white; color: black; }
}
/* ── Sidebar Flex-Layout Fix ─────────────────────────────────── */

.sidebar {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

.sidebar-footer {
    margin-top: auto;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

/* Avatar-Kreis */
.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--petrol-mid, #1a3a4a);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary, #ffae03);
    flex-shrink: 0;
    text-transform: uppercase;
}

.sidebar-user-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Logout-Button */
.btn-logout {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: color 0.15s, border-color 0.15s;
}

.btn-logout:hover {
    color: var(--red-light, #e9190f);
    border-color: var(--red-light, #e9190f);
}
