/* ==========================================
   NBA WORKSPACE
   Liquid Lab Design System
   ========================================== */

:root {
    --color-bg:             #eeecea;
    --color-surface:        rgba(255, 255, 255, 0.7);
    --color-text:           #1d1d1f;
    --color-text-secondary: #666666;
    --color-border:         rgba(0, 0, 0, 0.08);
    --color-border-2:       rgba(0, 0, 0, 0.04);
    --color-accent:         #f97316;
    --color-success:        #22c55e;
    --color-danger:         #ef4444;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.10);
    --radius-sm:  8px;
    --radius-md:  12px;
    --radius-lg:  16px;
    --toolbar-h:  54px;
    --bb-color:   #f97316;
    --bl-color:   #ef4444;
}

[data-theme="dark"] {
    --color-bg:             #050505;
    --color-surface:        rgba(255, 255, 255, 0.03);
    --color-text:           #f0f0f0;
    --color-text-secondary: #666;
    --color-border:         rgba(255, 255, 255, 0.07);
    --color-border-2:       rgba(255, 255, 255, 0.03);
    --color-accent:         #f97316;
    --color-success:        #22c55e;
    --color-danger:         #ef4444;
    --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
    --shadow-md:  0 4px 12px rgba(0,0,0,0.5);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--color-bg);
    background-image: radial-gradient(circle at 50% -10%, rgba(249, 115, 22, 0.1), transparent 55%);
    background-attachment: fixed;
    color: var(--color-text);
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}

/* ── Toolbar ─────────────────────────────────────────────────────────────── */

.toolbar {
    height: var(--toolbar-h);
    background: rgba(5, 5, 5, 0.85);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
    flex-shrink: 0;
    z-index: 10;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

[data-theme="light"] .toolbar {
    background: rgba(238, 236, 234, 0.9);
}

.toolbar-back {
    color: var(--color-accent);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    letter-spacing: 0.3px;
    transition: opacity 0.2s;
}
.toolbar-back:hover { opacity: 0.7; }

.toolbar-icon { display: flex; align-items: center; line-height: 1; }

.toolbar-title {
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 2px;
    flex: 1;
}

/* Legend */
.toolbar-legend {
    display: flex;
    align-items: center;
    gap: 14px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-secondary);
}
.legend-stripe {
    width: 14px;
    height: 3px;
    border-radius: 2px;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-add {
    padding: 8px 18px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 3px 12px rgba(249, 115, 22, 0.3);
}
.btn-add:hover { transform: translateY(-1px); box-shadow: 0 5px 16px rgba(249, 115, 22, 0.4); }
.btn-add:disabled { opacity: 0.35; cursor: not-allowed; transform: none; box-shadow: none; }

.panel-count {
    font-size: 11px;
    color: var(--color-text-secondary);
    white-space: nowrap;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* Theme Toggle */
.theme-toggle {
    width: 44px;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    flex-shrink: 0;
    transition: background 0.3s;
}
[data-theme="dark"] .theme-toggle { background: var(--color-accent); }

.theme-knob {
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
[data-theme="dark"] .theme-knob { transform: translateX(20px); }

/* Tracker Button */
.btn-tracker {
    padding: 7px 16px;
    background: transparent;
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
    border-radius: 100px;
    font-family: 'Outfit', sans-serif;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-tracker:hover,
.btn-tracker.active {
    background: var(--color-accent);
    color: white;
    border-color: var(--color-accent);
}

.tracker-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--color-danger);
    color: white;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    margin-right: 2px;
    vertical-align: middle;
}

/* ── Mode Picker ─────────────────────────────────────────────────────────── */

.mode-picker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100;
}
.mode-picker-overlay.active { display: block; }

.mode-picker {
    position: fixed;
    top: calc(var(--toolbar-h) + 8px);
    right: 20px;
    background: #0d0d0d;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0,0,0,0.6);
    padding: 8px;
    z-index: 101;
    min-width: 210px;
}

[data-theme="light"] .mode-picker {
    background: #f5f4f1;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.picker-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1px;
    padding: 8px 10px 6px;
    text-transform: uppercase;
}
.picker-section-title .stripe {
    width: 18px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.picker-divider {
    height: 1px;
    background: var(--color-border);
    margin: 6px 0;
}

.mode-picker-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    font-size: 13px;
    font-weight: 500;
}
.mode-picker-item:hover { background: rgba(255,255,255,0.05); }
[data-theme="light"] .mode-picker-item:hover { background: rgba(0,0,0,0.05); }

.mode-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ── Workspace ───────────────────────────────────────────────────────────── */

.workspace {
    flex: 1;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
}
.workspace::-webkit-scrollbar { height: 4px; }
.workspace::-webkit-scrollbar-track { background: transparent; }
.workspace::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 2px; }

/* ── Panel ───────────────────────────────────────────────────────────────── */

.panel-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 280px;
    border-right: 1px solid var(--color-border);
    position: relative;
    transition: opacity 0.2s;
}
.panel-wrap:last-child { border-right: none; }
.panel-wrap.dragging { opacity: 0.3; }
.panel-wrap.drag-over::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--color-accent);
    pointer-events: none;
    z-index: 5;
    border-radius: 2px;
}

/* Farbiger Tint-Overlay über Panel */
.panel-tint-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}

.panel-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    height: 40px;
    background: rgba(0, 0, 0, 0.4);
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
    user-select: none;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

[data-theme="light"] .panel-header {
    background: rgba(238, 236, 234, 0.85);
}

/* Farbstreifen oben */
.panel-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--panel-type-color, var(--color-border));
}

.drag-handle {
    cursor: grab;
    color: var(--color-border);
    font-size: 15px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.2s;
}
.drag-handle:hover { color: var(--color-text-secondary); }
.drag-handle:active { cursor: grabbing; }

