/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-tertiary: #94a3b8;
    --border-color: #e2e8f0;
    --sidebar-width: 280px;
    --sidebar-collapsed: 70px;
    --top-header-height: 80px;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);

    /* Factor Grade Colors */
    --grade-a-color: #10b981;
    --grade-b-color: #3b82f6;
    --grade-c-color: #f59e0b;
    --grade-d-color: #fb923c;
    --grade-e-color: #f87171;
    --grade-f-color: #ef4444;
    --grade-na-color: #94a3b8;
}

/* Dark Mode Variables */
body.dark-mode {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-secondary);
    min-height: 100vh;
    display: flex;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Sidebar Styles */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-color);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

.sidebar-logo {
    height: 35px;
    width: auto;
    object-fit: contain;
    transition: opacity 0.3s ease;
    display: block;
    flex-shrink: 0;
}

/* Ensure logo is visible in both light and dark modes */
.dark-mode .sidebar-logo {
    filter: brightness(0) invert(1);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .sidebar-branding {
    gap: 0;
}

.sidebar.collapsed .sidebar-logo {
    height: 30px;
}

.sidebar.collapsed .sidebar-title {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s, transform 0.3s;
}

.sidebar-toggle:hover {
    background: var(--bg-secondary);
}

.sidebar.collapsed .sidebar-toggle {
    transform: rotate(180deg);
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    margin: 0 10px;
    border-radius: 8px;
}

.nav-item:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.nav-item.active {
    background: var(--bg-tertiary);
    color: var(--primary-color);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    background: var(--primary-color);
    border-radius: 0 3px 3px 0;
}

.nav-icon {
    width: 24px;
    height: 24px;
    margin-right: 12px;
    flex-shrink: 0;
}

.nav-text {
    font-size: 15px;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.sidebar.collapsed .nav-text {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

.sidebar-footer {
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.theme-toggle {
    display: flex;
    justify-content: center;
}

.theme-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.theme-btn:hover {
    background: var(--bg-tertiary);
}

/* Theme icon visibility - icons will be controlled by JS, but set defaults */
.theme-btn .sun-icon,
.theme-btn .moon-icon {
    display: none; /* Hide both by default, JS will show the correct one */
}

/* Show moon icon in light mode by default (before JS loads) */
body.light-mode .theme-btn .moon-icon {
    display: block;
}

/* Show sun icon in dark mode */
body.dark-mode .theme-btn .sun-icon {
    display: block;
}

/* Main Wrapper */
.main-wrapper {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    max-width: calc(100vw - var(--sidebar-width));
    overflow-x: hidden;
}

.sidebar.collapsed + .main-wrapper {
    margin-left: var(--sidebar-collapsed);
    max-width: calc(100vw - var(--sidebar-collapsed));
}

/* Top Header */
.top-header {
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    height: var(--top-header-height);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.top-header .container {
    height: 100%;
}

.header-content {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.site-branding {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-right: 20px;
}

.site-logo {
    height: 45px;
    width: auto;
    object-fit: contain;
}

.site-name {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

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

.beta-badge {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-size: 11px;
    font-weight: 600;
    padding: 5px 12px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    white-space: nowrap;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    overflow-x: hidden;
    box-sizing: border-box;
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    margin-right: 15px;
}

/* Page Controls - Now inside Research Hub */
.page-controls {
    background: var(--bg-primary);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}

.controls {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.filter-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
}

.filter-select:hover {
    border-color: var(--primary-color);
}

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
    margin-left: auto;
}

.refresh-btn:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
}

.refresh-btn.refreshing svg {
    animation: spin 1s linear infinite;
}

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

/* View Toggle Buttons */
.view-toggle-group {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.view-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.view-toggle-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.view-toggle-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-sm);
}

.view-toggle-btn svg {
    stroke-width: 2;
}

/* Main Content */
.main-content {
    flex: 1;
    padding: 30px 0;
    margin-top: 0;
    overflow-x: hidden;
}

/* Page Styles */
.page {
    animation: fadeIn 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Companies Grid */
.companies-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 25px;
    justify-content: start;
}

/* Company Card - Updated with flexible height */
.company-card {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 
                0 2px 6px rgba(0, 0, 0, 0.1),
                0 1px 3px rgba(0, 0, 0, 0.08);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: visible;
    height: auto;
    min-height: 410px; /* Minimum height to accommodate factor grades */
    display: flex;
    flex-direction: column;
}

.company-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(37, 99, 235, 0.25), 
                0 12px 20px rgba(0, 0, 0, 0.2),
                0 4px 8px rgba(0, 0, 0, 0.15),
                0 0 0 2px rgba(37, 99, 235, 0.15);
}

/* Dark mode shadow adjustments */
body.dark-mode .company-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5), 
                0 2px 6px rgba(0, 0, 0, 0.4),
                0 1px 3px rgba(0, 0, 0, 0.3);
}

body.dark-mode .company-card:hover {
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.35), 
                0 12px 20px rgba(0, 0, 0, 0.6),
                0 4px 8px rgba(0, 0, 0, 0.4),
                0 0 0 2px rgba(59, 130, 246, 0.3);
}

.company-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6);
    opacity: 0;
    transition: opacity 0.3s;
}

.company-card:hover::before {
    opacity: 1;
}

/* Card Content - Flexible grow area */
.card-content {
    flex: 1;
    padding: 24px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

/* Card Header */
.card-header {
    display: flex;
    align-items: center;
    position: relative;
    min-height: 60px; /* Consistent header height */
}

.company-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    object-fit: cover;
    padding: 0;
    background: #334155;
    margin-right: 15px;
    flex-shrink: 0;
}

body.dark-mode .company-logo {
    background: #334155;
}

.company-info {
    flex: 1;
    min-width: 0; /* Allow text truncation */
}

.company-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    /* Truncate long names to 2 lines */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
    max-height: 2.6em; /* 2 lines max */
}

.company-ticker {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.company-updated {
    font-size: 11px;
    color: var(--text-tertiary);
}

/* Factor Grades Section (for company cards) */
.factor-grades-section {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding: 12px 0;
    margin-top: auto;
    border-top: 1px solid var(--border-color);
}

.factor-grade-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.factor-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
}

/* Updated Factor Grade Box Styling for Morningstar Integration */
.factor-grade-box {
    padding: 4px 11px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.5px;
    min-width: 65px;
    text-align: center;
    text-transform: capitalize;
}

