/*
 * backoffice.css
 * Globale Shell-Styles für das Secure Invest AG Backoffice.
 * Enthält: Layout, Sidebar, Topbar, Seiten-Container, Unterlagen, Settings-Modal.
 * CRM-spezifische Styles → crm.css / crm-analysis.css (bestehende Files)
 *
 * Einbinden in _Host.cshtml bzw. App.razor:
 *   <link rel="stylesheet" href="css/backoffice.css">
 *   <link rel="stylesheet" href="css/crm.css">
 *   <link rel="stylesheet" href="css/crm-analysis.css">
 */

:root {
    --bg: #0d0f14;
    --bg-card: #161b27;
    --border: rgba(255, 255, 255, 0.07);
    --blue: #1a8fff;
    --blue-dim: rgba(26, 143, 255, 0.12);
    --gold: #c9a84c;
    --text: #c8cdd8;
    --text-muted: #8a95a3;
    --heading: #eef0f5;
    --red: #ef4444;
    --sidebar-w: 280px;
    --font: 'Raleway', sans-serif;
    --radius: 14px;
    --transition: .2s ease;
}

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

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
}

.backoffice-shell {
    position: relative;
    background: var(--bg);
    color: var(--text);
    font-family: 'Roboto', sans-serif;
    display: flex;
    overflow: hidden;
    min-height: 100vh;
    width: 100%;
}

.backoffice-shell::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--bg-card);
    border-right: 1px solid var(--border);
    pointer-events: none;
}

/* ── SIDEBAR ── */
.sidebar {
    width: var(--sidebar-w);
    height: 100vh;
    background: transparent;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.sidebar-profile {
    padding: 32px 24px 28px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    min-height: 190px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: var(--text-muted);
    overflow: hidden;
}

.profile-name {
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    color: var(--heading);
    text-align: center;
    margin-bottom: 0;
    line-height: 1.2;
}

.profile-name-text {
    min-height: 17px;
}

.profile-verified-placeholder {
    visibility: hidden;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-label {
    font-size: 9px;
    font-family: var(--font);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.2);
    padding: 14px 14px 5px;
    display: block;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 2px;
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--heading);
}

.nav-item.active {
    background: var(--blue-dim);
    color: var(--blue);
    border-color: rgba(26, 143, 255, 0.15);
}

.nav-item i {
    font-size: 16px;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-bottom {
    padding: 16px 12px;
    border-top: 1px solid var(--border);
}

/* ── MAIN ── */
.main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.backoffice-toast {
    position: fixed;
    top: 78px;
    right: 24px;
    z-index: 3600;
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 280px;
    max-width: min(420px, calc(100vw - 32px));
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid transparent;
    box-shadow: 0 22px 48px rgba(0, 0, 0, 0.36);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.5;
    pointer-events: auto;
}

.backoffice-toast-success {
    color: #ffffff;
    border-color: rgba(34, 197, 94, 0.32);
    background: rgba(21, 128, 61, 0.96);
}

.backoffice-toast-error {
    color: #ffffff;
    border-color: rgba(239, 68, 68, 0.32);
    background: rgba(185, 28, 28, 0.96);
}

.backoffice-toast-icon {
    flex: 0 0 auto;
    font-size: 18px;
    line-height: 1;
}

.backoffice-toast-close {
    margin-left: auto;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.topbar {
    height: 62px;
    background: rgba(13, 15, 20, 0.9);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 28px;
    gap: 12px;
    flex-shrink: 0;
}

.topbar-logo img {
    display: block;
    height: 30px;
    width: auto;
    max-width: 156px;
}

.topbar-divider {
    width: 1px;
    height: 22px;
    background: var(--border);
    margin: 0 6px;
}

.topbar-title {
    font-family: var(--font);
    font-size: 14px;
    font-weight: 700;
    color: var(--heading);
}

.topbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}

.topbar-btn {
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 16px;
    transition: all var(--transition);
}

.topbar-btn:hover {
    background: var(--blue-dim);
    color: var(--blue);
    border-color: rgba(26, 143, 255, 0.3);
}

/* ── PAGES ── */
.content {
    flex: 1;
    overflow-y: auto;
    position: relative;
}

.page {
    display: none;
    padding: 32px;
    height: 100%;
}

.page.active {
    display: block;
}

.page-akademie.active {
    display: flex;
}

#page-unterlagen.active {
    display: flex;
}

/* CRM page override */
#page-crm {
    padding: 0;
    overflow: hidden;
    height: 100%;
}

#page-crm.active {
    display: flex;
    flex-direction: column;
}

/* Dashboard page override */
#page-dashboard {
    padding: 0;
    overflow-y: auto;
    height: 100%;
}

#page-dashboard.active {
    display: block;
}

::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .08);
    border-radius: 2px;
}

/* ── UNTERLAGEN ── */
.ul-folders {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    max-width: 1080px;
    margin-top: 36px;
}

