/* ============================================================
   HVP Stratos Console — Layout + Theming
   Bulma 1.x als Komponenten-Basis, eigene Variables fuer Branding.
   ============================================================ */

:root {
    /* Stratos-Palette */
    --stratos-bg:        #f4f6fb;          /* Body */
    --stratos-surface:   #ffffff;          /* Cards/Boxes */
    --stratos-border:    #d9dee8;          /* Borders */
    --stratos-text:      #1a2332;          /* Primaer-Text */
    --stratos-text-soft: #5b6b80;          /* Sekundaer-Text */
    --stratos-text-mute: #8b97aa;          /* Hint-Text */

    /* Sidebar (dark) */
    --sidebar-bg:        #0f172a;          /* slate-900 */
    --sidebar-bg-hover:  #1e293b;          /* slate-800 */
    --sidebar-bg-active: #1e3a5f;          /* tiefes Blau */
    --sidebar-text:      #e2e8f0;          /* slate-200 */
    --sidebar-text-mute: #94a3b8;          /* slate-400 */
    --sidebar-label:     #64748b;          /* slate-500 */
    --sidebar-border:    rgba(255,255,255,0.08);

    /* Akzent — Cloud-Blau */
    --accent:            #3b82f6;          /* blue-500 */
    --accent-hover:      #2563eb;          /* blue-600 */
    --accent-soft:       #dbeafe;          /* blue-100 */

    /* Status-Farben (kontraststark) */
    --status-success:    #16a34a;
    --status-success-bg: #dcfce7;
    --status-warning:    #d97706;
    --status-warning-bg: #fef3c7;
    --status-danger:     #dc2626;
    --status-danger-bg:  #fee2e2;
    --status-info:       #0891b2;
    --status-info-bg:    #cffafe;

    /* Layout */
    --sidebar-w:         240px;
    --sidebar-w-mini:    64px;
    --header-h:          64px;
    --radius:            8px;
    --shadow-sm:         0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow:            0 4px 12px rgba(15, 23, 42, 0.08);

    /* Bulma 1.x Variablen ueberschreiben */
    --bulma-primary-h: 217;
    --bulma-primary-s: 91%;
    --bulma-primary-l: 60%;
    --bulma-link-h: 217;
    --bulma-link-s: 91%;
    --bulma-link-l: 60%;
    --bulma-body-background-color: var(--stratos-bg);
    --bulma-body-color: var(--stratos-text);
    --bulma-text: var(--stratos-text);
    --bulma-text-strong: var(--stratos-text);
    --bulma-border: var(--stratos-border);
    --bulma-box-background-color: var(--stratos-surface);
    --bulma-box-shadow: var(--shadow-sm);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--stratos-bg);
    color: var(--stratos-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", Roboto, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

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

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
}

.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    transition: margin-left 0.2s ease;
    display: flex;
    flex-direction: column;
}

.app-main.sidebar-collapsed {
    margin-left: var(--sidebar-w-mini);
}

.page-header {
    height: var(--header-h);
    display: flex;
    align-items: center;
    padding: 0 32px;
    background: var(--stratos-surface);
    border-bottom: 1px solid var(--stratos-border);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-title {
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--stratos-text);
    margin: 0;
}

.page-content {
    padding: 24px 32px;
    flex: 1;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-w);
    height: 100vh;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    transition: width 0.2s ease;
    z-index: 100;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.sidebar.is-collapsed {
    width: var(--sidebar-w-mini);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    height: var(--header-h);
    border-bottom: 1px solid var(--sidebar-border);
    flex-shrink: 0;
}

.brand-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: 0.02em;
}

.brand-link:hover { color: var(--accent); }

.brand-icon {
    color: var(--accent);
    font-size: 1.4rem;
    flex-shrink: 0;
}

.sidebar.is-collapsed .brand-text { display: none; }

.sidebar-toggle {
    background: transparent;
    border: 0;
    color: var(--sidebar-text-mute);
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}

