/* KDB Trading -- Altes macOS Theme (Aqua-inspiriert) */

/* === Reset + Basis === */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
    background: #e8e8e8;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* === Topbar (Aqua-Gradient) === */
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, #f6f6f6, #dcdcdc);
    border-bottom: 1px solid #b0b0b0;
    padding: 0 1.2rem;
    height: 48px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}
.logo {
    font-weight: 700;
    font-size: 1.05rem;
    color: #333;
    letter-spacing: -0.02em;
}

/* === Tabs === */
.tabs { display: flex; gap: 0; }
.tab {
    padding: 0.7rem 1.1rem;
    text-decoration: none;
    color: #666;
    font-size: 0.85rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: #333; }
.tab.active {
    color: #0064d2;
    border-bottom-color: #0064d2;
}

/* === Topbar rechts === */
.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.settings-btn {
    text-decoration: none;
    font-size: 1.2rem;
    color: #888;
    transition: color 0.15s;
}
.settings-btn:hover { color: #555; }
.settings-btn.active { color: #0064d2; }
.user-info { font-size: 0.8rem; color: #888; }
.logout {
    color: #999;
    text-decoration: none;
    font-size: 0.8rem;
}
.logout:hover { color: #c00; }

/* === Content === */
.content {
    max-width: 1100px;
    margin: 1.5rem auto;
    padding: 0 1.2rem;
}

/* === Karten (Panels) === */
.card {
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 1.5rem;
    margin-bottom: 1rem;
}
.card-header {
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #e8e8e8;
}

/* === Leerzustand === */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: #888;
}
.empty-state h2 {
    font-size: 1.1rem;
    color: #555;
    margin-bottom: 0.5rem;
    font-weight: 600;
}
.empty-state p { margin-bottom: 0.4rem; font-size: 0.9rem; }
.empty-state ul {
    list-style: none;
    margin: 1rem 0;
    font-size: 0.85rem;
    color: #777;
}
.empty-state ul li { padding: 0.2rem 0; }
.empty-state ul li::before {
    content: "•";
    color: #0064d2;
    margin-right: 0.5rem;
}
.empty-state .hint {
    margin-top: 1.5rem;
    padding: 0.8rem 1rem;
    background: #f0f4ff;
    border: 1px solid #d0dcf0;
    border-radius: 6px;
    font-size: 0.82rem;
    color: #4a6a9a;
    display: inline-block;
}

/* === Formular-Elemente (Aqua-Stil) === */
label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 0.3rem;
}
input[type="text"], input[type="password"], input[type="date"],
select {
    width: 100%;
    padding: 0.5rem 0.7rem;
    background: #fff;
    border: 1px solid #b0b0b0;
    border-radius: 5px;
    color: #333;
    font-size: 0.9rem;
    font-family: inherit;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus {
    border-color: #0064d2;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.06), 0 0 0 2px rgba(0,100,210,0.15);
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.2rem;
    border: 1px solid #b0b0b0;
    border-radius: 5px;
    background: linear-gradient(to bottom, #fafafa, #e8e8e8);
    color: #333;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    box-shadow: 0 1px 1px rgba(0,0,0,0.06);
    transition: background 0.1s;
}
.btn:hover {
    background: linear-gradient(to bottom, #fff, #f0f0f0);
}
.btn:active {
    background: linear-gradient(to bottom, #ddd, #e0e0e0);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}
.btn-primary {
    background: linear-gradient(to bottom, #3b9dff, #0064d2);
    border-color: #0050a8;
    color: #fff;
}
.btn-primary:hover {
    background: linear-gradient(to bottom, #50aaff, #0072e8);
}
.btn-danger {
    background: linear-gradient(to bottom, #ff6b6b, #d32f2f);
    border-color: #b71c1c;
    color: #fff;
    font-weight: 600;
}
.btn-danger:hover {
    background: linear-gradient(to bottom, #ff8080, #e53935);
}

/* === Kill Switch === */
.kill-switch {
    padding: 0.7rem 2rem;
    font-size: 0.95rem;
    margin-top: 1.5rem;
}

/* === Formular-Grid === */
.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.form-group {
    flex: 1;
    min-width: 140px;
}

/* === Stats-Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1rem;
}
.stat-card {
    background: #f8f8f8;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 0.8rem;
    text-align: center;
}
.stat-value {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}
.stat-label {
    font-size: 0.72rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-top: 0.2rem;
}
.stat-positive { color: #2e7d32; }
.stat-negative { color: #c62828; }

/* === Tabelle === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}
.data-table th {
    text-align: left;
    padding: 0.5rem 0.6rem;
    border-bottom: 2px solid #ddd;
    color: #666;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.data-table td {
    padding: 0.45rem 0.6rem;
    border-bottom: 1px solid #eee;
    color: #444;
}
.data-table tr:hover td { background: #f8f8fb; }
.pnl-win { color: #2e7d32; font-weight: 600; }
.pnl-loss { color: #c62828; font-weight: 600; }

/* === Aufklappbar (Details) === */
details {
    margin-top: 1rem;
}
details summary {
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: #0064d2;
    padding: 0.4rem 0;
}
details summary:hover { color: #004aa0; }

/* === Card-Details (aufklappbare Karte) === */
.card-details {
    margin-top: 0;
    margin-bottom: 1rem;
}
.card-details-summary {
    background: #fff;
    border: 1px solid #c8c8c8;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 0.8rem 1.2rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-details-summary::before {
    content: "▸";
    font-size: 0.8rem;
    color: #999;
    transition: transform 0.15s;
}
.card-details[open] > .card-details-summary::before {
    transform: rotate(90deg);
}
.card-details[open] > .card-details-summary {
    border-radius: 8px 8px 0 0;
    border-bottom: none;
    margin-bottom: 0;
}

/* === Zeitraum-Buttons (Equity) === */
.eq-period-btn {
    padding: 0.3rem 0.7rem;
    font-size: 0.78rem;
}
.active-period {
    background: linear-gradient(to bottom, #3b9dff, #0064d2);
    border-color: #0050a8;
    color: #fff;
}

/* === Chart-Container === */
.chart-container {
    width: 100%;
    min-height: 350px;
    margin-bottom: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    overflow: hidden;
    background: #fafafa;
}

/* === Ladeindikator === */
.htmx-indicator {
    display: none;
}
.htmx-request .htmx-indicator {
    display: inline-block;
}
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ccc;
    border-top-color: #0064d2;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === Settings-Liste === */
.settings-list {
    list-style: none;
}
.settings-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 0;
    border-bottom: 1px solid #eee;
    font-size: 0.85rem;
}
.settings-list li:last-child { border-bottom: none; }
.settings-key { color: #666; }
.settings-value { font-weight: 500; color: #333; }
.settings-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}
.badge-green { background: #e8f5e9; color: #2e7d32; }
.badge-yellow { background: #fff8e1; color: #f57f17; }
.badge-grey { background: #f0f0f0; color: #777; }

/* === Login-Seite (macOS-Feeling) === */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #c8d6e5, #dfe6ed, #e8e8e8);
}
.login-box {
    background: #fff;
    border: 1px solid #c0c0c0;
    border-radius: 10px;
    padding: 2.2rem;
    width: 100%;
    max-width: 340px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.login-box h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #333;
    margin-bottom: 0.3rem;
}
.login-box .subtitle {
    font-size: 0.82rem;
    color: #999;
    margin-bottom: 1.5rem;
}
.login-box .error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #c62828;
    padding: 0.5rem 0.8rem;
    border-radius: 5px;
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
.login-box label { margin-top: 0.6rem; }
.login-box input { margin-bottom: 0.8rem; }
.login-box .btn { width: 100%; justify-content: center; margin-top: 0.5rem; }

/* === Responsive (iPad + iPhone) === */
@media (max-width: 768px) {
    .topbar { padding: 0 0.8rem; height: 44px; }
    .tabs { gap: 0; }
    .tab { padding: 0.6rem 0.7rem; font-size: 0.8rem; }
    .logo { font-size: 0.95rem; }
    .topbar-right { gap: 0.6rem; }
    .user-info { display: none; }
    .content { padding: 0 0.8rem; margin: 1rem auto; }
    .form-row { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
    .topbar-left { gap: 0.5rem; }
    .tab { padding: 0.5rem 0.5rem; font-size: 0.75rem; }
    .settings-btn { font-size: 1rem; }
    .card { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .chart-container { min-height: 250px; }
}