/* Factor Grade Colors - Works for both letter grades and Moat values */
.factor-grade-box.grade-a,
.factor-grade-display.grade-a {
    background: rgba(16, 185, 129, 0.15);
    color: var(--grade-a-color);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.factor-grade-box.grade-b,
.factor-grade-display.grade-b {
    background: rgba(59, 130, 246, 0.15);
    color: var(--grade-b-color);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.factor-grade-box.grade-c,
.factor-grade-display.grade-c {
    background: rgba(245, 158, 11, 0.15);
    color: var(--grade-c-color);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.factor-grade-box.grade-d,
.factor-grade-display.grade-d {
    background: rgba(251, 146, 60, 0.15);
    color: var(--grade-d-color);
    border: 1px solid rgba(251, 146, 60, 0.3);
}

.factor-grade-box.grade-e,
.factor-grade-display.grade-e {
    background: rgba(248, 113, 113, 0.15);
    color: var(--grade-e-color);
    border: 1px solid rgba(248, 113, 113, 0.3);
}

.factor-grade-box.grade-f,
.factor-grade-display.grade-f {
    background: rgba(239, 68, 68, 0.15);
    color: var(--grade-f-color);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.factor-grade-box.grade-na,
.factor-grade-display.grade-na {
    background: rgba(148, 163, 184, 0.1);
    color: var(--grade-na-color);
    border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Factor Grades Section (for modal) */
.factor-grades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.factor-grade-card {
    background: var(--bg-secondary);
    border-radius: 10px;
    padding: 15px;
    text-align: center;
    transition: all 0.3s ease;
}

.factor-grade-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.factor-grade-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 10px;
}

.factor-icon {
    font-size: 18px;
}

.factor-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.factor-grade-display {
    width: 70px;
    height: 70px;
    margin: 0 auto 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border-width: 2px;
    border-style: solid;
    position: relative;
    transition: all 0.3s ease;
    font-size: 20px;
}

.factor-grade-display:hover {
    transform: scale(1.05);
}

.factor-grade-value {
    font-size: 19px;
    font-weight: 700;
}

.factor-description {
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Moat Score */
.moat-score {
    display: flex;
    align-items: center;
    gap: 10px;
}

.moat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.moat-value {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.moat-bar {
    flex: 1;
    max-width: 100px;
    height: 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    overflow: hidden;
}

.moat-fill {
    height: 100%;
    background: linear-gradient(90deg, #ef4444, #f59e0b, #10b981);
    transition: width 0.5s ease;
}

.moat-number {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    flex-shrink: 0;
}

/* Price Information */
.price-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.price-item {
    display: flex;
    flex-direction: column;
}

.price-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 4px;
    letter-spacing: 0.5px;
}

.price-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Upside/Downside - Always at bottom */
.upside-downside {
    padding: 15px 24px;
    background: var(--bg-secondary);
    border-radius: 0 0 12px 12px;
    text-align: center;
    margin-top: auto; /* Push to bottom */
    border-top: 1px solid var(--border-color);
}

.upside-label {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.upside-value {
    font-size: 26px;
    font-weight: 700;
}

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

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

/* Green arrow for targets */
.arrow-up {
    color: var(--success-color);
    font-size: 16px;
    margin-left: 5px;
    display: inline-block;
}

/* Row View Layout */
.companies-grid.row-view {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.companies-grid.row-view .company-card {
    height: auto;
    flex-direction: row;
    align-items: center;
    padding: 0;
}

.companies-grid.row-view .company-card:hover::before {
    height: 100%;
    width: 4px;
    right: auto;
}

.companies-grid.row-view .card-content {
    flex-direction: row;
    align-items: center;
    padding: 16px 20px;
    gap: 24px;
    flex: 1;
}

.companies-grid.row-view .card-header {
    min-width: 280px;
    max-width: 280px;
    min-height: auto;
}

.companies-grid.row-view .company-logo {
    width: 48px;
    height: 48px;
    padding: 0;
    margin-right: 12px;
}

.companies-grid.row-view .company-name {
    font-size: 14px;
    -webkit-line-clamp: 1;
    max-height: 1.3em;
}

.companies-grid.row-view .company-ticker {
    font-size: 13px;
}

.companies-grid.row-view .company-updated {
    font-size: 10px;
}

.companies-grid.row-view .moat-score {
    min-width: 180px;
    flex-shrink: 0;
}

.companies-grid.row-view .moat-bar {
    max-width: 80px;
}

.companies-grid.row-view .price-info {
    display: flex;
    gap: 20px;
    min-width: 200px;
    flex-shrink: 0;
}

.companies-grid.row-view .price-item {
    flex-direction: column;
}

.companies-grid.row-view .price-label {
    font-size: 10px;
    margin-bottom: 2px;
}

.companies-grid.row-view .price-value {
    font-size: 15px;
}

.companies-grid.row-view .factor-grades-section {
    border-top: none;
    padding: 0;
    margin-top: 0;
    min-width: 170px;
    flex-shrink: 0;
}

.companies-grid.row-view .factor-grade-box {
    padding: 3px 8px;
    font-size: 11px;
    min-width: 55px;
}

.companies-grid.row-view .factor-label {
    font-size: 11px;
}

.companies-grid.row-view .upside-downside {
    border-radius: 0 12px 12px 0;
    padding: 12px 20px;
    min-width: 130px;
    border-top: none;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.companies-grid.row-view .upside-label {
    font-size: 10px;
    margin-bottom: 4px;
}

.companies-grid.row-view .upside-value {
    font-size: 20px;
}

/* Row view responsive adjustments */
@media (max-width: 1200px) {
    .companies-grid.row-view .card-header {
        min-width: 220px;
        max-width: 220px;
    }

    .companies-grid.row-view .moat-score {
        min-width: 150px;
    }

    .companies-grid.row-view .price-info {
        min-width: 170px;
    }

    .companies-grid.row-view .factor-grades-section {
        min-width: 150px;
    }
}

@media (max-width: 1024px) {
    .companies-grid.row-view .card-content {
        flex-wrap: wrap;
        gap: 16px;
    }

    .companies-grid.row-view .card-header {
        min-width: 200px;
        max-width: none;
        flex: 1 1 200px;
    }

    .companies-grid.row-view .moat-score {
        min-width: auto;
        flex: 1 1 150px;
    }

    .companies-grid.row-view .price-info {
        min-width: auto;
        flex: 1 1 150px;
    }

    .companies-grid.row-view .factor-grades-section {
        min-width: auto;
        flex: 1 1 150px;
    }
}

@media (max-width: 768px) {
    .companies-grid.row-view .company-card {
        flex-direction: column;
    }

    .companies-grid.row-view .card-content {
        flex-direction: column;
        align-items: stretch;
    }

    .companies-grid.row-view .card-header {
        max-width: none;
    }

    .companies-grid.row-view .upside-downside {
        border-radius: 0 0 12px 12px;
        border-left: none;
        border-top: 1px solid var(--border-color);
    }

    .view-toggle-group {
        display: none;
    }
}

/* Fundamentals Page */
.fundamentals-container {
    padding: 20px;
}

/* Search Section */
.search-section {
    margin-bottom: 30px;
}

.search-wrapper {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
}

.search-input {
    width: 100%;
    padding: 12px 45px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    margin-top: 5px;
    max-height: 300px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    box-shadow: var(--shadow-lg);
}

.search-result-item {
    display: flex;
    align-items: center;
    padding: 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:hover {
    background: var(--bg-secondary);
}

.search-result-item img {
    width: 32px;
    height: 32px;
    margin-right: 12px;
    border-radius: 6px;
    object-fit: cover;
    padding: 0;
    background: #334155;
}

.search-result-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.search-result-ticker {
    font-size: 12px;
    color: var(--text-secondary);
}

.search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-secondary);
}

/* Logo Banner */
.logo-banner-wrapper {
    position: relative;
    margin-bottom: 30px;
}

.logo-banner {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    padding: 10px 0;
}

.logo-banner::-webkit-scrollbar {
    height: 8px;
}

.logo-banner::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.logo-banner::-webkit-scrollbar-thumb {
    background: var(--text-tertiary);
    border-radius: 4px;
}

.logo-track {
    display: flex;
    gap: 16px;
    padding: 0 50px;
}

.logo-item {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.logo-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    transition: all 0.3s ease;
}

body.dark-mode .logo-item {
    background: var(--bg-tertiary);
}

.logo-item:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.logo-item.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.4);
}

.banner-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.banner-nav:hover {
    background: var(--bg-tertiary);
}

.banner-nav-prev {
    left: 5px;
}

.banner-nav-next {
    right: 5px;
}

/* Selected Company Name */
.selected-company-name {
    text-align: center;
    margin-bottom: 30px;
}

.selected-company-name h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Fundamentals Charts */
.fundamentals-charts {
    /* Charts will be styled same as modal charts */
}

/* Under Construction */
.under-construction {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-secondary);
}

.construction-icon {
    opacity: 0.3;
    margin-bottom: 20px;
}

.under-construction h2 {
    font-size: 28px;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.under-construction p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Loading & Empty States */
.loading-state,
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.spinner {
    width: 40px;
    height: 40px;
    margin: 0 auto 20px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Refresh Indicator - Subtle floating indicator for background refreshes */
.refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 10px 16px;
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    font-size: 13px;
    font-weight: 500;
    animation: slideInFromRight 0.3s ease-out;
    border: 1px solid var(--border-color);
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.refresh-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Dark mode adjustments for refresh indicator */
body.dark-mode .refresh-indicator {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Mobile adjustments for refresh indicator */
@media (max-width: 768px) {
    .refresh-indicator {
        top: 10px;
        right: 10px;
        padding: 8px 12px;
        font-size: 12px;
    }

    .refresh-spinner {
        width: 14px;
        height: 14px;
    }
}

/* ===================================
   Skeleton Loaders
   =================================== */

.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
    background: linear-gradient(
        90deg,
        var(--bg-secondary) 25%,
        var(--bg-tertiary) 50%,
        var(--bg-secondary) 75%
    );
    background-size: 200% 100%;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Card Skeleton */
.card-skeleton {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    min-height: 410px;
}

.skeleton-header {
    display: flex;
    gap: 15px;
    margin-bottom: 24px;
}

.skeleton-logo {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    flex-shrink: 0;
}

.skeleton-logo.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-text {
    flex: 1;
    min-width: 0;
}

.skeleton-line {
    height: 14px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-line.title {
    width: 70%;
    height: 18px;
    margin-bottom: 8px;
}

.skeleton-line.subtitle {
    width: 40%;
    height: 12px;
}

.skeleton-line.full {
    width: 100%;
    margin: 20px 0;
}

.skeleton-line.large {
    width: 80%;
}

.skeleton-line.medium {
    width: 60%;
}

.skeleton-moat-bar {
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    margin: 16px 0;
}

.skeleton-moat-bar.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-price-section {
    display: flex;
    gap: 20px;
    margin: 16px 0;
}

.skeleton-price-item {
    flex: 1;
}

.skeleton-price-label {
    height: 12px;
    width: 60%;
    background: var(--bg-tertiary);
    border-radius: 4px;
    margin-bottom: 8px;
}

.skeleton-price-label.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-price-value {
    height: 18px;
    width: 80%;
    background: var(--bg-tertiary);
    border-radius: 4px;
}

.skeleton-price-value.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

.skeleton-grades {
    display: flex;
    gap: 12px;
    margin: 16px 0;
}

.skeleton-grade {
    flex: 1;
    height: 40px;
    background: var(--bg-tertiary);
    border-radius: 8px;
}

.skeleton-grade.skeleton-loader {
    animation: skeleton-loading 1.5s infinite ease-in-out;
}

/* Dark mode adjustments */
body.dark-mode .card-skeleton {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--bg-primary);
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    position: relative;
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: 300;
    cursor: pointer;
    z-index: 1001;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 50%;
    transition: background 0.2s;
}

.close-modal:hover {
    background: var(--border-color);
}

.modal-body {
    padding: 30px;
}

/* Modal Header */
.modal-header {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.modal-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.modal-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Tabs */
.modal-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
}

.tab-button {
    background: none;
    border: none;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.tab-button:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.tab-button.active {
    color: var(--primary-color);
    font-weight: 600;
}

.tab-button.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--primary-color);
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

/* Research Section */
.research-section {
    margin-bottom: 30px;
}

.research-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.research-content {
    color: var(--text-secondary);
    line-height: 1.8;
    white-space: pre-wrap;
}

.research-content .bullet-list {
    margin: 0;
    padding-left: 0;
    list-style: none;
}

.research-content .bullet-list li {
    position: relative;
    padding-left: 25px;
    margin-bottom: 12px;
    line-height: 1.7;
}

.research-content .bullet-list li::before {
    content: '•';
    position: absolute;
    left: 8px;
    color: var(--primary-color);
    font-weight: bold;
    font-size: 18px;
}

/* Enhanced Financial Metrics */
.financial-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    padding: 25px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 30px;
}

.metric-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.metric-group h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}

.metric-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--bg-primary);
    border-radius: 8px;
    transition: all 0.2s;
}

.metric-row:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px);
}

.metric-icon {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.metric-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 140px;
}

.metric-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: auto;
    display: flex;
    align-items: center;
}

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

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

/* Charts Section */
.charts-container {
    display: grid;
    gap: 30px;
}

.chart-wrapper {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    max-height: 350px;
    overflow: hidden;
}

.chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chart-loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.chart-canvas {
    max-height: 250px !important;
    width: 100% !important;
}

/* Financial Charts Grid - New 11 Charts Layout */
.financial-charts-grid {
    display: flex;
    flex-direction: column;
    gap: 24px;
    width: 100%;
}

.financial-chart-wrapper {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    width: 100%;
}

.financial-chart-wrapper.full-width {
    width: 100%;
}

.financial-chart-wrapper canvas {
    width: 100% !important;
    height: 350px !important;
}

.chart-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.chart-header-row .chart-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.period-toggle {
    display: flex;
    gap: 4px;
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: 8px;
}

.period-toggle .period-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.period-toggle .period-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.period-toggle .period-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.3);
}

.period-toggle-placeholder {
    width: 80px;
    height: 32px;
}

/* Health Scores Centered Layout Styles */
.health-scores-container {
    min-height: auto;
}

