/* ============================================================
   Beaudin Asset Management AG – Kundenportal CSS
   ============================================================ */

/* ── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --green-900: #0d3318;
    --green-800: #1a5c2e;
    --green-700: #1e6b34;
    --green-600: #237a3b;
    --green-500: #2d9a4a;
    --green-400: #3db85e;
    --green-300: #6dcf88;
    --green-100: #e8f5ec;
    --green-50:  #f3faf5;

    --gray-900: #111827;
    --gray-800: #1f2937;
    --gray-700: #374151;
    --gray-600: #4b5563;
    --gray-500: #6b7280;
    --gray-400: #9ca3af;
    --gray-300: #d1d5db;
    --gray-200: #e5e7eb;
    --gray-100: #f3f4f6;
    --gray-50:  #f9fafb;

    --white: #ffffff;
    --danger: #dc2626;
    --danger-light: #fef2f2;
    --warning: #d97706;
    --warning-light: #fffbeb;
    --success: #16a34a;
    --success-light: #f0fdf4;
    --info: #0369a1;
    --info-light: #f0f9ff;

    --font: 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
    --shadow:    0 4px 12px rgba(0,0,0,.10);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.12);
    --shadow-xl: 0 16px 48px rgba(26,92,46,.15);

    --transition: 0.2s ease;

    --sidebar-w: 260px;
    --topbar-h:  56px;
    --ticker-h:  44px;
}

html { font-size: 15px; }
body {
    font-family: var(--font);
    background: var(--gray-100);
    color: var(--gray-800);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--green-700); text-decoration: none; }
a:hover { color: var(--green-500); }

/* ── SCROLLBAR ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--gray-100); }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ============================================================
   AUTH PAGES (Login / Change Password)
   ============================================================ */
.auth-body {
    background: linear-gradient(135deg, var(--green-900) 0%, var(--green-700) 60%, var(--green-500) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 420px;
    padding: 48px 40px 40px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}

.auth-logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--green-800);
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.auth-logo-sub {
    font-size: 11px;
    color: var(--gray-500);
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-top: 4px;
}

.auth-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 6px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--gray-500);
    margin-bottom: 28px;
}

.auth-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 12px;
    color: var(--gray-400);
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-group { margin-bottom: 18px; }

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.form-control {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--gray-300);
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 14px;
    color: var(--gray-800);
    background: var(--white);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(35,122,59,.12);
}

.form-control.is-invalid { border-color: var(--danger); }
.form-control.is-invalid:focus { box-shadow: 0 0 0 3px rgba(220,38,38,.12); }

.form-select {
    appearance: none;
    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='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-text {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 5px;
}

.invalid-feedback {
    font-size: 12px;
    color: var(--danger);
    margin-top: 5px;
}

/* ── INPUT GROUP ──────────────────────────────────────────── */
.input-group { position: relative; }
.input-group .form-control { padding-right: 44px; }
.input-group-append {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--gray-400);
    background: none;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
}
.input-group-append:hover { color: var(--green-700); }

/* ── BUTTONS ──────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 10px 20px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    white-space: nowrap;
    line-height: 1;
}

.btn-primary {
    background: var(--green-800);
    color: var(--white);
    border-color: var(--green-800);
}
.btn-primary:hover {
    background: var(--green-700);
    border-color: var(--green-700);
    color: var(--white);
    box-shadow: var(--shadow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--white);
    color: var(--green-800);
    border-color: var(--green-800);
}
.btn-secondary:hover {
    background: var(--green-100);
    color: var(--green-800);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
    border-color: var(--danger);
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; color: var(--white); }

.btn-ghost {
    background: transparent;
    color: var(--gray-600);
    border-color: var(--gray-300);
}
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-800); }

.btn-sm { padding: 7px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon { padding: 8px; border-radius: var(--radius-sm); }

/* ── ALERTS ───────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 13px;
    margin-bottom: 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}
.alert-danger  { background: var(--danger-light);  color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: var(--success-light); color: #166534; border: 1px solid #86efac; }
.alert-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.alert-info    { background: var(--info-light);    color: #075985; border: 1px solid #7dd3fc; }

/* ============================================================
   PORTAL LAYOUT
   ============================================================ */
