:root {
    --bg-main: #0b0f19;
    --bg-surface: #151c2c;
    --bg-surface-hover: #1c263c;
    --border-color: #26334d;
    --border-focus: #38bdf8;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-blue: #38bdf8;
    --accent-blue-bg: rgba(56, 189, 248, 0.12);
    --positive: #10b981;
    --positive-bg: rgba(16, 185, 129, 0.12);
    --negative: #f43f5e;
    --negative-bg: rgba(244, 63, 94, 0.12);
    
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    
    --shadow-subtle: 0 4px 20px rgba(0, 0, 0, 0.35);
    --shadow-dropdown: 0 12px 32px rgba(0, 0, 0, 0.5);
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 40px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

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

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    box-shadow: 0 0 16px rgba(56, 189, 248, 0.3);
}

.brand-text h1 {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

.brand-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);

}

/* Search Box */
.search-wrapper {
    position: relative;
    width: 100%;
    max-width: 440px;
}

.search-input-box {
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

#searchInput {
    width: 100%;
    height: 44px;
    padding: 0 40px 0 42px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: all 0.2s ease;
}

#searchInput::placeholder {
    color: var(--text-muted);
}

#searchInput:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-blue-bg);
}

/* Spinner */
.spinner {
    position: absolute;
    right: 14px;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Autocomplete Dropdown */
.dropdown-list {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    max-height: 320px;
    overflow-y: auto;
    z-index: 100;
}

.dropdown-item {
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    transition: background 0.15s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.active {
    background: var(--bg-surface-hover);
}

.item-ticker {
    font-weight: 600;
    color: var(--accent-blue);
    font-size: 0.9rem;
    padding: 2px 6px;
    background: var(--accent-blue-bg);
    border-radius: 4px;
}

.item-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 260px;
}

.dropdown-no-results {
    padding: 14px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Welcome State */
.welcome-card {
    background: var(--bg-surface);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-lg);
    padding: 60px 20px;
    text-align: center;
    max-width: 540px;
    margin: 60px auto;
}

.welcome-icon {
    color: var(--accent-blue);
    margin-bottom: 16px;
    display: inline-block;
    padding: 16px;
    background: var(--accent-blue-bg);
    border-radius: 50%;
}

.welcome-card h2 {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.welcome-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Loader Overlay */
.loader-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 0;
    gap: 16px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.large-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-color);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Ticker Header Bar */
.ticker-header-bar {
    margin-bottom: 24px;
}

.ticker-identity {
    display: flex;
    align-items: center;
    gap: 12px;
}

.symbol-badge {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fff;
    background: linear-gradient(135deg, #0284c7, #38bdf8);
    padding: 4px 14px;
    border-radius: var(--radius-sm);
}

.company-fullname {
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Cards Grid */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.metric-card:hover {
    border-color: rgba(255, 255, 255, 0.15);
    transform: translateY(-2px);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.card-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card-period {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.05);
    padding: 2px 8px;
    border-radius: 12px;
}

.metric-value {
    font-size: 2.2rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 4px;
}

.metric-value.positive {
    color: var(--positive);
}

.metric-value.negative {
    color: var(--negative);
}

.metric-value.na {
    color: var(--text-muted);
    font-size: 1.8rem;
}

.metric-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Tables Section */
.tables-section {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.table-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-subtle);
}

.table-card-header {
    margin-bottom: 16px;
}

.table-card-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.table-subtitle {
    font-weight: 400;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    text-align: center;
}

.data-table th,
.data-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    white-space: nowrap;
}

.data-table th {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.data-table th:first-child,
.data-table td:first-child {
    text-align: left;
}

.row-label {
    font-weight: 700;
    color: var(--accent-blue);
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.val-pos {
    color: var(--positive);
    font-weight: 500;
}

.val-neg {
    color: var(--negative);
    font-weight: 500;
}

.val-na {
    color: var(--text-muted);
}

/* Empty Table Banner */
.table-empty {
    padding: 24px 0;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-style: italic;
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-md);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 640px) {
    .app-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-wrapper {
        max-width: 100%;
    }
    
    .metric-value {
        font-size: 1.8rem;
    }
}
