:root {
    --bg-color: #0d1117;
    --card-bg: #161b22;
    --text-primary: #f0f6fc;
    --text-secondary: #8b949e;
    --accent: #58a6ff;
    --border: #30363d;
    --positive: #3fb950;
    --negative: #f85149;
    --warning: #d29922;
    --table-stripe: #1c2128;
    --glass-bg: rgba(22, 27, 34, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: 16px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.highlight {
    color: var(--accent);
}

.search-bar {
    position: relative;
    width: 40%;
}

.search-bar input {
    width: 100%;
    padding: 12px 20px;
    padding-right: 40px;
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.search-bar input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.7;
    font-style: normal;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Controls */
.dashboard-controls {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.filter-group input {
    background: var(--bg-color);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 8px;
    color: var(--text-primary);
    width: 80px;
}

/* Table */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

th {
    background: var(--bg-color);
    padding: 10px;
    /* Further reduced padding */
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    /* Reduced from 0.85rem */
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
    border-bottom: 2px solid var(--border);
    transition: color 0.2s;
}

th:hover {
    color: var(--accent);
}

td {
    padding: 8px 10px;
    /* Further reduced padding */
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    /* Reduced from 0.85rem */
}

tbody tr:hover {
    background-color: var(--table-stripe);
}

/* Indicators */
.val-positive {
    color: var(--positive);
    font-weight: 600;
}

.val-negative {
    color: var(--negative);
    font-weight: 600;
}

.val-warning {
    color: var(--warning);
    font-weight: 600;
}

.trend-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    display: inline-block;
    min-width: 30px;
}

.trend-up {
    background: rgba(63, 185, 80, 0.2);
    color: var(--positive);
}

.trend-strong-up {
    background: rgba(63, 185, 80, 0.3);
    color: var(--positive);
    border: 1px solid var(--positive);
}

.trend-down {
    background: rgba(248, 81, 73, 0.2);
    color: var(--negative);
}

.trend-strong-down {
    background: rgba(248, 81, 73, 0.3);
    color: var(--negative);
    border: 1px solid var(--negative);
}

.trend-flat {
    background: rgba(139, 148, 158, 0.2);
    color: var(--text-secondary);
}

footer {
    margin-top: 40px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* RSI Coloring */
.rsi-low {
    color: var(--positive);
    font-weight: bold;
}

/* Oversold - Buy opp? */
.rsi-high {
    color: var(--negative);
    font-weight: bold;
}

/* Overbought */

/* Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Filter Row */
.filter-row th {
    padding: 0.5rem;
    background-color: var(--card-bg);
}

.filter-row input {
    width: 100%;
    padding: 0.4rem;
    border: 1px solid #30363d;
    background-color: #0d1117;
    color: var(--text-primary);
    border-radius: 4px;
    font-size: 0.8rem;
    box-sizing: border-box;
}

.filter-row input:focus {
    border-color: var(--accent);
    outline: none;
}

/* Main Content Layout */
/* Main Content Layout - Stacked Vertically */
.main-content {
    display: flex;
    flex-direction: column;
    /* Stack table and bottom panels */
    gap: 20px;
    padding: 20px 0;
}

.table-container {
    flex: none;
    /* Take natural height or defined height */
    width: 100%;
    /* Full width */
    height: 50vh;
    /* Fixed height for table scroll */
    min-width: 0;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
}

/* Bottom Panels Container - Side by Side */
.bottom-panels {
    display: flex;
    gap: 20px;
    width: 100%;
}

/* Details Panel */
.details-panel {
    flex: 1;
    /* 50% width */
    background: #151922;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 24px;
    min-height: 250px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: 'Outfit', sans-serif;
    /* Removed sticky positioning as it is now at bottom */
}

.details-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 0;
    font-size: 1.1rem;
}

/* DP Header */
.dp-header {
    margin-bottom: 25px;
}

.dp-ticker-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}

.dp-ticker {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ff5555;
    /* Reddish like screenshot */
}

.dp-link-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.dp-name {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.dp-sector {
    font-size: 0.75rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.dp-price-row {
    display: flex;
    align-items: baseline;
    gap: 12px;
    flex-wrap: wrap;
}

.dp-price {
    font-size: 1.6rem;
    font-weight: 700;
    color: #fff;
}

.dp-change {
    font-size: 1.1rem;
    font-weight: 600;
}

.dp-target-group {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-left: auto;
}

/* DP Grid */
.dp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 25px;
}

.dp-metric {
    background: rgba(255, 255, 255, 0.03);
    padding: 10px;
    border-radius: 8px;
    text-align: center;
}

.dp-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.dp-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: #e0e0e0;
}

/* DP Footer */
.dp-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border);
    padding-top: 15px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dp-trends {
    display: flex;
    gap: 15px;
}

.dp-rating {
    display: flex;
    gap: 5px;
    align-items: center;
}

.stars {
    color: var(--warning);
}

.rating-text {
    color: var(--warning);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
}

/* Special Colors from screenshot approximation */
.val-pos-blue {
    color: #38bdf8;
    /* Light blue */
}

/* Selected Row in Table */
tr.selected-row {
    background-color: rgba(88, 166, 255, 0.15) !important;
}



/* Volatility Panel */
.volatility-panel {
    flex: 1;
    /* 50% width, side-by-side with details-panel */
    margin-top: 0;
    /* Remove top margin */
    background: #151922;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    font-family: 'Outfit', sans-serif;
    min-height: 250px;
}

.vp-header {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--negative);
    /* Red title "VOLATILITA" */
    text-transform: uppercase;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.vp-grid {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 25px;
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
}

.vp-card {
    text-align: center;
    flex: 1;
}

.vp-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.vp-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #fff;
}

.vp-sub {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 5px;
    text-transform: uppercase;
}

.vp-range-container {
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid var(--border);
}

.vp-range-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.vp-range-values {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.vp-range-mid {
    color: #fff;
    font-weight: 700;
}

.vp-range-arrow {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.vp-range-low {
    color: var(--negative);
}

.vp-range-high {
    color: var(--positive);
    /* Or blue */
}