.portal-wrapper {
    display: flex;
    min-height: 100vh;
}

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--green-900);
    color: var(--white);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-logo {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo-text {
    font-size: 17px;
    font-weight: 800;
    color: var(--white);
    letter-spacing: -0.3px;
    line-height: 1.2;
}

.sidebar-logo-sub {
    font-size: 10px;
    color: rgba(255,255,255,.45);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-top: 3px;
}

.sidebar-user {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--green-600);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--white);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-role {
    font-size: 11px;
    color: rgba(255,255,255,.45);
    margin-top: 1px;
}

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

.sidebar-section-label {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.3);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    padding: 12px 20px 6px;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,.7);
    transition: all var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,.06);
    color: var(--white);
    border-left-color: var(--green-400);
}

.sidebar-nav a.active {
    background: rgba(255,255,255,.1);
    color: var(--white);
    border-left-color: var(--green-400);
    font-weight: 600;
}

.sidebar-nav a svg { flex-shrink: 0; opacity: 0.7; }
.sidebar-nav a.active svg, .sidebar-nav a:hover svg { opacity: 1; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.08);
}

.sidebar-footer a {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: rgba(255,255,255,.5);
    padding: 6px 0;
    transition: color var(--transition);
}
.sidebar-footer a:hover { color: var(--white); }

/* ── MAIN CONTENT ─────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* ── TICKER BAR ───────────────────────────────────────────── */
.ticker-bar {
    height: var(--ticker-h);
    background: var(--green-900);
    border-bottom: 1px solid rgba(255,255,255,.08);
    display: flex;
    align-items: center;
    overflow: hidden;
    position: sticky;
    top: 0;
    z-index: 90;
}

.ticker-label {
    flex-shrink: 0;
    padding: 0 16px;
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,.4);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    border-right: 1px solid rgba(255,255,255,.1);
    height: 100%;
    display: flex;
    align-items: center;
}

.ticker-scroll {
    flex: 1;
    overflow: hidden;
    position: relative;
}

.ticker-track {
    display: flex;
    gap: 0;
    animation: ticker-scroll 40s linear infinite;
    white-space: nowrap;
}

.ticker-track:hover { animation-play-state: paused; }

@keyframes ticker-scroll {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

.ticker-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 24px;
    font-size: 12px;
    color: rgba(255,255,255,.8);
    border-right: 1px solid rgba(255,255,255,.06);
}

.ticker-name { font-weight: 600; color: var(--white); }
.ticker-value { font-variant-numeric: tabular-nums; }
.ticker-change { font-size: 11px; font-weight: 600; }
.ticker-change.up   { color: var(--green-300); }
.ticker-change.down { color: #f87171; }
.ticker-loading { color: rgba(255,255,255,.4); font-size: 12px; padding: 0 20px; }

/* ── TOPBAR ───────────────────────────────────────────────── */
.topbar {
    height: var(--topbar-h);
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    position: sticky;
    top: var(--ticker-h);
    z-index: 80;
    box-shadow: var(--shadow-sm);
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-100);
    color: var(--green-800);
    border: 1px solid rgba(26,92,46,.15);
    border-radius: var(--radius-full);
    padding: 4px 12px;
    font-size: 11px;
    font-weight: 600;
}

/* ── PAGE CONTENT ─────────────────────────────────────────── */
.page-content {
    flex: 1;
    padding: 28px;
    max-width: 1200px;
    width: 100%;
}