.ul-folder {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color var(--transition);
}

.ul-folder:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

.ul-folder.open {
    border-color: rgba(255, 255, 255, 0.1);
}

.ul-folder-head {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    cursor: pointer;
    user-select: none;
}

.ul-folder-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.45);
}

.ul-folder-name {
    font-family: var(--font);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--heading);
    flex: 1;
    letter-spacing: 0.1px;
}

.ul-folder-meta {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    font-family: var(--font);
    margin-right: 4px;
}

.ul-chevron {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.2);
    transition: transform 0.22s ease;
}

.ul-folder.open > .ul-folder-head > .ul-chevron {
    transform: rotate(90deg);
}

.ul-folder-body {
    display: none;
    border-top: 1px solid var(--border);
    padding: 14px 22px;
}

.ul-folder.open > .ul-folder-body {
    display: block;
}

.ul-empty {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.2);
    font-style: italic;
    padding: 4px 0;
}

/* Subfolder */
.ul-subfolder {
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 9px;
    overflow: hidden;
    transition: border-color var(--transition);
}

.ul-subfolder:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.ul-subfolder.open {
    border-color: rgba(255, 255, 255, 0.08);
}

.ul-subfolder-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 15px;
    cursor: pointer;
    user-select: none;
}

.ul-subfolder-icon {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.35);
}

.ul-subfolder-name {
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    flex: 1;
}

.ul-subfolder.open > .ul-subfolder-head > .ul-chevron {
    transform: rotate(90deg);
}

.ul-subfolder > .ul-folder-body {
    padding: 10px 15px;
}

.ul-subfolder.open > .ul-folder-body {
    display: block;
}

/* Document rows */
.ul-doc-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ul-doc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    transition: background var(--transition), border-color var(--transition);
}

.ul-doc-row:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.09);
}

.ul-doc-icon {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.ul-doc-icon.pdf {
    color: rgba(239, 83, 80, 0.7);
}

.ul-doc-icon.word {
    color: rgba(43, 124, 211, 0.7);
}

.ul-doc-icon.xlsx {
    color: rgba(52, 199, 89, 0.7);
}

.ul-doc-info {
    flex: 1;
    min-width: 0;
}

.ul-doc-name {
    font-family: var(--font);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ul-doc-size {
    font-size: 10.5px;
    color: var(--text-muted);
    margin-top: 1px;
}

.ul-doc-download {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.09);
    color: rgba(255, 255, 255, 0.5);
    font-family: var(--font);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all var(--transition);
    flex-shrink: 0;
}

.ul-doc-download:hover {
    background: rgba(26, 143, 255, 0.1);
    border-color: rgba(26, 143, 255, 0.3);
    color: #1a8fff;
}

/* ── CRM SETTINGS MODAL ── */
.crm-settings-section {
    display: flex;
    flex-direction: column;
}

.crm-settings-label {
    font-family: var(--font);
    font-size: 12px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.35);
    letter-spacing: 1px;
    text-transform: uppercase;
}

.crm-settings-sub {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.5;
}

.crm-settings-select {
    width: 100%;
    appearance: none;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 11px 38px 11px 14px;
    color: var(--heading);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    outline: none;
    cursor: pointer;
    transition: all var(--transition);
}

.crm-settings-select:focus {
    border-color: rgba(26, 143, 255, 0.4);
    background: rgba(26, 143, 255, 0.04);
    box-shadow: 0 0 0 3px rgba(26, 143, 255, 0.08);
}

.crm-settings-select option {
    background: #161b27;
    color: #eef0f5;
}

.crm-settings-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    transition: all var(--transition);
}

.crm-settings-check:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.09);
}

.crm-settings-check input[type="checkbox"] {
    display: none;
}

.crm-settings-check-box {
    width: 20px;
    height: 20px;
    border-radius: 6px;
    flex-shrink: 0;
    margin-top: 1px;
    border: 1.5px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: transparent;
    transition: all var(--transition);
}

.crm-settings-check input:checked ~ .crm-settings-check-box {
    background: rgba(26, 143, 255, 0.9);
    border-color: #1a8fff;
    color: #fff;
}

.crm-settings-check-title {
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: var(--heading);
    line-height: 1.3;
}

.crm-settings-check-desc {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 3px;
    line-height: 1.5;
}

.crm-req {
    color: #ef4444;
}

/* ── KPI Flow Layout ── */
.kpi-flow-layout {
    display: grid;
    grid-template-columns: 1fr 36px 1fr 36px 1fr 24px 210px;
    grid-template-rows: auto 32px auto 32px auto;
    margin-bottom: 32px;
}

.flow-arr {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(255, 255, 255, 0.22);
    font-size: 20px;
    user-select: none;
}

.kpi-flow-layout .kpi-card {
    margin: 4px;
}
