/* ===== CSS Variablen – Dark Mode (Standard) ===== */
:root,
[data-theme="dark"] {
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a2236;
    --bg-card-hover: #1f2a42;
    --bg-modal: #141d2f;
    --bg-input: #0f1729;
    --border-color: #2a3a5c;
    --border-light: #1e2d4a;
    --text-primary: #e8edf5;
    --text-secondary: #8b9bb5;
    --text-muted: #5a6d8a;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-glow: rgba(59, 130, 246, 0.15);
    --positive: #22c55e;
    --positive-bg: rgba(34, 197, 94, 0.12);
    --negative: #ef4444;
    --negative-bg: rgba(239, 68, 68, 0.12);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.08);
    --chart-grid: rgba(42, 58, 92, 0.3);
    --chart-text: #5a6d8a;
    --chart-bg: transparent;
    --chart-tooltip-bg: #1a2236;
    --chart-tooltip-border: #2a3a5c;
    --login-bg: rgba(0, 0, 0, 0.8);
    --detail-bg: var(--bg-card);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: all 0.2s ease;
    --transition-slow: all 0.3s ease;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* ===== CSS Variablen – Light Mode ===== */
[data-theme="light"] {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f7fafc;
    --bg-modal: #ffffff;
    --bg-input: #f0f4f8;
    --border-color: #d1d9e6;
    --border-light: #e2e8f0;
    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #94a3b8;
    --accent-blue: #3b82f6;
    --accent-blue-hover: #2563eb;
    --accent-blue-glow: rgba(59, 130, 246, 0.1);
    --positive: #16a34a;
    --positive-bg: rgba(22, 163, 74, 0.08);
    --negative: #dc2626;
    --negative-bg: rgba(220, 38, 38, 0.08);
    --warning: #d97706;
    --warning-bg: rgba(217, 119, 6, 0.08);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.12);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.06);
    --chart-grid: rgba(0, 0, 0, 0.08);
    --chart-text: #94a3b8;
    --chart-bg: transparent;
    --chart-tooltip-bg: #ffffff;
    --chart-tooltip-border: #e2e8f0;
    --login-bg: rgba(0, 0, 0, 0.5);
    --detail-bg: var(--bg-card);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===== Header ===== */
.header {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo i {
    font-size: 1.3rem;
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
    padding: 7px;
    border-radius: var(--radius-sm);
}

.logo h1 {
    font-size: 1.15rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

/* Nav Tabs – als Pillen in der Mitte */
.nav-tabs {
    display: flex;
    background: var(--bg-primary);
    padding: 3px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
}

.nav-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
    white-space: nowrap;
}

[data-theme="light"] .nav-tab:hover {
    background: rgba(0, 0, 0, 0.04);
}

.nav-tab:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
}

.nav-tab.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.nav-tab i {
    font-size: 0.85rem;
}

/* Theme-Toggle & Logout – runde Icons */
.theme-toggle,
.btn-logout {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    color: var(--text-muted);
    cursor: pointer;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.theme-toggle:hover {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: var(--accent-blue-glow);
}

.btn-logout:hover {
    color: var(--negative);
    border-color: var(--negative);
    background: var(--negative-bg);
}

.theme-toggle .fa-sun { display: none; }
.theme-toggle .fa-moon { display: block; }
[data-theme="light"] .theme-toggle .fa-sun { display: block; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

/* ===== Login Overlay ===== */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--login-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-overlay.hidden {
    display: none;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.4s ease;
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo i {
    font-size: 2.5rem;
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
    padding: 16px;
    border-radius: var(--radius-lg);
    margin-bottom: 16px;
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}

.login-logo p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.login-form h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 24px;
}

.login-form .form-group {
    margin-bottom: 16px;
}

.login-form .form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 6px;
}

.login-form .form-group input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
}

.login-form .form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.btn-full {
    width: 100%;
    justify-content: center;
    padding: 12px;
    margin-top: 8px;
}