.type-badge {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.5px;
    padding: 2px 7px;
    border-radius: 5px;
    color: white;
    flex-shrink: 0;
}

.panel-mode-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.panel-note {
    font-size: 12px;
    font-weight: 400;
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--color-text-secondary);
    min-width: 0;
    font-family: inherit;
    letter-spacing: 0.2px;
    cursor: text;
}
.panel-note::placeholder {
    color: var(--color-border);
}
.panel-note:focus {
    color: var(--color-text);
}

.panel-close {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}
.panel-close:hover { background: var(--color-danger); color: white; }

.panel-iframe {
    flex: 1;
    border: none;
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 1;
}

/* ── Tracker Drawer ──────────────────────────────────────────────────────── */

.tracker-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 200;
    backdrop-filter: blur(2px);
}
.tracker-overlay.open { display: block; }

.tracker-drawer {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: 52vh;
    min-height: 320px;
    background: rgba(8, 8, 8, 0.95);
    border-top: 1px solid var(--color-border);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
    z-index: 201;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
}
.tracker-drawer.open { transform: translateY(0); }

[data-theme="light"] .tracker-drawer {
    background: rgba(238, 236, 234, 0.97);
}

.drawer-handle {
    width: 32px;
    height: 3px;
    background: var(--color-border);
    border-radius: 2px;
    margin: 10px auto 0;
    flex-shrink: 0;
}

.drawer-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px 10px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.drawer-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 7px;
}

.drawer-summary { display: flex; gap: 20px; align-items: center; }

.drawer-stat { text-align: center; }

.drawer-stat-val {
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.drawer-stat-val.positive { color: var(--color-success); }
.drawer-stat-val.negative { color: var(--color-danger); }

.drawer-stat-lbl {
    font-size: 9px;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.drawer-divider {
    width: 1px;
    height: 28px;
    background: var(--color-border);
}

.btn-clear-all {
    padding: 6px 12px;
    background: transparent;
    color: var(--color-danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-sm);
    font-family: 'Outfit', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-clear-all:hover { background: rgba(239, 68, 68, 0.12); border-color: var(--color-danger); }

.drawer-close {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.05);
    color: var(--color-text-secondary);
    font-size: 11px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.drawer-close:hover { background: var(--color-danger); color: white; }

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
}

/* ── Tracker Empty State ─────────────────────────────────────────────────── */

.tracker-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 8px;
    color: var(--color-text-secondary);
}
.tracker-empty-icon { opacity: 0.25; }
.tracker-empty-text { font-size: 14px; font-weight: 500; }
.tracker-empty-sub  { font-size: 12px; }

/* ── PT Table ────────────────────────────────────────────────────────────── */

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

.pt-table thead th {
    padding: 8px 14px;
    text-align: left;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--color-text-secondary);
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: rgba(8, 8, 8, 0.9);
    backdrop-filter: blur(10px);
}
[data-theme="light"] .pt-table thead th { background: rgba(238, 236, 234, 0.95); }
.pt-table thead th:last-child { text-align: center; }

.pt-table tbody tr {
    border-bottom: 1px solid var(--color-border-2);
    transition: background 0.15s;
}
.pt-table tbody tr:last-child { border-bottom: none; }
.pt-table tbody tr:hover { background: rgba(255,255,255,0.02); }
[data-theme="light"] .pt-table tbody tr:hover { background: rgba(0,0,0,0.03); }

.pt-table td {
    padding: 10px 14px;
    vertical-align: middle;
    color: var(--color-text-secondary);
}
.pt-table td:last-child { text-align: center; }

.pt-type-badge {
    font-size: 9px;
    font-weight: 800;
    padding: 2px 6px;
    border-radius: 4px;
    color: white;
    letter-spacing: 0.3px;
}

.pt-profit { font-weight: 700; color: var(--color-text); }
.pt-profit.positive { color: var(--color-success); }
.pt-profit.negative { color: var(--color-danger); }

.pt-rating { color: var(--color-text-secondary); font-size: 12px; }

.btn-row-del {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--color-text-secondary);
    font-size: 10px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-row-del:hover { background: var(--color-danger); color: white; }

/* ── Group Summary ───────────────────────────────────────────────────────── */

.pt-group-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--color-border);
    flex-shrink: 0;
}

.pt-group-item {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
    font-size: 12px;
}
[data-theme="light"] .pt-group-item { background: rgba(0,0,0,0.04); }

.pt-group-badge {
    font-size: 8px;
    font-weight: 800;
    padding: 2px 5px;
    border-radius: 4px;
    color: white;
}
.pt-group-label { color: var(--color-text-secondary); font-weight: 500; }
.pt-group-val   { font-weight: 700; }
.pt-group-val.positive { color: var(--color-success); }
.pt-group-val.negative { color: var(--color-danger); }

/* ── Empty State (workspace) ─────────────────────────────────────────────── */

.empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--color-text-secondary);
}
.empty-icon { opacity: 0.2; }
.empty-text { font-size: 15px; font-weight: 500; }
.empty-sub  { font-size: 13px; }

/* ── Responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 1400px) {
    .panel-wrap { min-width: 260px; }
    .toolbar-legend { display: none; }
}
@media (max-width: 1100px) {
    .panel-wrap { min-width: 230px; }
    .panel-note { font-size: 11px; }
    .toolbar-title { font-size: 11px; }
    .btn-add { padding: 7px 14px; font-size: 11px; }
    .btn-tracker { padding: 5px 12px; font-size: 11px; }
}
@media (max-width: 860px) {
    .panel-wrap { min-width: 300px; }
    .toolbar { padding: 0 12px; gap: 8px; }
    .panel-count { display: none; }
}