.sidebar-toggle:hover {
    background: var(--sidebar-bg-hover);
    color: var(--sidebar-text);
}

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

.sidebar-group-label {
    padding: 16px 8px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--sidebar-label);
}

.sidebar.is-collapsed .sidebar-group-label {
    visibility: hidden;
    height: 0;
    padding: 0;
}

.sidebar-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-list li {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 12px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 6px;
    font-size: 0.92rem;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.sidebar-link i {
    width: 18px;
    text-align: center;
    color: var(--sidebar-text-mute);
    transition: color 0.15s;
    flex-shrink: 0;
}

.sidebar-link:hover {
    background: var(--sidebar-bg-hover);
    color: #fff;
}

.sidebar-link:hover i { color: var(--accent); }

.sidebar-link.is-active {
    background: var(--sidebar-bg-active);
    color: #fff;
    font-weight: 600;
}

.sidebar-link.is-active i { color: var(--accent); }

.sidebar-link.is-active::before {
    content: '';
    width: 3px;
    background: var(--accent);
    margin-left: -12px;
    margin-right: 9px;
    border-radius: 2px;
    align-self: stretch;
}

.sidebar.is-collapsed .sidebar-link span { display: none; }
.sidebar.is-collapsed .sidebar-link.is-active::before { display: none; }
.sidebar.is-collapsed .sidebar-link {
    justify-content: center;
    padding: 12px;
}

.sidebar-spacer { flex: 1; }

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

.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.user-info { overflow: hidden; min-width: 0; }
.user-name { font-weight: 600; color: #fff; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.75rem; color: var(--sidebar-text-mute); text-transform: uppercase; letter-spacing: 0.05em; }

.sidebar.is-collapsed .user-info { display: none; }

.sidebar-actions {
    padding: 0 12px 12px;
}

/* Mobile button */
.mobile-menu-button {
    display: none;
    position: fixed;
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    border: 0;
    cursor: pointer;
    box-shadow: var(--shadow);
    z-index: 200;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.is-mobile-open {
        transform: translateX(0);
    }
    .app-main { margin-left: 0 !important; }
    .mobile-menu-button { display: block; }
    .page-header { padding: 0 16px; }
    .page-content { padding: 16px; }
}

/* ============================================================
   BULMA-OVERRIDES — bessere Kontraste
   ============================================================ */
.box {
    background: var(--stratos-surface);
    border: 1px solid var(--stratos-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    color: var(--stratos-text);
    padding: 1.25rem;
}

.box .heading {
    color: var(--stratos-text-soft);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.box .title {
    color: var(--stratos-text);
    font-weight: 700;
}

.title, .subtitle { color: var(--stratos-text); }
.subtitle { color: var(--stratos-text-soft); font-weight: 500; }

.button {
    border-radius: 6px;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}
.button:active { transform: translateY(1px); }

.button.is-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}
.button.is-primary:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
    color: #fff;
}

.button.is-light {
    background: var(--stratos-surface);
    border: 1px solid var(--stratos-border);
    color: var(--stratos-text);
}
.button.is-light:hover {
    background: #eef2f7;
    color: var(--stratos-text);
    border-color: #c0c8d4;
}

.input, .textarea, .select select {
    border-radius: 6px;
    border-color: var(--stratos-border);
    background: var(--stratos-surface);
    color: var(--stratos-text);
    box-shadow: none;
}
.input::placeholder, .textarea::placeholder { color: var(--stratos-text-mute); }
.input:focus, .textarea:focus, .select select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.label {
    color: var(--stratos-text);
    font-weight: 600;
    font-size: 0.85rem;
}

.help { color: var(--stratos-text-soft); }

/* Tags mit explizit gutem Kontrast */
.tag {
    border-radius: 4px;
    font-weight: 600;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25em 0.75em;
    height: auto;
}
.tag.is-success { background: var(--status-success-bg); color: var(--status-success); }
.tag.is-warning { background: var(--status-warning-bg); color: var(--status-warning); }
.tag.is-danger  { background: var(--status-danger-bg);  color: var(--status-danger); }
.tag.is-info    { background: var(--status-info-bg);    color: var(--status-info); }
.tag.is-light   { background: #e5e9f0; color: var(--stratos-text-soft); }
.tag.is-dark    { background: var(--stratos-text); color: #fff; }

/* Tables */
.table {
    background: transparent;
    color: var(--stratos-text);
}
.table th {
    color: var(--stratos-text-soft);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    border-bottom: 2px solid var(--stratos-border);
    padding: 12px;
}
.table td {
    border-bottom: 1px solid var(--stratos-border);
    padding: 12px;
    vertical-align: middle;
}
.table.is-striped tbody tr:nth-child(2n) { background: rgba(15, 23, 42, 0.025); }
.table.is-striped tbody tr:hover { background: rgba(59, 130, 246, 0.04); }

/* DataTables */
.dataTables_wrapper .dataTables_filter input,
.dataTables_wrapper .dataTables_length select {
    border-radius: 6px;
    border: 1px solid var(--stratos-border);
    padding: 5px 10px;
}
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_length { color: var(--stratos-text-soft); }

table.dataTable thead th { white-space: nowrap; }

/* Notifications */
.notification {
    border-radius: var(--radius);
    background: var(--stratos-surface);
    color: var(--stratos-text);
    border: 1px solid var(--stratos-border);
    border-left: 4px solid var(--stratos-text-mute);
}
.notification.is-info    { border-left-color: var(--status-info);    background: var(--status-info-bg);    color: var(--status-info); }
.notification.is-info.is-light { background: #f0f9ff; color: #075985; border-left-color: var(--status-info); }
.notification.is-warning { border-left-color: var(--status-warning); background: var(--status-warning-bg); color: #78350f; }
.notification.is-warning.is-light { background: #fffbeb; color: #78350f; border-left-color: var(--status-warning); }
.notification.is-danger  { border-left-color: var(--status-danger);  background: var(--status-danger-bg);  color: #7f1d1d; }
.notification.is-danger.is-light { background: #fef2f2; color: #7f1d1d; border-left-color: var(--status-danger); }
.notification.is-success { border-left-color: var(--status-success); background: var(--status-success-bg); color: #14532d; }

/* Modals — z-index ueber Sidebar (100) */
.modal { z-index: 1000; }
.modal-background { background: rgba(15, 23, 42, 0.55); }

.modal-card {
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(15, 23, 42, 0.35);
}
.modal-card-head {
    background: var(--stratos-surface);
    border-bottom: 1px solid var(--stratos-border);
    padding: 18px 24px;
}
.modal-card-title { color: var(--stratos-text); font-weight: 700; }
.modal-card-body  { background: var(--stratos-surface); padding: 24px; }
.modal-card-foot  { background: #f9fafc; border-top: 1px solid var(--stratos-border); padding: 14px 24px; }

/* Code */
code {
    background: #eef2f7;
    color: var(--stratos-text);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: "SF Mono", Monaco, "Cascadia Code", "Roboto Mono", monospace;
}

pre {
    background: #0f172a;
    color: #e2e8f0;
    border-radius: var(--radius);
    padding: 16px;
    overflow: auto;
    font-size: 0.82rem;
    line-height: 1.5;
}

/* Levels (Bulma) */
.level + .box { margin-top: 0; }

/* ============================================================
   LOGIN-PAGE
   ============================================================ */
.login-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--stratos-surface);
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.4);
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    justify-content: center;
    margin-bottom: 8px;
    color: var(--stratos-text);
    font-weight: 700;
    font-size: 1.5rem;
}

.login-brand i {
    color: var(--accent);
    font-size: 1.7rem;
}

.login-subtitle {
    text-align: center;
    color: var(--stratos-text-soft);
    margin-bottom: 32px;
    font-size: 0.9rem;
}