.login-switch {
    text-align: center;
    margin-top: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.login-switch a {
    color: var(--accent-blue);
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
}

.login-switch a:hover {
    text-decoration: underline;
}

.login-error {
    color: var(--negative);
    font-size: 0.8rem;
    margin-bottom: 12px;
    display: none;
}

.login-error.visible {
    display: block;
}

/* ===== Search Section ===== */
.search-section {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 24px 0;
}

.search-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 0 16px;
    transition: var(--transition);
    position: relative;
}

.search-box:focus-within {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.search-icon {
    color: var(--text-muted);
    font-size: 1rem;
    margin-right: 12px;
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    padding: 14px 0;
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-search-clear {
    display: none;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 8px;
    font-size: 0.9rem;
    border-radius: 4px;
    transition: var(--transition);
}

.btn-search-clear:hover {
    color: var(--text-primary);
}

.btn-search-clear.visible {
    display: block;
}

/* ===== Search Results ===== */
.search-results {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    max-height: 360px;
    overflow-y: auto;
    display: none;
}

.search-results.active {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--bg-card-hover);
}

.search-result-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.search-result-symbol {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.search-result-name {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.search-result-exchange {
    font-size: 0.7rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
}

.search-result-add {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 6px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    transition: var(--transition);
}

.search-result-add:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.search-no-results {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Main Content ===== */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.view {
    display: none;
}

.view.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header h2 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-header h2 i {
    color: var(--accent-blue);
}

.stock-count {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    background: var(--bg-card);
    padding: 4px 12px;
    border-radius: 20px;
}

/* ===== Stocks Grid ===== */
.stocks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.stock-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition-slow);
    position: relative;
    overflow: hidden;
}

.stock-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--accent-blue);
    opacity: 0;
    transition: var(--transition);
}

.stock-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.stock-card:hover::before {
    opacity: 1;
}

.stock-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.stock-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stock-card-symbol {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.stock-card-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.stock-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.stock-card:hover .stock-card-actions {
    opacity: 1;
}

.btn-icon-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-icon-small:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-icon-small.danger:hover {
    color: var(--negative);
    background: var(--negative-bg);
}

.stock-card-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
}