/* ── STATS GRID ───────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px 22px;
    display: flex;
    align-items: flex-start;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--green-100);
    color: var(--green-800);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-body { min-width: 0; }
.stat-label { font-size: 11px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 22px; font-weight: 800; color: var(--gray-900); margin-top: 2px; letter-spacing: -0.5px; }
.stat-sub   { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* ── CARDS ────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    margin-bottom: 24px;
}

.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
}

.card-subtitle {
    font-size: 12px;
    color: var(--gray-500);
    margin-top: 2px;
}

.card-body { padding: 22px; }

/* ── TABLE ────────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.table th {
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--gray-200);
    background: var(--gray-50);
    white-space: nowrap;
}

.table td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--gray-100);
    color: var(--gray-700);
    vertical-align: middle;
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }

/* ── BADGES ───────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info); }
.badge-gray    { background: var(--gray-100);      color: var(--gray-600); }
.badge-green   { background: var(--green-100);     color: var(--green-800); }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition);
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal {
    background: var(--white);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(20px);
    transition: transform var(--transition);
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: 4px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    transition: color var(--transition);
}
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }

.modal-body    { padding: 24px; }
.modal-footer  { padding: 16px 24px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 10px; }

/* ── EMPTY STATE ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--gray-400);
}
.empty-state svg { margin: 0 auto 16px; display: block; opacity: 0.4; }
.empty-state h4 { font-size: 15px; font-weight: 600; color: var(--gray-500); margin-bottom: 6px; }
.empty-state p  { font-size: 13px; }

/* ── UTILITIES ────────────────────────────────────────────── */
.text-right  { text-align: right; }
.text-center { text-align: center; }
.text-muted  { color: var(--gray-500); }
.text-small  { font-size: 12px; }
.text-green  { color: var(--green-700); }
.text-danger { color: var(--danger); }
.fw-bold     { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.w-100 { width: 100%; }

/* ── FDR CARD ─────────────────────────────────────────────── */
.fdr-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow var(--transition);
}

.fdr-card:hover { box-shadow: var(--shadow); }

.fdr-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--green-700), var(--green-400));
}

.fdr-number {
    font-size: 11px;
    font-weight: 700;
    color: var(--gray-400);
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.fdr-leistung {
    font-size: 16px;
    font-weight: 700;
    color: var(--gray-900);
    margin-bottom: 12px;
}

.fdr-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.fdr-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fdr-meta-label { font-size: 10px; color: var(--gray-400); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.fdr-meta-value { font-size: 13px; color: var(--gray-700); font-weight: 500; }

.fdr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* ── INVESTMENT ROW ───────────────────────────────────────── */
.investment-amount {
    font-size: 15px;
    font-weight: 700;
    color: var(--green-800);
    font-variant-numeric: tabular-nums;
}

/* ── ADMIN SIDEBAR BADGE ──────────────────────────────────── */
.nav-badge {
    margin-left: auto;
    background: var(--green-600);
    color: var(--white);
    border-radius: var(--radius-full);
    padding: 1px 7px;
    font-size: 10px;
    font-weight: 700;
}

/* ── PAGINATION ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center;
    padding: 16px 0 0;
}

.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-600);
    border: 1px solid var(--gray-200);
    transition: all var(--transition);
}

.pagination a:hover { background: var(--green-100); border-color: var(--green-300); color: var(--green-800); }
.pagination .active { background: var(--green-800); border-color: var(--green-800); color: var(--white); }

/* ── SEARCH BAR ───────────────────────────────────────────── */
.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}

.search-input-wrap svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.search-input-wrap .form-control { padding-left: 38px; }

/* ── MOBILE TOGGLE ────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-700);
    padding: 4px;
}

/* ── RESPONSIVE ───────────────────────────────────────────── */
@media (max-width: 1024px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .sidebar-toggle { display: flex; align-items: center; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.4);
        z-index: 99;
    }
    .sidebar-overlay.open { display: block; }
}

@media (max-width: 640px) {
    .page-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .fdr-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 16px; }
    .auth-card { padding: 32px 24px 28px; }
}