.health-scores-centered-layout {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.health-chart-panel {
    display: flex;
    flex-direction: column;
    position: relative;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.health-chart-panel.centered {
    width: 100%;
    max-width: 600px;
}

.health-chart-panel:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
    transform: translateY(-2px);
}

.health-chart-panel .panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.health-chart-panel canvas {
    width: 100% !important;
    height: 320px !important;
}

.health-chart-panel .chart-loading {
    text-align: center;
    padding: 120px 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* Rating badge styles */
.rating-badge-container {
    position: absolute;
    top: 16px;
    left: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    z-index: 10;
}

.rating-badge-container .rating-letter {
    font-size: 28px;
    font-weight: 700;
    color: #6366f1;
    line-height: 1;
    text-shadow: 0 2px 4px rgba(99, 102, 241, 0.2);
}

.rating-badge-container .rating-recommendation {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Dark mode rating badge */
body.dark-mode .rating-badge-container .rating-letter {
    color: #818cf8;
}

body.dark-mode .rating-badge-container .rating-recommendation {
    background: var(--bg-primary);
}

/* Footer with score definitions */
.health-scores-footer {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.footer-asterisk {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.footer-definitions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    font-size: 10px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.footer-definitions span {
    white-space: nowrap;
}

.footer-definitions strong {
    color: var(--text-secondary);
    font-weight: 500;
}

/* Dark mode for health scores */
body.dark-mode .health-chart-panel {
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border-color: var(--border-color);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2), 0 2px 4px -1px rgba(0, 0, 0, 0.1);
}

body.dark-mode .health-chart-panel:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
}

body.dark-mode .footer-definitions strong {
    color: var(--text-primary);
}

/* Responsive for health scores */
@media (max-width: 768px) {
    .health-chart-panel.centered {
        max-width: 100%;
    }

    .health-chart-panel canvas {
        height: 280px !important;
    }
}

@media (max-width: 480px) {
    .health-chart-panel {
        padding: 16px;
        border-radius: 12px;
    }

    .health-chart-panel canvas {
        height: 240px !important;
    }

    .footer-definitions {
        font-size: 9px;
        gap: 4px 12px;
    }
}

/* Chart loading state for financial charts */
.financial-chart-wrapper .chart-loading {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Dark mode adjustments for financial charts */
body.dark-mode .financial-chart-wrapper {
    background: var(--bg-secondary);
    border-color: var(--border-color);
}

body.dark-mode .period-toggle {
    background: var(--bg-tertiary);
}

body.dark-mode .period-toggle .period-btn:hover {
    background: var(--bg-primary);
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .financial-chart-wrapper {
        padding: 16px;
    }

    .financial-chart-wrapper canvas {
        height: 280px !important;
    }

    .chart-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .chart-header-row .chart-title {
        font-size: 14px;
    }

    .period-toggle .period-btn {
        padding: 4px 8px;
        font-size: 11px;
    }
}

/* Metrics Grid */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.metric-item {
    padding: 15px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

/* Company Profile */
.company-profile {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.profile-header {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.profile-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.profile-section {
    margin-bottom: 20px;
}

.profile-section h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 10px;
}

/* Footer */
.footer {
    background: var(--bg-primary);
    border-top: 1px solid var(--border-color);
    padding: 30px 0;
    margin-top: auto;
}

.disclaimer {
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 20px;
}

.disclaimer p {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
    margin-bottom: 10px;
}

.disclaimer p:last-child {
    margin-bottom: 0;
}

.disclaimer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.ai-notice {
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-style: italic;
}

.copyright {
    text-align: center;
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-wrapper {
        margin-left: 0;
    }

    .menu-toggle {
        display: block;
    }

    .companies-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 260px));
        justify-content: start;
    }

    /* Adjust card height on tablets */
    .company-card {
        height: auto;
        min-height: 390px;
    }

    .factor-grades-section {
        padding: 10px 0;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-group {
        width: 100%;
    }

    .filter-select {
        width: 100%;
    }

    .companies-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        margin: 20px;
    }

    .financial-metrics {
        grid-template-columns: 1fr;
    }

    /* Keep card height flexible on mobile */
    .company-card {
        height: auto;
        min-height: 380px;
    }

    .factor-grades-grid {
        grid-template-columns: 1fr;
    }

    .factor-grades-section {
        gap: 10px;
        flex-direction: column;
        align-items: center;
    }

    .factor-grade-item {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .company-card {
        height: auto;
        min-height: 380px;
    }

    .card-content {
        padding: 20px 20px 16px;
        gap: 15px;
    }

    .price-info {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-tabs {
        flex-wrap: wrap;
    }

    .tab-button {
        flex: 1;
        min-width: 120px;
    }

    .factor-grade-display {
        width: 45px;
        height: 45px;
    }

    .factor-grade-value {
        font-size: 20px;
    }
}


/* Fundamentals Placeholder Styles */
.fundamentals-placeholder {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.5s ease;
}

.fundamentals-placeholder .placeholder-icon {
    opacity: 0.3;
    margin: 0 auto 25px;
    color: var(--text-secondary);
}

.fundamentals-placeholder h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.fundamentals-placeholder p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Price Display in Company Name Header */
.price-display {
    font-size: 0.7em;
    font-weight: 500;
    margin-left: 10px;
    color: var(--text-secondary);
}

.price-positive {
    color: #10b981;
    font-weight: 600;
}

.price-negative {
    color: #ef4444;
    font-weight: 600;
}

.price-loading {
    font-size: 0.6em;
    color: var(--text-tertiary);
    font-style: italic;
    font-weight: 400;
}

/* Financials Price Display */
.financials-price-display {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.financials-price-display .price-positive,
.financials-price-display .price-negative {
    font-size: 14px;
}

/* Search Bar Pulse Animation */
.search-section.pulse-animation .search-wrapper {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 0 15px rgba(37, 99, 235, 0);
        transform: scale(1.02);
    }
}

/* Enhanced Search Wrapper */
.search-wrapper {
    transition: all 0.3s ease;
    border-radius: 12px;
}
/* Clear Search Button */
.clear-search-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 5px 8px;
    font-size: 24px;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clear-search-btn:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

/* Update search input padding */
.search-input {
    padding: 12px 45px 12px 45px; /* Add right padding for clear button */
}

/* ===================================
   News Byte Page - Coming Soon
   =================================== */

.news-byte-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - var(--top-header-height) - 100px);
    padding: 40px 20px;
}

.coming-soon-wrapper {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}

.coming-soon-content {
    background: var(--bg-primary);
    border-radius: 24px;
    padding: 60px 40px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
}

.newspaper-icon {
    color: var(--primary-color);
    margin: 0 auto 30px;
    display: block;
    opacity: 0.9;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

.coming-soon-title {
    font-size: 48px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 10px;
    letter-spacing: 1px;
}

.coming-soon-subtitle {
    font-size: 28px;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 24px;
    letter-spacing: 2px;
}

.coming-soon-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
    max-width: 480px;
    margin: 0 auto;
}

/* Dark mode adjustments */
body.dark-mode .coming-soon-content {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Responsive */
@media (max-width: 768px) {
    .coming-soon-content {
        padding: 40px 24px;
    }

    .newspaper-icon {
        width: 80px;
        height: 80px;
    }

    .coming-soon-title {
        font-size: 36px;
    }

    .coming-soon-subtitle {
        font-size: 22px;
    }

    .coming-soon-description {
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .coming-soon-content {
        padding: 30px 20px;
    }

    .newspaper-icon {
        width: 60px;
        height: 60px;
    }

    .coming-soon-title {
        font-size: 28px;
    }

    .coming-soon-subtitle {
        font-size: 18px;
    }
}

/* ===== Settings Page Styles ===== */
.settings-container {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.page-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.settings-content {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

/* Settings Sidebar Navigation */
.settings-sidebar {
    flex: 0 0 250px;
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.settings-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    cursor: pointer;
    font-weight: 500;
}

.settings-nav-link:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.settings-nav-link.active {
    background: var(--primary-color);
    color: white;
}

.settings-nav-link.active .settings-icon {
    stroke: white;
}

.settings-icon {
    stroke: currentColor;
    flex-shrink: 0;
}

/* Settings Main Content */
.settings-main {
    flex: 1;
    min-width: 0;
}

.settings-section {
    display: none;
}

.settings-section.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.settings-card {
    background: var(--bg-primary);
    border-radius: 12px;
    padding: 30px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
}

.settings-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

/* About Us Styles */
.about-content {
    line-height: 1.8;
}

.about-hero {
    text-align: center;
    margin-bottom: 20px;
}

.about-icon {
    stroke: var(--primary-color);
    margin: 0 auto;
}

.about-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.lead-text {
    font-size: 18px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 30px;
}

.about-section {
    margin-bottom: 30px;
}

.about-section h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.about-section p {
    color: var(--text-secondary);
    line-height: 1.8;
}

.feature-list {
    list-style: none;
    padding: 0;
    margin: 15px 0;
}

.feature-list li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    color: var(--text-secondary);
}

.feature-list li svg {
    stroke: var(--success-color);
    flex-shrink: 0;
    margin-top: 4px;
}

.about-footer {
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.version-info {
    color: var(--text-tertiary);
    font-size: 14px;
}

/* Help Center Styles */
.help-content {
    line-height: 1.8;
}

.help-hero {
    text-align: center;
    margin-bottom: 20px;
}

.help-icon {
    stroke: var(--primary-color);
    margin: 0 auto;
}

.help-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.help-section {
    margin-bottom: 30px;
}

.help-section h4 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

.faq-item {
    margin-bottom: 20px;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.faq-item h5 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.faq-item p {
    color: var(--text-secondary);
    line-height: 1.7;
}

.help-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.help-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.help-link:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.help-link svg {
    stroke: white;
    flex-shrink: 0;
}

/* Settings Header with Theme Toggle */
.settings-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 10px;
}

.settings-header .page-title {
    margin-bottom: 0;
}

.settings-theme-toggle {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: 2px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.settings-theme-toggle:hover {
    background: var(--bg-secondary);
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* Contact Us Styles */
.contact-content {
    line-height: 1.8;
}

.contact-hero {
    text-align: center;
    margin-bottom: 20px;
}

.contact-icon {
    stroke: var(--primary-color);
    margin: 0 auto;
}

.contact-content h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 8px;
}

.contact-form {
    max-width: 600px;
    margin: 0 auto 40px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
    font-size: 14px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s ease;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
    font-style: italic;
}

.contact-submit-btn {
    width: 100%;
    padding: 14px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.contact-submit-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.contact-submit-btn:active {
    transform: translateY(0);
}

/* Contact Email Section */
.contact-email-section {
    max-width: 500px;
    margin: 40px auto 20px;
    text-align: center;
    padding: 30px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.email-label {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.email-address {
    display: block;
    font-size: 22px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    margin-bottom: 24px;
    transition: all 0.2s ease;
}

.email-address:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.email-btn {
    display: inline-flex;
    width: auto;
    padding: 14px 32px;
    text-decoration: none;
}

.contact-info-section {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid var(--border-color);
}

.contact-info-section h4 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.contact-info-section p {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.contact-methods {
    list-style: none;
    padding: 0;
}

.contact-methods li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-bottom: 10px;
}

.contact-methods svg {
    stroke: var(--primary-color);
    flex-shrink: 0;
}

.contact-detail {
    color: var(--text-secondary);
    font-style: italic;
}

/* Financials Page Styles */
.financials-container {
    padding: 20px;
}

.financials-selected-company {
    max-width: 1200px;
    margin: 30px auto 0;
}

.financials-company-header {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 24px;
}

.financials-company-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    padding: 0;
    background: #334155;
}

body.dark-mode .financials-company-logo {
    background: #334155;
}

.financials-company-info {
    flex: 1;
}

.financials-company-name {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
}

.financials-company-price {
    font-size: 20px;
    font-weight: 500;
    color: var(--success-color);
}

.financials-tabs {
    display: flex;
    gap: 8px;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 24px;
}

.financials-tab {
    padding: 12px 24px;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.financials-tab:hover {
    color: var(--text-primary);
}

.financials-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.financials-tab-content {
    min-height: 400px;
}

.financials-tab-panel {
    display: none;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: 12px;
}

.financials-tab-panel.active {
    display: block;
}

/* Balance Sheet Styles */
.balance-sheet-controls,
.income-statement-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px 20px;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.control-group.ml-auto {
    margin-left: auto;
}

.control-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
}

.button-group {
    display: flex;
    gap: 0;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.unit-btn,
.period-btn,
.income-unit-btn,
.income-period-btn,
.cashflow-unit-btn,
.cashflow-period-btn {
    padding: 6px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: none;
    border-right: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.2s ease;
}

.unit-btn:last-child,
.period-btn:last-child,
.income-unit-btn:last-child,
.income-period-btn:last-child,
.cashflow-unit-btn:last-child,
.cashflow-period-btn:last-child {
    border-right: none;
}

.unit-btn:hover,
.period-btn:hover,
.income-unit-btn:hover,
.income-period-btn:hover,
.cashflow-unit-btn:hover,
.cashflow-period-btn:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.unit-btn.active,
.period-btn.active,
.income-unit-btn.active,
.income-period-btn.active,
.cashflow-unit-btn.active,
.cashflow-period-btn.active {
    background: var(--primary-color);
    color: white;
}

.toggle-btn,
.download-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.toggle-btn:hover,
.download-btn:hover {
    background: var(--bg-tertiary);
    border-color: var(--primary-color);
}

.download-btn {
    color: white;
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.download-btn:hover {
    background: #1d4ed8;
    border-color: #1d4ed8;
}

.balance-sheet-table-container,
.income-statement-table-container {
    overflow-x: auto;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.balance-sheet-table,
.income-statement-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.balance-sheet-table thead,
.income-statement-table thead {
    background: var(--bg-tertiary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.balance-sheet-table th,
.income-statement-table th {
    padding: 12px 16px;
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
}

.balance-sheet-table th:first-child,
.income-statement-table th:first-child {
    text-align: left;
    position: sticky;
    left: 0;
    background: var(--bg-tertiary);
    z-index: 11;
}

.balance-sheet-table td,
.income-statement-table td {
    padding: 12px 16px;
    text-align: right;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
}

.balance-sheet-table td:first-child,
.income-statement-table td:first-child {
    text-align: left;
    font-weight: 500;
    position: sticky;
    left: 0;
    background: var(--bg-primary);
    z-index: 10;
}

/* Alternating row colors - odd rows darker */
.balance-sheet-table tbody tr:nth-child(odd),
.income-statement-table tbody tr:nth-child(odd) {
    background: rgba(0, 0, 0, 0.02);
}

body.dark-mode .balance-sheet-table tbody tr:nth-child(odd),
body.dark-mode .income-statement-table tbody tr:nth-child(odd) {
    background: rgba(255, 255, 255, 0.02);
}

.balance-sheet-table tbody tr:nth-child(odd) td:first-child,
.income-statement-table tbody tr:nth-child(odd) td:first-child {
    background: var(--bg-secondary);
}

body.dark-mode .balance-sheet-table tbody tr:nth-child(odd) td:first-child,
body.dark-mode .income-statement-table tbody tr:nth-child(odd) td:first-child {
    background: var(--bg-secondary);
}

.balance-sheet-table tbody tr:hover,
.income-statement-table tbody tr:hover {
    background: var(--bg-tertiary) !important;
}

.balance-sheet-table tbody tr:hover td:first-child,
.income-statement-table tbody tr:hover td:first-child {
    background: var(--bg-tertiary) !important;
}

.metric-checkbox,
.income-metric-checkbox,
.cashflow-metric-checkbox {
    margin-right: 8px;
    cursor: pointer;
    width: 16px;
    height: 16px;
    accent-color: var(--primary-color);
}

.metric-name {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.balance-sheet-chart-container,
.income-statement-chart-container {
    background: var(--bg-primary);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-top: 0;
    margin-bottom: 20px;
}

#balanceChartContainer {
    margin-top: 0;
}

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

.chart-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.chart-close-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-close-btn:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.balance-sheet-chart-container canvas,
.income-statement-chart-container canvas {
    max-height: 400px;
}

/* Metric Controls */
.balance-metric-controls {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.metric-control-line {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.metric-control-line:last-child {
    margin-bottom: 0;
}

.metric-control-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.metric-control-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.metric-chart-type-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.metric-chart-type-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.metric-chart-type-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.metric-remove-btn {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 6px;
}

.metric-remove-btn:hover {
    background: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

/* Sub-table */
.sub-table-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
}

/* Financials Placeholder */
.financials-placeholder {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.5s ease;
}

.financials-placeholder .placeholder-icon {
    opacity: 0.3;
    margin: 0 auto 25px;
    color: var(--text-secondary);
}

.financials-placeholder h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.financials-placeholder p {
    font-size: 16px;
    color: var(--text-secondary);
}

/* Settings Navigation in Sidebar Footer */
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
    border-top: 1px solid var(--border-color);
}

.settings-nav-item {
    width: 100%;
    margin-bottom: 15px;
}

/* Responsive Settings */
@media (max-width: 768px) {
    .settings-header {
        flex-wrap: wrap;
    }

    .settings-content {
        flex-direction: column;
    }

    .settings-sidebar {
        flex: 1;
        width: 100%;
    }

    .settings-nav {
        flex-direction: row;
        overflow-x: auto;
    }

    .settings-nav-link {
        white-space: nowrap;
    }

    .settings-container {
        padding: 20px;
    }

    .settings-card {
        padding: 20px;
    }

    .help-actions {
        flex-direction: column;
    }

    .help-link {
        width: 100%;
        justify-content: center;
    }

    .contact-form {
        max-width: 100%;
    }
}

/* Balance Sheet Hierarchical Styles */
.expand-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    margin-right: 8px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.expand-btn:hover {
    background: #1d4ed8;
    transform: scale(1.1);
}

.expand-placeholder {
    display: inline-block;
    width: 20px;
    margin-right: 8px;
    flex-shrink: 0;
}

.parent-row {
    font-weight: 600;
}

.parent-row td:first-child {
    background: var(--bg-secondary) !important;
}

body.dark-mode .parent-row td:first-child {
    background: var(--bg-tertiary) !important;
}

/* Child row styling with subtle indentation visual */
.balance-sheet-table tbody tr[data-parent] .metric-name,
.income-statement-table tbody tr[data-parent] .metric-name {
    color: var(--text-secondary);
    font-weight: 400;
}

/* =================================
   Company Profile Tab Styles
   ================================= */

/* Loading state */
.profile-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.profile-loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

.profile-error {
    color: var(--danger-color);
    text-align: center;
    padding: 40px;
}

/* Profile Header Section */
.profile-header-section {
    margin-bottom: 24px;
}

.profile-company-banner {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 24px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.profile-company-logo {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 12px;
    background: #334155;
    padding: 0;
    box-shadow: var(--shadow-md);
}

body.dark-mode .profile-company-logo {
    background: #334155;
}

.profile-company-title {
    flex: 1;
}

.profile-company-name {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.profile-exchange-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--primary-color);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Price Banner */
.profile-price-banner {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 16px;
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.profile-price-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.profile-current-price {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.profile-current-price .price-label {
    font-size: 12px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.profile-current-price .price-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.profile-current-price .price-change {
    font-size: 14px;
    font-weight: 600;
}

.profile-current-price .price-change.positive {
    color: var(--success-color);
}

.profile-current-price .price-change.negative {
    color: var(--danger-color);
}

.profile-price-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.profile-stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.profile-stat-item .stat-label {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.profile-stat-item .stat-value {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.profile-stat-item .stat-value.highlight-high {
    color: var(--success-color);
}

.profile-stat-item .stat-value.highlight-low {
    color: var(--danger-color);
}

/* Profile Section */
.profile-section {
    margin-bottom: 24px;
}

.profile-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.profile-description {
    font-size: 14px;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0;
    text-align: justify;
}

/* Details Grid */
.profile-details-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

.profile-details-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    padding: 20px;
}

.profile-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.profile-info-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-info-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.profile-info-item .info-label {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.profile-info-item .info-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
    max-width: 60%;
    word-break: break-word;
}

.profile-link {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

.profile-link:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

/* Responsive adjustments for profile tab */
@media (max-width: 768px) {
    .profile-company-banner {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }

    .profile-company-name {
        font-size: 22px;
    }

    .profile-price-banner {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .profile-price-main {
        text-align: center;
    }

    .profile-current-price .price-value {
        font-size: 28px;
    }

    .profile-price-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .profile-details-grid {
        grid-template-columns: 1fr;
    }
}
/* ===================================
   Super Investors Page Styles
   =================================== */

/* Container */
.super-investors-container {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* Page Header */
.super-investors-header {
    text-align: center;
    margin-bottom: 40px;
}

.super-investors-title {
    font-size: 56px;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 4px;
    text-transform: uppercase;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.super-investors-subtitle {
    font-size: 20px;
    font-weight: 500;
    color: var(--text-secondary);
    margin: 10px 0 0;
    letter-spacing: 2px;
}

/* Main Layout */
.super-investors-main {
    display: flex;
    gap: 30px;
    align-items: flex-start;
}

.super-investors-content-area {
    flex: 1;
    min-width: 0;
}

/* Controls */
.super-investors-controls {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 20px;
}

/* Quote Section */
.super-investors-quote {
    width: 280px;
    flex-shrink: 0;
    position: sticky;
    top: 100px;
}

.quote-content {
    background: var(--bg-primary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary-color);
}

.quote-icon {
    color: var(--primary-color);
    opacity: 0.3;
    margin-bottom: 12px;
}

.quote-text {
    font-size: 15px;
    font-style: italic;
    line-height: 1.7;
    color: var(--text-secondary);
    margin: 0 0 16px;
}

.quote-author {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    text-align: right;
}

/* Table Styles */
.super-investors-table-container {
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.super-investors-table {
    width: 100%;
    border-collapse: collapse;
}

.super-investors-table th {
    padding: 16px 20px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-secondary);
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
}

.super-investors-table th:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.super-investors-table th .sort-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0.3;
}

.super-investors-table th .sort-icon::before {
    content: '↕';
    font-size: 12px;
}

.super-investors-table th.sorted-asc .sort-icon::before {
    content: '↑';
}

.super-investors-table th.sorted-desc .sort-icon::before {
    content: '↓';
}

.super-investors-table th.sorted-asc .sort-icon,
.super-investors-table th.sorted-desc .sort-icon {
    opacity: 1;
    color: var(--primary-color);
}

.super-investors-table td {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-primary);
}

.investor-row {
    cursor: pointer;
    transition: all 0.2s ease;
}

.investor-row:hover {
    background: var(--bg-secondary);
}

.investor-row:hover td {
    background: var(--bg-secondary);
}

/* Investor Cell */
.investor-cell {
    min-width: 300px;
}

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

.investor-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-secondary);
    flex-shrink: 0;
}

.investor-details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.investor-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}

.fund-name {
    font-size: 12px;
    color: var(--text-tertiary);
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Other Table Cells */
.stocks-cell {
    font-weight: 600;
    text-align: center;
}

.portfolio-cell {
    font-weight: 600;
    color: var(--success-color);
}

.quarter-cell {
    color: var(--text-secondary);
    font-weight: 500;
}

.updated-cell {
    color: var(--text-secondary);
}

/* Grid View */
.super-investors-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 24px;
    justify-content: center;
}

/* Investor Card */
.investor-card {
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
}

.investor-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-color);
}

.investor-card-chart {
    position: relative;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--bg-secondary);
}

.pie-chart-container {
    position: relative;
    width: 180px;
    height: 180px;
}

.pie-chart-container canvas {
    width: 100% !important;
    height: 100% !important;
}

.investor-image-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80px;
    height: 80px;
    border-radius: 50%;
    overflow: hidden;
    background: var(--bg-primary);
    box-shadow: var(--shadow-md);
    border: 3px solid var(--bg-primary);
}

.investor-image-overlay img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.position-tooltip {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-primary);
    padding: 8px 12px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    text-align: center;
    display: none;
    z-index: 10;
    max-width: 200px;
    border: 1px solid var(--border-color);
}

.investor-card-info {
    padding: 20px;
}

.investor-card-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.investor-card-quarter {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-left: auto;
}

.investor-card-fund {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 0 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.investor-card-stats {
    display: flex;
    gap: 12px;
}

.investor-card-stats .stat {
    flex: 1;
    text-align: center;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.investor-card-stats .stat-label {
    display: block;
    font-size: 10px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.investor-card-stats .stat-value {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Loading & Error States */
.super-investors-loading,
.super-investors-error {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.super-investors-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
}

.super-investors-loading p,
.super-investors-error p {
    color: var(--text-secondary);
    font-size: 16px;
}

.super-investors-error svg {
    opacity: 0.3;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.super-investors-error h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.retry-btn {
    margin-top: 20px;
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.retry-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

/* Responsive Styles for Super Investors */
@media (max-width: 1024px) {
    .super-investors-main {
        flex-direction: column;
    }

    .super-investors-quote {
        width: 100%;
        position: static;
        /* Removed order: -1 to place quotes below table instead of above */
        margin-top: 30px;
    }

    .quote-content {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .quote-author {
        text-align: center;
    }
}

@media (max-width: 768px) {
    .super-investors-title {
        font-size: 36px;
        letter-spacing: 2px;
    }

    .super-investors-subtitle {
        font-size: 16px;
    }

    .super-investors-table th,
    .super-investors-table td {
        padding: 12px 16px;
    }

    .investor-cell {
        min-width: 200px;
    }

    .fund-name {
        max-width: 150px;
    }

    .super-investors-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .super-investors-container {
        padding: 15px;
    }

    .super-investors-title {
        font-size: 28px;
    }

    .super-investors-subtitle {
        font-size: 14px;
    }

    .super-investors-table-container {
        overflow-x: auto;
    }
}

/* Additional Super Investors Styles - Updates */

/* Task 2: Remove margin between title and subtitle */
.super-investors-title {
    margin-bottom: 0;
}

.super-investors-subtitle {
    margin-top: 5px;
}

/* Task 3: Make superinvestor name clickable blue and bigger */
.investor-name {
    color: var(--primary-color);
    font-size: 16px;
    transition: color 0.2s ease;
}

.investor-row:hover .investor-name {
    color: #1d4ed8;
    text-decoration: underline;
}

.investor-card-name {
    color: var(--primary-color);
    transition: color 0.2s ease;
}

.investor-card:hover .investor-card-name {
    color: #1d4ed8;
}

/* Task 4: Position tooltip over center image */
.position-tooltip {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    bottom: auto;
    background: rgba(15, 23, 42, 0.95);
    color: white;
    padding: 10px 14px;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    text-align: center;
    display: none;
    z-index: 20;
    max-width: 160px;
    border: none;
    pointer-events: none;
}

.position-tooltip strong {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
}

/* Munger quotes styling */
.munger-quote {
    margin-top: 16px;
    border-left-color: #8b5cf6;
}

.munger-quote .quote-text {
    font-size: 14px;
}

/* Fix: Subtitle much closer to title */
.super-investors-header {
    margin-bottom: 30px;
}

/* ========================================
   SUPER INVESTOR DETAIL PAGE STYLES
======================================== */

.investor-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 30px;
}

/* Header */
.investor-detail-header {
    margin-bottom: 30px;
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 24px;
}

.back-btn:hover {
    background: var(--bg-tertiary);
    transform: translateX(-4px);
}

.back-btn svg {
    flex-shrink: 0;
}

.investor-detail-header-content {
    display: flex;
    align-items: center;
    gap: 20px;
    justify-content: space-between;
}

.investor-detail-photo {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.investor-detail-stats {
    display: flex;
    gap: 30px;
    margin-left: auto;
}

.investor-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.investor-stat .stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.investor-stat .stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.investor-detail-title {
    max-height: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.investor-detail-title h1 {
    font-size: 48px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    line-height: 1.1;
}

.investor-detail-fund {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 4px 0 8px 0;
    line-height: 1.2;
}

.investor-detail-date {
    font-size: 16px;
    color: var(--text-secondary);
    margin: 0;
    opacity: 0.8;
    line-height: 1.2;
}

/* Tabs */
.investor-detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.investor-detail-tab {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}

.investor-detail-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.investor-detail-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.investor-detail-body {
    position: relative;
}

.investor-detail-tab-content {
    display: none;
}

.investor-detail-tab-content.active {
    display: block;
}

/* Holdings header row with filter buttons */
.holdings-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.holdings-header-row h2 {
    margin: 0;
    flex: 1;
    min-width: 0;
}

/* Holdings filter buttons */
.holdings-filter-buttons {
    display: inline-flex;
    gap: 8px;
    background: transparent;
    padding: 0;
    border-radius: 8px;
    border: none;
    flex-shrink: 0;
}

.holdings-filter-btn {
    padding: 8px 18px;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.holdings-filter-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    border-color: var(--text-tertiary);
    transform: translateY(-1px);
}

body.dark-mode .holdings-filter-btn {
    background: var(--bg-tertiary);
}

body.dark-mode .holdings-filter-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.holdings-filter-btn.active {
    background: var(--primary-color);
    color: white;
    font-weight: 600;
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.holdings-filter-btn[data-filter="buys"].active {
    background: var(--success-color);
    border-color: var(--success-color);
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.3);
}

.holdings-filter-btn[data-filter="sells"].active {
    background: var(--danger-color);
    border-color: var(--danger-color);
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

body.dark-mode .holdings-filter-btn.active {
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.4);
}

/* TreeMap */
.holdings-treemap-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 0;
    margin-bottom: 30px;
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

#holdingsTreeMap {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Holdings Summary */
.holdings-summary {
    margin-bottom: 30px;
}

.holdings-summary h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
}

.holdings-stats {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
}

.holdings-stat {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.holdings-stat .stat-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

.holdings-stat .stat-value {
    font-size: 20px;
    color: var(--text-primary);
    font-weight: 600;
}

/* Holdings Table */
.holdings-table-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.holdings-table {
    width: 100%;
    border-collapse: collapse;
}

.holdings-table thead {
    background: var(--bg-tertiary);
}

.holdings-table th {
    padding: 13px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.holdings-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s ease;
}

.holdings-table th[data-sort]:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.05);
}

.holdings-table th .sort-icon {
    display: inline-block;
    margin-left: 6px;
    opacity: 0.3;
    transition: opacity 0.2s ease;
}

.holdings-table th .sort-icon::after {
    content: '⇅';
    font-size: 14px;
}

.holdings-table th.sorted-asc .sort-icon::after {
    content: '↑';
    opacity: 1;
    color: var(--primary-color);
}

.holdings-table th.sorted-desc .sort-icon::after {
    content: '↓';
    opacity: 1;
    color: var(--primary-color);
}

.holdings-table th[data-sort]:hover .sort-icon {
    opacity: 0.7;
}

.holdings-table tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.holdings-table tbody tr:hover {
    background: var(--bg-tertiary);
}

.holdings-table td {
    padding: 12px;
    font-size: 15px;
    color: var(--text-primary);
    font-weight: 500;
}

/* Company Name Cell */
.company-name-cell {
    min-width: 200px;
}

.company-name-wrapper {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.company-ticker {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

.company-name {
    font-weight: 500;
    color: var(--text-primary);
}

/* Activity Badge */
.activity-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.activity-added {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.activity-reduced {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.activity-unchanged {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

/* Activity Arrows */
.activity-arrow {
    display: inline-block;
    font-size: 16px;
    font-weight: bold;
    margin-right: 4px;
}

.activity-arrow-up {
    color: #22c55e;
}

.activity-arrow-down {
    color: #ef4444;
}

/* Mini Chart */
.mini-chart-container {
    width: 120px;
    height: 40px;
}

.mini-chart-container canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* Pagination */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    background: var(--bg-secondary);
}

.pagination-info {
    color: var(--text-secondary);
    font-size: 14px;
}

.pagination-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.pagination-page-info {
    padding: 0 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

/* Loading & Error States for Detail Page */
.investor-detail-loading,
.investor-detail-error {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.investor-detail-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
}

.investor-detail-loading p,
.investor-detail-error p {
    color: var(--text-secondary);
    font-size: 16px;
}

.investor-detail-error svg {
    opacity: 0.3;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.investor-detail-error h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0 0 8px;
}

/* Responsive Styles for Detail Page */
@media (max-width: 1024px) {
    .investor-detail-container {
        padding: 30px 20px;
    }

    .holdings-stats {
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .investor-detail-photo {
        width: 60px;
        height: 60px;
    }

    .investor-detail-title h1 {
        font-size: 24px;
    }

    .investor-detail-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 4px;
    }

    .investor-detail-tab {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
    }

    .holdings-header-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .holdings-header-row h2 {
        font-size: 20px;
    }

    .holdings-filter-buttons {
        width: 100%;
        gap: 6px;
    }

    .holdings-filter-btn {
        flex: 1;
        padding: 10px 12px;
        font-size: 12px;
    }

    .holdings-table-container {
        overflow-x: auto;
    }

    .holdings-table {
        min-width: 1000px;
    }
}

@media (max-width: 480px) {
    .investor-detail-container {
        padding: 20px 15px;
    }

    .investor-detail-header-content {
        gap: 12px;
    }

    .investor-detail-title h1 {
        font-size: 20px;
    }

    .holdings-header-row h2 {
        font-size: 18px;
    }

    .holdings-filter-btn {
        padding: 8px 6px;
        font-size: 11px;
    }
}

.super-investors-title {
    margin-bottom: -5px;
}

.super-investors-subtitle {
    margin-top: 0;
}

/* Fix: Make table column names darker and more visible */
.super-investors-table th {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--bg-tertiary);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid var(--primary-color);
}

.super-investors-table th:hover {
    background: var(--bg-secondary);
}

body.dark-mode .super-investors-table th {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Fix: Make center image in pie chart 25% bigger */
.investor-image-overlay {
    width: 100px;
    height: 100px;
}

/* Task 1: Reduce center image by 10% and increase font in boxes */
.investor-image-overlay {
    width: 90px;
    height: 90px;
}

.investor-card-name {
    font-size: 20px;
}

.investor-card-fund {
    font-size: 13px;
}

.investor-card-stats .stat-label {
    font-size: 11px;
}

.investor-card-stats .stat-value {
    font-size: 14px;
}

/* Task 3: Enhanced hover effect for boxes */
.investor-card {
    position: relative;
}

.investor-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(139, 92, 246, 0.1));
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.investor-card:hover::before {
    opacity: 1;
}

.investor-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.2);
    border-color: var(--primary-color);
}

body.dark-mode .investor-card:hover {
    box-shadow: 0 20px 40px -5px rgba(0, 0, 0, 0.4);
}

/* Sort dropdown for grid view */
.super-investors-sort-group {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-right: auto;
}

.super-investors-sort-group label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

.super-investors-controls {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* ===================================
   GLOBAL SEARCH BAR STYLES
   =================================== */

.global-search-container {
    flex: 1;
    max-width: 600px;
    margin: 0 20px;
    display: flex;
    align-items: center;
}

.global-search-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

.global-search-input {
    width: 100%;
    padding: 14px 45px 14px 45px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
    margin: auto 0;
}

.global-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background: var(--bg-primary);
}

.global-search-input::placeholder {
    color: var(--text-tertiary);
}

.global-search-icon {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-tertiary);
    pointer-events: none;
}

.global-search-clear-btn {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 5px 8px;
    font-size: 24px;
    line-height: 1;
    z-index: 10;
    transition: color 0.2s, background 0.2s;
    border-radius: 4px;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.global-search-clear-btn:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.global-search-results {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    max-height: 500px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.global-search-category {
    padding: 8px 0;
}

.global-search-category:not(:last-child) {
    border-bottom: 1px solid var(--border-color);
}

.global-search-category-title {
    padding: 8px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
}

.global-search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.global-search-result-item:hover {
    background: var(--bg-secondary);
}

.global-search-result-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--primary-color);
    flex-shrink: 0;
    overflow: hidden;
}

.global-search-result-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.global-search-result-logo img {
    object-fit: contain;
    padding: 4px;
}

.global-search-result-avatar {
    border-radius: 50%;
}

.global-search-logo-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.global-search-result-item:hover .global-search-result-icon {
    background: var(--bg-tertiary);
}

.global-search-result-details {
    flex: 1;
    min-width: 0;
}

.global-search-result-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-result-meta {
    font-size: 12px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.global-search-no-results {
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Responsive Global Search */
@media (max-width: 768px) {
    .global-search-container {
        max-width: none;
        margin: 0 10px;
    }

    .global-search-input {
        font-size: 14px;
        padding: 13px 40px 13px 40px;
    }
}

/* ===================================
   COMPANY DETAIL PAGE STYLES
   =================================== */

.company-detail-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 30px;
}

/* Company Header */
.company-detail-header {
    margin-bottom: 30px;
}

.company-detail-header-content {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 30px;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 16px;
    border: 1px solid var(--border-color);
}

.company-detail-logo {
    width: 100px;
    height: 100px;
    border-radius: 12px;
    object-fit: cover;
    padding: 0;
    background: #334155;
    box-shadow: var(--shadow-md);
    flex-shrink: 0;
}

.company-detail-title {
    flex: 1;
    min-width: 0;
}

.company-detail-title h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.2;
}

.company-detail-ticker {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
    margin: 0 0 12px 0;
}

.company-detail-price-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.company-detail-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

.company-detail-price-change {
    font-size: 16px;
    font-weight: 600;
}

.company-detail-price-change.positive {
    color: var(--success-color);
}

.company-detail-price-change.negative {
    color: var(--danger-color);
}

.company-detail-stats {
    display: flex;
    gap: 20px;
    margin-left: auto;
}

.company-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.company-stat .stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.company-stat .stat-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Company Tabs */
.company-detail-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 30px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0;
}

.company-detail-tab {
    padding: 12px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    bottom: -2px;
}

.company-detail-tab:hover {
    color: var(--text-primary);
    background: var(--bg-secondary);
}

.company-detail-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

/* Tab Content */
.company-detail-body {
    position: relative;
}

.company-detail-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.company-detail-tab-content.active {
    display: block;
}

/* Loading & Error States */
.company-detail-loading,
.company-detail-error {
    text-align: center;
    padding: 80px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
}

.company-detail-loading .spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
}

.company-detail-loading p,
.company-detail-error p {
    color: var(--text-secondary);
    font-size: 16px;
}

.company-detail-error svg {
    opacity: 0.3;
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.company-detail-error h3 {
    font-size: 20px;
    color: var(--text-primary);
    margin: 0 0 8px;
}

/* Responsive Company Detail */
@media (max-width: 1024px) {
    .company-detail-container {
        padding: 30px 20px;
    }

    .company-detail-header-content {
        flex-wrap: wrap;
    }

    .company-detail-stats {
        width: 100%;
        justify-content: space-between;
        margin-left: 0;
    }
}

@media (max-width: 768px) {
    .company-detail-logo {
        width: 70px;
        height: 70px;
    }

    .company-detail-title h1 {
        font-size: 24px;
    }

    .company-detail-price {
        font-size: 20px;
    }

    .company-detail-tabs {
        overflow-x: auto;
        flex-wrap: nowrap;
        gap: 4px;
    }

    .company-detail-tab {
        padding: 10px 16px;
        font-size: 14px;
        white-space: nowrap;
    }
}

@media (max-width: 480px) {
    .company-detail-container {
        padding: 20px 15px;
    }

    .company-detail-header-content {
        padding: 20px;
        gap: 16px;
    }

    .company-detail-title h1 {
        font-size: 20px;
    }
}

/* View More Charts Button - Visualizations Tab */
.view-more-charts-container {
    display: flex;
    justify-content: center;
    padding: 30px 20px 10px;
    margin-top: 10px;
}

.view-more-charts-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary-color) 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    position: relative;
    overflow: hidden;
}

.view-more-charts-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.view-more-charts-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 99, 235, 0.45);
}

.view-more-charts-btn:hover::before {
    left: 100%;
}

.view-more-charts-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.view-more-charts-icon {
    flex-shrink: 0;
}

.view-more-charts-arrow {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.view-more-charts-btn:hover .view-more-charts-arrow {
    transform: translateX(4px);
}

/* Dark mode styles for the button */
body.dark-mode .view-more-charts-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4);
}

body.dark-mode .view-more-charts-btn:hover {
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

/* Responsive styles for the button */
@media (max-width: 768px) {
    .view-more-charts-btn {
        padding: 12px 20px;
        font-size: 14px;
        gap: 10px;
    }

    .view-more-charts-icon {
        width: 18px;
        height: 18px;
    }

    .view-more-charts-arrow {
        width: 14px;
        height: 14px;
    }
}

@media (max-width: 480px) {
    .view-more-charts-container {
        padding: 20px 15px 5px;
    }

    .view-more-charts-btn {
        width: 100%;
        justify-content: center;
        padding: 14px 16px;
    }
}

/* ============================================
   Legal Pages (Disclaimer & Terms of Service)
   ============================================ */

.legal-page {
    min-height: calc(100vh - 200px);
}

.legal-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.legal-header {
    margin-bottom: 40px;
    padding-bottom: 24px;
    border-bottom: 2px solid var(--border-color);
}

.legal-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    margin: 0;
}

body.dark-mode .legal-title {
    color: #ffffff;
}

.legal-content {
    color: var(--text-secondary);
    line-height: 1.8;
}

.legal-section {
    margin-bottom: 32px;
}

.legal-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
    margin-top: 0;
}

body.dark-mode .legal-section h2 {
    color: #e5e7eb;
}

.legal-section p {
    margin-bottom: 16px;
    font-size: 1rem;
    color: var(--text-secondary);
}

body.dark-mode .legal-section p {
    color: #9ca3af;
}

.legal-section p:last-child {
    margin-bottom: 0;
}

.legal-section strong {
    color: var(--text-primary);
    font-weight: 600;
}

body.dark-mode .legal-section strong {
    color: #e5e7eb;
}

.legal-link {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease, text-decoration 0.2s ease;
}

.legal-link:hover {
    color: var(--primary-blue);
    text-decoration: underline;
}

body.dark-mode .legal-link {
    color: #60a5fa;
}

body.dark-mode .legal-link:hover {
    color: #93c5fd;
}

.legal-link-section {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

/* Footer Links */
.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 20px;
    margin-bottom: 16px;
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.footer-link:hover {
    color: var(--accent-blue);
    text-decoration: underline;
}

body.dark-mode .footer-link {
    color: #9ca3af;
}

body.dark-mode .footer-link:hover {
    color: #60a5fa;
}

.footer-divider {
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

body.dark-mode .footer-divider {
    color: #6b7280;
}

/* Responsive Legal Pages */
@media (max-width: 768px) {
    .legal-container {
        padding: 24px 16px 40px;
    }

    .legal-title {
        font-size: 2rem;
    }

    .legal-header {
        margin-bottom: 28px;
        padding-bottom: 20px;
    }

    .legal-section h2 {
        font-size: 1.125rem;
    }

    .legal-section p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    .legal-container {
        padding: 20px 12px 32px;
    }

    .legal-title {
        font-size: 1.75rem;
    }

    .legal-section {
        margin-bottom: 24px;
    }

    .footer-links {
        gap: 8px;
    }

    .footer-link {
        font-size: 0.85rem;
    }
}

/* ========================================
   NEWS BYTE PAGE STYLES
   ======================================== */

#news-byte-page {
    max-width: 100%;
    overflow-x: hidden;
}

.news-byte-container {
    padding: 0 0 40px;
    display: block;
    max-width: 100%;
    overflow-x: hidden;
    width: 100%;
}

/* Sticky News Header - wraps controls, banner, and selected tickers */
.news-sticky-header {
    position: relative;
    z-index: 50;
    background: var(--bg-secondary);
    padding: 15px 0;
    margin: 0 0 15px 0;
    transition: box-shadow 0.2s ease;
    max-width: 100%;
    overflow: visible;
}

/* When header becomes fixed via JavaScript */
.news-sticky-header.is-fixed {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px 0 20px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin: 0;
}

/* Sticky Header Toggle Button */
.sticky-toggle-btn {
    display: none;
    position: absolute;
    bottom: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 28px;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0 0 14px 14px;
    cursor: pointer;
    z-index: 51;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.sticky-toggle-btn:hover {
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sticky-toggle-btn:active {
    transform: translateX(-50%) scale(0.95);
}

/* Show toggle button only when header is fixed */
.news-sticky-header.is-fixed .sticky-toggle-btn {
    display: flex;
}

/* Toggle button icon states */
.sticky-toggle-btn .toggle-icon-up {
    display: block;
    color: var(--text-secondary);
}

.sticky-toggle-btn .toggle-icon-down {
    display: none;
    color: var(--text-secondary);
}

/* When header is hidden, show down arrow */
.news-sticky-header.is-hidden .sticky-toggle-btn .toggle-icon-up {
    display: none;
}

.news-sticky-header.is-hidden .sticky-toggle-btn .toggle-icon-down {
    display: block;
}

/* Sticky content wrapper for animation */
.sticky-content-wrapper {
    overflow: hidden;
    overflow-x: hidden;
    overflow-y: hidden;
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
    transition: max-height 0.3s ease, opacity 0.3s ease;
    max-height: 500px;
    opacity: 1;
}

.sticky-content-wrapper::-webkit-scrollbar {
    display: none;  /* Chrome, Safari, Opera */
}

/* Hidden state for sticky header content */
.news-sticky-header.is-hidden .sticky-content-wrapper {
    max-height: 0;
    opacity: 0;
}

/* Adjust padding when hidden */
.news-sticky-header.is-hidden {
    padding: 0;
    min-height: 14px;
}

/* Dark mode adjustments for toggle button */
body.dark-mode .sticky-toggle-btn {
    background: var(--bg-primary);
    border-color: var(--border-color);
}

body.dark-mode .sticky-toggle-btn:hover {
    background: var(--bg-secondary);
}

/* Spacer to prevent content jump when header becomes fixed */
.news-sticky-spacer {
    display: none;
}

.news-sticky-spacer.active {
    display: block;
}

/* Adjust for sidebar on desktop */
@media (min-width: 1025px) {
    .news-sticky-header.is-fixed {
        left: var(--sidebar-width);
        right: 0;
        width: auto;
    }

    .sidebar.collapsed ~ .main-wrapper .news-sticky-header.is-fixed {
        left: var(--sidebar-collapsed);
    }
}

/* Mobile adjustments for fixed header */
@media (max-width: 1024px) {
    .news-sticky-header {
        padding: 10px 0;
    }
    
    .news-sticky-header.is-fixed {
        left: 0;
        width: 100%;
        padding: 10px 0;
    }
    
    .news-controls-section,
    .news-banner-wrapper,
    .selected-tickers-display {
        margin-left: 15px;
        margin-right: 15px;
    }
    
    .news-grid {
        margin: 0 15px;
    }
}

/* News Controls Section */
.news-controls-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
    padding: 15px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    margin: 0 20px 15px 20px;
    box-shadow: var(--shadow-sm);
    max-width: calc(100% - 40px);
    box-sizing: border-box;
}

/* News Search */
.news-search-container {
    flex: 1;
    min-width: 0; /* Allow shrinking */
    max-width: 600px;
}

.news-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.news-search-wrapper .search-icon {
    position: absolute;
    left: 16px;
    color: var(--text-tertiary);
    pointer-events: none;
    z-index: 1;
}

.news-search-input {
    width: 100%;
    padding: 12px 40px 12px 48px;
    font-size: 15px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.news-search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.1);
}

.news-search-input::placeholder {
    color: var(--text-tertiary);
}

.news-clear-btn {
    position: absolute;
    right: 12px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: color 0.2s;
}

.news-clear-btn:hover {
    color: var(--text-primary);
}

.news-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
    margin-top: 8px;
}

.news-search-results .search-result-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid var(--border-color);
}

.news-search-results .search-result-item:last-child {
    border-bottom: none;
}

.news-search-results .search-result-item:hover {
    background: var(--bg-secondary);
}

.news-search-results .search-result-item img {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    margin-right: 12px;
    background: var(--bg-tertiary);
    padding: 4px;
}

.news-search-results .search-result-details {
    flex: 1;
}

.news-search-results .search-result-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 14px;
}

.news-search-results .search-result-ticker {
    font-size: 12px;
    color: var(--text-secondary);
}

.news-search-results .search-no-results {
    padding: 20px;
    text-align: center;
    color: var(--text-tertiary);
}

.news-search-results mark {
    background: rgba(37, 99, 235, 0.2);
    color: var(--primary-color);
    padding: 0 2px;
    border-radius: 2px;
}

/* News Filter Buttons */
.news-filter-buttons {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.news-filter-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.news-filter-btn svg {
    width: 12px;
    height: 12px;
}

.news-filter-btn.all {
    background: rgba(37, 99, 235, 0.1);
    color: var(--primary-color);
    border-color: rgba(37, 99, 235, 0.3);
}

.news-filter-btn.all:hover,
.news-filter-btn.all.active {
    background: rgba(37, 99, 235, 0.2);
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(37, 99, 235, 0.3);
}

.news-filter-btn.bearish {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.3);
}

.news-filter-btn.bearish:hover,
.news-filter-btn.bearish.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.3);
}

.news-filter-btn.bullish {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.3);
}

.news-filter-btn.bullish:hover,
.news-filter-btn.bullish.active {
    background: rgba(16, 185, 129, 0.2);
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.3);
}

/* News Banner Wrapper */
.news-banner-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    border-radius: 12px;
    margin: 0 20px 15px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
}

.news-banner-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), #8b5cf6, #ec4899, var(--primary-color));
    background-size: 200% 100%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.news-banner-wrapper .logo-banner {
    flex: 1;
    overflow: hidden;
    min-width: 0;
    max-width: 100%;
}

.news-banner-wrapper .logo-track {
    display: flex;
    gap: 16px;
    animation: none;
    transition: transform 0.1s linear;
}

.news-banner-wrapper .logo-item {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.news-banner-wrapper .logo-item:hover {
    transform: scale(1.1);
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.news-banner-wrapper .logo-item.selected {
    border-color: var(--primary-color);
    background: rgba(37, 99, 235, 0.1);
    box-shadow: 0 0 16px rgba(37, 99, 235, 0.4);
}

.news-banner-wrapper .logo-item img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.news-banner-wrapper .banner-nav {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.news-banner-wrapper .banner-nav:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Selected Tickers Display */
.selected-tickers-display {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background: var(--bg-primary);
    border-radius: 12px;
    margin: 0 20px 15px 20px;
    box-shadow: var(--shadow-sm);
    max-width: calc(100% - 40px);
    box-sizing: border-box;
}

.selected-ticker-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px 8px 8px;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid rgba(37, 99, 235, 0.3);
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    animation: chipSlideIn 0.3s ease;
}

@keyframes chipSlideIn {
    from {
        opacity: 0;
        transform: scale(0.8) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.selected-ticker-chip img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: contain;
    background: var(--bg-tertiary);
}

.selected-ticker-chip .chip-remove {
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 20px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s;
    margin-left: 4px;
}

.selected-ticker-chip .chip-remove:hover {
    color: var(--danger-color);
}

/* Max Tickers Message */
.max-tickers-message {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15) 0%, rgba(251, 191, 36, 0.1) 100%);
    border: 1px solid rgba(245, 158, 11, 0.4);
    border-radius: 12px;
    color: #d97706;
    font-size: 14px;
    font-weight: 500;
    margin: 0 20px 16px 20px;
    animation: messageSlideIn 0.3s ease;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.max-tickers-message svg {
    flex-shrink: 0;
    stroke: #d97706;
}

.max-tickers-message.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin: 0 20px;
    max-width: calc(100% - 40px);
    box-sizing: border-box;
}

/* News Card */
.news-card {
    background: var(--bg-primary);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    animation: newsCardFadeIn 0.4s ease backwards;
}

@keyframes newsCardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.news-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl), 0 0 30px rgba(37, 99, 235, 0.15);
}

/* News Card Image */
.news-card-image {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
}

.news-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.news-card:hover .news-card-image img {
    transform: scale(1.08);
}

.news-card-ticker {
    position: absolute;
    bottom: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* News Card Content */
.news-card-content {
    padding: 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.news-card-signal {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: 12px;
    width: fit-content;
}

.news-card-signal.signal-bullish {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.news-card-signal.signal-bearish {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.news-card-signal.signal-neutral {
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.bullish-text {
    color: #10b981;
}

.bearish-text {
    color: #ef4444;
}

.neutral-text {
    color: var(--text-secondary);
}

.news-card-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    margin-bottom: 10px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.news-card-summary-wrapper {
    position: relative;
    margin-bottom: 16px;
    flex: 1;
}

.news-card-summary {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: all 0.3s ease;
}

.news-card-summary.expanded {
    -webkit-line-clamp: unset;
    display: block;
}

.summary-expand-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-top: 8px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--primary-color);
    background: rgba(37, 99, 235, 0.08);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.summary-expand-btn:hover {
    background: rgba(37, 99, 235, 0.15);
}

.summary-expand-btn svg {
    transition: transform 0.3s ease;
}

.summary-expand-btn.expanded svg {
    transform: rotate(45deg);
}

.news-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.news-card-date {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 500;
}

.news-card-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.2s;
}

.news-card-link:hover {
    background: rgba(37, 99, 235, 0.1);
}

.news-card-link svg {
    transition: transform 0.2s;
}

.news-card-link:hover svg {
    transform: translate(2px, -2px);
}

/* News Loading State */
.news-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    color: var(--text-tertiary);
}

.news-loading .spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

.news-loading p {
    font-size: 15px;
}

/* News Section Header */
.news-section-header {
    grid-column: 1 / -1;
    padding: 16px 0 8px;
    margin-bottom: 8px;
}

.news-section-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.news-section-header h3::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 20px;
    background: linear-gradient(135deg, var(--primary-color), #8b5cf6);
    border-radius: 2px;
}

/* News Section Divider */
.news-section-divider {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 30px 0 20px;
    margin: 10px 0;
}

.news-section-divider::before,
.news-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
}

.news-section-divider span {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

/* News Empty State */
.news-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
    color: var(--text-tertiary);
}

.news-empty svg {
    margin-bottom: 20px;
    opacity: 0.5;
}

.news-empty h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.news-empty p {
    font-size: 15px;
}

/* News Error State */
.news-error {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    text-align: center;
}

.news-error svg {
    color: var(--danger-color);
    margin-bottom: 20px;
    opacity: 0.7;
}

.news-error h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.news-error p {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 20px;
}

.news-error .retry-btn {
    padding: 10px 24px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.news-error .retry-btn:hover {
    background: #1d4ed8;
    transform: translateY(-2px);
}

/* Dark Mode News Card Adjustments */
body.dark-mode .news-card {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

body.dark-mode .news-card:hover {
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(59, 130, 246, 0.2);
}

body.dark-mode .news-card-ticker {
    background: rgba(0, 0, 0, 0.9);
}

/* News Responsive Styles */
@media (max-width: 1200px) {
    .news-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 900px) {
    .news-controls-section {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .news-search-container {
        width: 100%;
    }

    .news-filter-buttons {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .news-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .news-card-image {
        height: 200px;
    }

    .news-banner-wrapper .logo-item {
        width: 48px;
        height: 48px;
    }

    .news-banner-wrapper .logo-item img {
        width: 36px;
        height: 36px;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    .news-controls-section {
        padding: 12px;
        gap: 12px;
    }

    .news-filter-buttons {
        flex-wrap: wrap;
        gap: 8px;
    }

    .news-filter-btn {
        padding: 6px 10px;
        font-size: 11px;
    }

    .news-filter-btn svg {
        width: 14px;
        height: 14px;
    }

    .news-banner-wrapper .logo-item img {
        width: 32px;
        height: 32px;
    }

    .news-banner-wrapper .logo-track {
        gap: 10px;
    }

    .news-card-image {
        height: 140px;
    }

    .news-card-content {
        padding: 12px;
    }

    .news-card-title {
        font-size: 14px;
    }

    .news-card-summary {
        font-size: 12px;
        -webkit-line-clamp: 2;
    }

    .news-section-header h3 {
        font-size: 15px;
    }

    .news-section-divider span {
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .news-controls-section {
        padding: 16px;
    }

    .news-filter-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .news-card-content {
        padding: 16px;
    }

    .news-card-title {
        font-size: 15px;
    }

    .news-card-summary {
        font-size: 13px;
    }
}

/* ===================================
   COMPREHENSIVE MOBILE RESPONSIVE STYLES
   =================================== */

/* Mobile Sidebar Overlay */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Enhanced Mobile Sidebar */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        box-shadow: none;
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    .main-wrapper {
        margin-left: 0 !important;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Prevent body scroll when sidebar is open */
    body.sidebar-open {
        overflow: hidden;
    }
}

/* Mobile Header Improvements */
@media (max-width: 768px) {
    .top-header {
        height: auto;
        min-height: 60px;
        padding: 10px 0;
    }

    .header-content {
        flex-wrap: wrap;
        gap: 10px;
        padding: 0 12px;
    }

    .menu-toggle {
        order: 1;
        margin-right: 8px;
        flex-shrink: 0;
    }

    .global-search-container {
        order: 3;
        width: 100%;
        max-width: none;
        margin: 8px 0 0 0;
    }

    .header-actions {
        order: 2;
        margin-left: auto;
    }

    .beta-badge {
        font-size: 9px;
        padding: 4px 8px;
    }

    .global-search-input {
        padding: 10px 40px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 10px;
    }

    .global-search-input {
        padding: 10px 35px;
        font-size: 13px;
    }

    .global-search-icon {
        left: 12px;
        width: 16px;
        height: 16px;
    }

    .global-search-clear-btn {
        right: 10px;
        font-size: 20px;
    }
}

/* Mobile Page Controls */
@media (max-width: 768px) {
    .page-controls {
        padding: 15px;
        margin-bottom: 20px;
        border-radius: 8px;
    }

    .controls {
        gap: 12px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .filter-group label {
        font-size: 12px;
    }

    .filter-select {
        padding: 10px 12px;
        font-size: 14px;
    }

    .refresh-btn {
        width: 100%;
        justify-content: center;
        margin-left: 0;
        padding: 12px 16px;
    }

    .refresh-btn svg {
        width: 18px;
        height: 18px;
    }
}

/* Mobile Main Content */
@media (max-width: 768px) {
    .main-content {
        padding: 15px 0;
    }

    .container {
        padding: 0 12px;
    }
}

@media (max-width: 480px) {
    .main-content {
        padding: 10px 0;
    }

    .container {
        padding: 0 10px;
    }
}

/* Mobile Company Cards */
@media (max-width: 480px) {
    .companies-grid {
        gap: 15px;
    }

    .company-card {
        height: auto;
        min-height: 360px;
    }

    .card-header {
        padding: 15px;
        min-height: auto;
    }

    .company-logo {
        width: 50px;
        height: 50px;
    }

    .company-name {
        font-size: 15px;
    }

    .ticker-badge {
        font-size: 10px;
        padding: 3px 8px;
    }

    .card-content {
        padding: 15px;
        gap: 12px;
    }

    .moat-score h4,
    .price-info h4 {
        font-size: 11px;
    }

    .moat-value {
        font-size: 22px;
    }

    .current-price {
        font-size: 16px;
    }

    .price-change {
        font-size: 11px;
    }

    .fair-value {
        font-size: 12px;
    }

    .upside-downside {
        padding: 12px 15px;
    }

    .upside-value {
        font-size: 18px;
    }

    .upside-label {
        font-size: 10px;
    }
}

/* Mobile Fundamentals Page */
@media (max-width: 768px) {
    .fundamentals-container {
        padding: 15px;
    }

    .search-wrapper {
        max-width: 100%;
    }

    .search-input {
        padding: 10px 40px;
        font-size: 14px;
    }

    .logo-banner-wrapper {
        margin-bottom: 20px;
    }

    .logo-track {
        padding: 0 40px;
        gap: 10px;
    }

    .logo-item {
        width: 48px;
        height: 48px;
    }

    .logo-item img {
        width: 34px;
        height: 34px;
    }

    .banner-nav {
        width: 32px;
        height: 32px;
    }

    .banner-nav svg {
        width: 16px;
        height: 16px;
    }

    .banner-nav-prev {
        left: 0;
    }

    .banner-nav-next {
        right: 0;
    }

    .selected-company-name h2 {
        font-size: 20px;
    }
}

/* Mobile Financials Page */
@media (max-width: 1024px) {
    .financials-container {
        padding: 15px;
    }

    .financials-selected-company {
        padding: 15px;
    }

    .financials-company-logo {
        width: 60px;
        height: 60px;
    }

    .financials-company-name {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .financials-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .financials-tab {
        flex: 1 1 auto;
        padding: 10px 12px;
        font-size: 12px;
        text-align: center;
        min-width: 0;
    }

    .balance-sheet-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .control-group {
        width: 100%;
        justify-content: space-between;
    }

    .button-group {
        flex-wrap: wrap;
    }

    .download-btn {
        width: 100%;
        justify-content: center;
    }

    .ml-auto {
        margin-left: 0;
    }

    /* Make financial tables horizontally scrollable */
    .balance-sheet-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .balance-sheet-table {
        min-width: 800px;
    }

    .sticky-col {
        position: sticky;
        left: 0;
        background: var(--bg-primary);
        z-index: 5;
        min-width: 180px;
    }
}

@media (max-width: 480px) {
    .financials-company-header {
        flex-direction: column;
        text-align: center;
        gap: 12px;
    }

    .financials-company-logo {
        width: 50px;
        height: 50px;
    }

    .financials-company-name {
        font-size: 18px;
    }

    .financials-tab {
        padding: 8px 10px;
        font-size: 11px;
    }
}

/* Mobile Super Investors Page */
@media (max-width: 1024px) {
    .super-investors-main {
        flex-direction: column;
    }

    .super-investors-quote {
        width: 100%;
        order: 2;
        margin-top: 30px;
    }

    .super-investors-content-area {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .super-investors-container {
        padding: 15px;
    }

    .super-investors-header {
        padding: 15px 0;
    }

    .super-investors-title {
        font-size: 24px;
    }

    .super-investors-subtitle {
        font-size: 14px;
    }

    .super-investors-controls {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }

    .super-investors-sort-group {
        width: 100%;
    }

    .super-investors-sort-group select {
        width: 100%;
    }

    /* Super Investors Table Mobile */
    .super-investors-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .super-investors-table {
        min-width: 600px;
    }

    .investor-cell {
        min-width: 180px;
    }

    .investor-avatar {
        width: 40px;
        height: 40px;
    }

    .investor-name {
        font-size: 14px;
    }

    .fund-name {
        font-size: 11px;
        max-width: 120px;
    }

    /* Super Investors Grid Mobile */
    .super-investors-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 15px;
    }

    .super-investor-card {
        padding: 15px;
    }

    .investor-photo-container {
        width: 140px;
        height: 140px;
    }

    .investor-image-overlay {
        width: 70px;
        height: 70px;
    }
}

@media (max-width: 480px) {
    .super-investors-title {
        font-size: 20px;
    }

    .super-investors-subtitle {
        font-size: 12px;
    }

    .quote-text {
        font-size: 14px;
    }

    .quote-author {
        font-size: 12px;
    }

    .super-investors-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile Investor Detail Page */
@media (max-width: 1024px) {
    .investor-detail-container {
        padding: 15px;
    }

    .investor-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 20px;
    }

    .investor-detail-photo {
        width: 100px;
        height: 100px;
    }

    .investor-detail-name {
        font-size: 24px;
    }

    .investor-detail-stats {
        justify-content: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .investor-detail-photo {
        width: 80px;
        height: 80px;
    }

    .investor-detail-name {
        font-size: 20px;
    }

    .investor-detail-fund {
        font-size: 14px;
    }

    .investor-detail-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .investor-detail-tab {
        flex: 1 1 auto;
        padding: 10px 12px;
        font-size: 12px;
        text-align: center;
    }

    /* Holdings Table Mobile */
    .holdings-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -15px;
        padding: 0 15px;
    }

    .holdings-table {
        min-width: 900px;
    }

    .company-name-cell {
        min-width: 150px;
    }

    .mini-chart-container {
        width: 80px;
    }

    /* Investor Stats */
    .stat-item {
        min-width: 100px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 11px;
    }
}

@media (max-width: 480px) {
    .investor-detail-photo {
        width: 70px;
        height: 70px;
    }

    .investor-detail-name {
        font-size: 18px;
    }

    .investor-detail-stats {
        gap: 10px;
    }

    .stat-item {
        min-width: 80px;
        padding: 10px;
    }

    .stat-value {
        font-size: 16px;
    }
}

/* Mobile Company Detail Page */
@media (max-width: 1024px) {
    .company-detail-container {
        padding: 15px;
    }

    .company-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 15px;
    }

    .company-detail-logo {
        width: 80px;
        height: 80px;
    }

    .company-detail-name {
        font-size: 24px;
    }
}

@media (max-width: 768px) {
    .company-detail-logo {
        width: 60px;
        height: 60px;
    }

    .company-detail-name {
        font-size: 20px;
    }

    .company-detail-ticker {
        font-size: 14px;
    }

    .company-detail-tabs {
        flex-wrap: wrap;
        gap: 8px;
    }

    .company-detail-tab {
        flex: 1 1 auto;
        padding: 10px 12px;
        font-size: 12px;
        text-align: center;
    }

    .back-btn {
        padding: 8px 12px;
        font-size: 13px;
    }

    .back-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 480px) {
    .company-detail-logo {
        width: 50px;
        height: 50px;
    }

    .company-detail-name {
        font-size: 18px;
    }

    .company-detail-tab {
        padding: 8px 10px;
        font-size: 11px;
    }
}

/* Mobile Settings Page */
@media (max-width: 1024px) {
    .settings-content {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding-bottom: 15px;
        margin-bottom: 15px;
    }

    .settings-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .settings-nav-link {
        flex: 1 1 auto;
        text-align: center;
        padding: 10px 12px;
        justify-content: center;
    }

    .settings-main {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .settings-container {
        padding: 15px;
    }

    .settings-header {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }

    .page-title {
        font-size: 24px;
    }

    .page-subtitle {
        font-size: 14px;
    }

    .settings-card {
        padding: 20px;
    }

    .settings-card h2 {
        font-size: 20px;
    }

    .about-hero,
    .help-hero,
    .contact-hero {
        margin-bottom: 20px;
    }

    .about-hero svg,
    .help-hero svg,
    .contact-hero svg {
        width: 50px;
        height: 50px;
    }

    .feature-list li {
        font-size: 14px;
    }

    .faq-item h5 {
        font-size: 14px;
    }

    .faq-item p {
        font-size: 13px;
    }

    .contact-form {
        max-width: 100%;
    }

    .form-input,
    .form-textarea {
        padding: 12px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .settings-nav-link {
        padding: 8px 10px;
        font-size: 12px;
    }

    .settings-icon {
        width: 16px;
        height: 16px;
    }
}

/* Mobile Footer */
@media (max-width: 768px) {
    .footer {
        padding: 20px 0;
    }

    .disclaimer {
        font-size: 11px;
        line-height: 1.5;
    }

    .disclaimer p {
        margin-bottom: 10px;
    }

    .footer-links {
        flex-direction: column;
        gap: 10px;
        align-items: center;
    }

    .footer-divider {
        display: none;
    }

    .copyright {
        font-size: 11px;
        margin-top: 15px;
    }
}

/* Mobile Modal */
@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-width: none;
        margin: 10px;
        max-height: calc(100vh - 20px);
        border-radius: 12px;
    }

    .modal-tabs {
        flex-wrap: wrap;
        gap: 6px;
        padding: 10px;
    }

    .tab-button {
        flex: 1 1 calc(50% - 6px);
        padding: 10px;
        font-size: 12px;
    }

    .modal-body {
        padding: 15px;
    }

    .close-modal {
        width: 28px;
        height: 28px;
        font-size: 24px;
        top: 8px;
        right: 8px;
    }
}

/* Mobile Legal Pages */
@media (max-width: 768px) {
    .legal-container {
        padding: 20px 15px;
    }

    .legal-title {
        font-size: 24px;
    }

    .legal-section h2 {
        font-size: 16px;
    }

    .legal-section p {
        font-size: 13px;
        line-height: 1.6;
    }
}

/* Mobile Charts */
@media (max-width: 768px) {
    .chart-container {
        padding: 15px;
    }

    .chart-title {
        font-size: 14px;
    }

    .health-chart-panel {
        padding: 15px;
    }

    .health-score-value {
        font-size: 32px;
    }

    .health-score-label {
        font-size: 12px;
    }
}

/* Mobile News Byte Additional */
@media (max-width: 768px) {
    .news-byte-container {
        padding: 0 0 15px;
    }

    .news-search-wrapper {
        width: 100%;
    }

    .news-search-input {
        padding: 10px 40px;
        font-size: 14px;
    }

    .selected-tickers-display {
        flex-wrap: wrap;
        gap: 8px;
    }

    .selected-ticker-chip {
        font-size: 12px;
        padding: 6px 10px;
    }

    .selected-ticker-chip img {
        width: 20px;
        height: 20px;
    }
    
    .news-controls-section,
    .news-banner-wrapper,
    .selected-tickers-display,
    .news-grid {
        margin-left: 15px;
        margin-right: 15px;
    }
}

@media (max-width: 480px) {
    .news-controls-section,
    .news-banner-wrapper,
    .selected-tickers-display,
    .news-grid {
        margin-left: 10px;
        margin-right: 10px;
    }

    .news-controls-section {
        margin-bottom: 10px;
        padding: 10px 12px;
    }

    .news-banner-wrapper {
        margin-bottom: 10px;
        padding: 10px 12px;
    }
}

/* Prevent horizontal scroll on body */
html, body {
    overflow-x: hidden;
    max-width: 100vw;
}

/* Improve touch targets for mobile */
@media (max-width: 768px) {
    button, 
    .nav-item, 
    .filter-select,
    .search-input,
    input[type="text"],
    input[type="email"],
    textarea {
        min-height: 44px;
    }

    a {
        padding: 4px 0;
    }
}

/* Mobile-friendly scrollbars */
@media (max-width: 768px) {
    ::-webkit-scrollbar {
        width: 4px;
        height: 4px;
    }

    ::-webkit-scrollbar-track {
        background: var(--bg-secondary);
    }

    ::-webkit-scrollbar-thumb {
        background: var(--text-tertiary);
        border-radius: 4px;
    }
}

/* Hide elements that don't work well on mobile */
@media (max-width: 480px) {
    .view-toggle-group {
        display: none !important;
    }
}