.stock-card-price-section {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stock-card-price {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.stock-card-change {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.stock-card-change.positive {
    color: var(--positive);
    background: var(--positive-bg);
}

.stock-card-change.negative {
    color: var(--negative);
    background: var(--negative-bg);
}

.stock-card-sparkline {
    width: 120px;
    height: 48px;
    flex-shrink: 0;
}

.stock-card-sparkline canvas {
    width: 100% !important;
    height: 100% !important;
}

.stock-card-portfolio-badge {
    font-size: 0.7rem;
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

/* ===== Loading State ===== */
.loading-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.loading-state.active {
    display: flex;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Empty State ===== */
.empty-state {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.empty-state.active {
    display: flex;
}

.empty-state i {
    font-size: 3rem;
    color: var(--border-color);
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-muted);
    font-size: 0.9rem;
    max-width: 400px;
}

/* ===== Portfolio Summary ===== */

/* ===== Portfolio List ===== */
.portfolio-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.portfolio-item {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: var(--transition);
}

.portfolio-item:hover {
    border-color: var(--border-color);
    background: var(--bg-card-hover);
}

.portfolio-item-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.portfolio-item-symbol {
    font-weight: 700;
    font-size: 1rem;
}

.portfolio-item-details {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.portfolio-item-right {
    display: flex;
    align-items: center;
    gap: 24px;
}

.portfolio-item-value {
    text-align: right;
}

.portfolio-item-price {
    font-weight: 600;
    font-size: 0.95rem;
}

.portfolio-item-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.portfolio-item-pnl {
    text-align: right;
    min-width: 80px;
}

.portfolio-item-pnl-value {
    font-weight: 600;
    font-size: 0.95rem;
}

.portfolio-item-pnl-value.positive {
    color: var(--positive);
}

.portfolio-item-pnl-value.negative {
    color: var(--negative);
}

.portfolio-item-pnl-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.btn-delete-pos {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: var(--transition);
}

.btn-delete-pos:hover {
    color: var(--negative);
    background: var(--negative-bg);
}

/* ===== Inline Detail Section ===== */
.detail-section {
    background: var(--detail-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    margin-top: 20px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeIn 0.3s ease;
}

.detail-header {
    display: flex;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    gap: 16px;
}

.detail-stock-info {
    flex: 1;
}

.detail-symbol-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-symbol-row h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.detail-badges {
    display: flex;
    gap: 4px;
}

.detail-fav-badge {
    color: var(--warning);
    font-size: 0.85rem;
}

.detail-portfolio-badge {
    color: var(--accent-blue);
    font-size: 0.8rem;
    background: var(--accent-blue-glow);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
}

.detail-name {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.detail-price-info {
    text-align: right;
}

.detail-price {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

.detail-change {
    font-size: 0.85rem;
    font-weight: 600;
}

.detail-change.positive {
    color: var(--positive);
}

.detail-change.negative {
    color: var(--negative);
}

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 1.1rem;
    transition: var(--transition);
}

.btn-icon:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.detail-chart-container {
    padding: 20px 24px;
}

.chart-range-selector {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    background: var(--bg-primary);
    padding: 4px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    width: fit-content;
}

.chart-range-btn {
    padding: 6px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 5px;
    transition: var(--transition);
}

.chart-range-btn:hover {
    color: var(--text-secondary);
}

.chart-range-btn.active {
    color: var(--text-primary);
    background: var(--bg-card);
    box-shadow: var(--shadow-sm);
}

.chart-wrapper {
    position: relative;
    height: 300px;
}

.chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

.detail-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 0 24px 20px;
}

.stat-item {
    background: var(--bg-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.stat-value {
    font-size: 1rem;
    font-weight: 600;
}

.detail-actions {
    display: flex;
    gap: 10px;
    padding: 0 24px 20px;
}

.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent-blue-glow);
    color: var(--accent-blue);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
    background: var(--accent-blue);
    color: white;
    border-color: var(--accent-blue);
}

.btn-primary.active {
    background: var(--warning-bg);
    color: var(--warning);
    border-color: rgba(245, 158, 11, 0.3);
}

.btn-primary.active:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.btn-success {
    background: var(--positive-bg);
    color: var(--positive);
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
    background: var(--positive);
    color: white;
    border-color: var(--positive);
}

.btn-danger {
    background: var(--negative-bg);
    color: var(--negative);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: var(--negative);
    color: white;
    border-color: var(--negative);
}

.btn-warning {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.btn-warning:hover {
    background: var(--warning);
    color: white;
    border-color: var(--warning);
}

.btn-secondary {
    background: var(--bg-primary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ===== Buy Form ===== */
.buy-form {
    display: none;
    padding: 0 24px 20px;
    border-top: 1px solid var(--border-light);
    padding-top: 20px;
}

.buy-form.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

.buy-form h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--positive);
}

.buy-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-group input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.95rem;
    transition: var(--transition);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px var(--accent-blue-glow);
}

.buy-form-total {
    text-align: right;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.buy-form-total strong {
    color: var(--text-primary);
    font-size: 1.1rem;
}

.buy-form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 24px;
    box-shadow: var(--shadow-lg);
    font-size: 0.9rem;
    font-weight: 500;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.active {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.success {
    border-color: var(--positive);
}

.toast.success i {
    color: var(--positive);
}

.toast.error {
    border-color: var(--negative);
}

.toast.error i {
    color: var(--negative);
}

.toast.info {
    border-color: var(--accent-blue);
}

.toast.info i {
    color: var(--accent-blue);
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .stocks-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    .modal-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-container {
        height: auto;
        padding: 12px 16px;
        flex-direction: column;
        gap: 12px;
    }

    .header-left {
        width: 100%;
        justify-content: center;
    }

    .nav-tabs {
        width: 100%;
    }

    .nav-tab {
        flex: 1;
        justify-content: center;
        font-size: 0.8rem;
    }

    .main-content {
        padding: 16px;
    }

    .stocks-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .stock-card-body {
        flex-direction: row;
    }

    .stock-card-actions {
        opacity: 1;
    }

    .stock-card-sparkline {
        width: 90px;
        height: 40px;
    }

    .portfolio-summary {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .portfolio-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .portfolio-item-right {
        width: 100%;
        justify-content: space-between;
    }

    .detail-header {
        flex-wrap: wrap;
        padding: 16px;
    }

    .detail-chart-container {
        padding: 12px 16px;
    }

    .chart-wrapper {
        height: 220px;
    }

    .detail-stats {
        padding: 0 16px 16px;
        grid-template-columns: repeat(2, 1fr);
    }

    .detail-actions {
        padding: 0 16px 16px;
        flex-direction: column;
    }

    .buy-form {
        padding: 16px;
    }

    .buy-form-grid {
        grid-template-columns: 1fr;
    }

    .search-section {
        padding: 12px 16px 0;
    }

    .summary-value {
        font-size: 1.2rem;
    }

    .portfolio-item-right {
        flex-wrap: wrap;
        gap: 8px;
    }

    .portfolio-item-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .logo h1 {
        font-size: 1.1rem;
    }

    .logo i {
        font-size: 1.2rem;
        padding: 6px;
    }

    .stock-card {
        padding: 14px;
    }

    .stock-card-price {
        font-size: 1.2rem;
    }

    .stock-card-symbol {
        font-size: 1rem;
    }

    .chart-wrapper {
        height: 180px;
    }

    .chart-range-btn {
        padding: 5px 10px;
        font-size: 0.75rem;
    }

    .section-header h2 {
        font-size: 1.1rem;
    }
}

/* ===== Loading Skeletons ===== */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ===== Portfolio Actions Buttons ===== */
.portfolio-item-actions {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-action-small {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-action-small:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.btn-action-small.sell:hover {
    color: var(--negative);
    background: var(--negative-bg);
}

.btn-action-small.dividend:hover {
    color: var(--warning);
    background: var(--warning-bg);
}

/* ===== Sell Form ===== */
.sell-form {
    display: none;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: fadeIn 0.2s ease;
}

.sell-form.active {
    display: block;
}

.sell-form h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--negative);
}

.sell-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.sell-form-total {
    text-align: right;
    padding: 8px 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.sell-form-total strong {
    color: var(--text-primary);
}

.sell-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== Dividend Form ===== */
.dividend-form {
    display: none;
    padding: 16px 20px;
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    animation: fadeIn 0.2s ease;
}

.dividend-form.active {
    display: block;
}

.dividend-form h4 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--warning);
}

.dividend-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.dividend-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

/* ===== Portfolio Item expanded state ===== */
.portfolio-item-wrapper {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    transition: var(--transition);
}

.portfolio-item-wrapper .portfolio-item {
    border: none;
    border-radius: var(--radius-md);
}

.portfolio-item-wrapper.expanded .portfolio-item {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    border-bottom: 1px solid var(--border-light);
}

/* ===== Portfolio Compact ===== */
.portfolio-item-clickable {
    cursor: pointer;
}

.portfolio-item-symbol-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.portfolio-item-exchange {
    font-size: 0.65rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.portfolio-item-qty-badge {
    font-size: 0.7rem;
    color: var(--accent-blue);
    background: var(--accent-blue-glow);
    padding: 2px 7px;
    border-radius: 8px;
    font-weight: 600;
}

.portfolio-item-details-compact {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.portfolio-item-price-main {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
}

.portfolio-item-value-big {
    font-weight: 700;
    font-size: 1.05rem;
}

.portfolio-item-pnl-badge {
    font-size: 0.73rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 6px;
    white-space: nowrap;
}

.portfolio-item-pnl-badge.positive {
    color: var(--positive);
    background: var(--positive-bg);
}

.portfolio-item-pnl-badge.negative {
    color: var(--negative);
    background: var(--negative-bg);
}

.portfolio-expand-icon {
    color: var(--text-muted);
    font-size: 0.7rem;
    margin-left: 4px;
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.portfolio-item-wrapper.expanded .portfolio-expand-icon {
    transform: rotate(180deg);
}

/* ===== Portfolio Detail ===== */
.portfolio-detail {
    display: none;
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
}

.portfolio-item-wrapper.expanded .portfolio-detail {
    display: block;
    animation: fadeIn 0.2s ease;
}

.portfolio-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.portfolio-detail-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.85rem;
}

.pds-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.portfolio-detail-stat .positive { color: var(--positive); font-weight: 600; }
.portfolio-detail-stat .negative { color: var(--negative); font-weight: 600; }

.portfolio-detail-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.78rem;
}

/* ===== Stock Card Exchange & Meta ===== */
.stock-card-symbol-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.stock-card-exchange {
    font-size: 0.6rem;
    color: var(--text-muted);
    background: var(--bg-primary);
    padding: 1px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    font-weight: 600;
}

.stock-card-meta {
    font-size: 0.68rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.stock-card-updated i {
    font-size: 0.6rem;
    opacity: 0.6;
}

.stock-card-currency {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 400;
}

.stock-card-actions {
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.stock-card:hover .stock-card-actions {
    opacity: 1;
}

.btn-icon-buy {
    color: var(--positive) !important;
}

.btn-icon-buy:hover {
    background: var(--positive-bg) !important;
    color: var(--positive) !important;
}

/* ===== Portfolio Actions fix ===== */
.portfolio-item-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* ===== 1024px responsive fix ===== */
@media (max-width: 1024px) {
    .detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== Card Expand (Inline-Detail) ===== */
.stock-card-expandable {
    cursor: pointer;
}

.stock-card-expandable.expanded {
    border-color: var(--accent-blue);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

.card-detail {
    border-top: 1px solid var(--border-light);
    margin-top: 14px;
    padding-top: 14px;
}

.card-chart-range {
    display: flex;
    gap: 4px;
    margin-bottom: 10px;
}

.card-chart-range .chart-range-btn {
    padding: 4px 10px;
    font-size: 0.7rem;
}

.card-chart-wrap {
    position: relative;
    height: 180px;
    margin-bottom: 12px;
}

.card-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

.card-detail-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.cds-item {
    background: var(--bg-primary);
    border-radius: 6px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.cds-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.cds-val {
    font-size: 0.85rem;
    font-weight: 600;
}

.cds-val.positive { color: var(--positive); }
.cds-val.negative { color: var(--negative); }

.card-detail-actions {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.btn-xs {
    padding: 5px 12px;
    font-size: 0.72rem;
}

.card-buy-form {
    border-top: 1px solid var(--border-light);
    padding-top: 12px;
    margin-bottom: 4px;
}

.card-buy-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.card-buy-grid .form-group label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

.card-buy-grid .form-group input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 7px 10px;
    color: var(--text-primary);
    font-family: var(--font);
    font-size: 0.85rem;
    outline: none;
}

.card-buy-grid .form-group input:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 2px var(--accent-blue-glow);
}

.card-buy-total {
    text-align: right;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.card-buy-total strong {
    color: var(--text-primary);
}

.card-buy-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.meta-sep {
    color: var(--border-color);
    font-size: 0.7rem;
}

/* ===== Portfolio Summary Compact ===== */
.portfolio-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.summary-card {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 120px;
}

.summary-card .summary-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.summary-card .summary-value {
    font-size: 0.95rem;
    font-weight: 700;
    white-space: nowrap;
}

.summary-total {
    background: var(--accent-blue-glow);
    border-color: var(--accent-blue);
}

.summary-total .summary-value {
    font-size: 1rem;
}

/* ===== Responsive Anpassungen ===== */
@media (max-width: 768px) {
    .card-detail-stats {
        grid-template-columns: repeat(3, 1fr);
    }
    .portfolio-summary {
        flex-direction: column;
    }
    .summary-card {
        min-width: 100%;
        padding: 8px 12px;
    }
    .card-buy-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .card-detail-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    .card-chart-wrap {
        height: 140px;
    }
}
