/* ============================================
   DARK THEME - STOCK DETAIL PAGE
   Inspired by modern screener design
   ============================================ */

/* Dark Theme Base */
.dark-theme {
    background-color: #0f172a; /* slate-950 */
    color: #f1f5f9; /* slate-100 */
    min-height: 100vh;
}

/* Ensure body and html don't interfere with fixed positioning */
html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

/* Ensure AI agent widget is always in viewport */
body > #aiAgentWidget {
    position: fixed !important;
    z-index: 99999 !important;
}

/* Navigation - Dark Theme */
.navbar-dark {
    position: sticky;
    top: 0;
    z-index: 30;
    border-bottom: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.9); /* slate-950/90 */
    backdrop-filter: blur(10px);
}

.navbar-dark .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    max-width: 1152px; /* max-w-6xl */
    margin: 0 auto;
}

.nav-brand-dark {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.brand-icon {
    display: flex;
    height: 2rem;
    width: 2rem;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    background: #2563eb; /* blue-600 */
    font-weight: 600;
    color: white;
    font-size: 0.875rem;
}

.brand-text {
    font-size: 0.875rem;
    font-weight: 600;
    letter-spacing: 0.025em;
    color: #f1f5f9; /* slate-100 */
}

.nav-search-dark {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 1rem;
}

.nav-search-dark > div {
    display: flex;
    width: 100%;
    max-width: 36rem; /* max-w-xl */
    align-items: center;
    gap: 0.5rem;
    border-radius: 1rem;
    border: 1px solid #334155; /* slate-700 */
    background: #0f172a; /* slate-900 */
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.nav-search-dark .search-input-dark {
    flex: 1;
}

.search-icon {
    font-size: 0.75rem;
    color: #94a3b8; /* slate-400 */
}

.search-input-dark {
    height: 1.5rem;
    flex: 1;
    background: transparent;
    font-size: 0.75rem;
    color: #f1f5f9; /* slate-100 */
    border: none;
    outline: none;
}

.search-input-dark::placeholder {
    color: #64748b; /* slate-500 */
}

.nav-links-dark {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #cbd5e1; /* slate-300 */
}

.nav-link-dark {
    color: #cbd5e1;
    text-decoration: none;
    transition: color 0.2s;
}

.nav-link-dark:hover {
    color: #f1f5f9; /* slate-50 */
}

.btn-dark-outline {
    border-radius: 9999px;
    border: 1px solid #334155; /* slate-700 */
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    background: transparent;
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-dark-outline:hover {
    border-color: #3b82f6; /* blue-500 */
    color: #60a5fa; /* blue-400 */
}

.btn-dark-primary {
    border-radius: 9999px;
    background: #2563eb; /* blue-600 */
    padding: 0.375rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #f1f5f9;
    border: none;
    cursor: pointer;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    transition: background 0.2s;
}

.btn-dark-primary:hover {
    background: #1d4ed8; /* blue-500 */
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.6875rem;
}

.user-badge-dark {
    background: #2563eb;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Main Content */
.stock-detail-main-dark {
    margin: 0 auto;
    width: 100%;
    max-width: 1400px; /* Increased from 1152px for better desktop usage */
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
}

@media (min-width: 1280px) {
    .stock-detail-main-dark {
        max-width: 1600px; /* Even larger for wide screens */
        padding: 2rem 1.5rem;
    }
}

@media (min-width: 1920px) {
    .stock-detail-main-dark {
        max-width: 1800px; /* Maximum for very wide screens */
    }
}

/* Stock Overview Header */
.stock-overview-header {
    display: grid;
    gap: 1rem;
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-900/60 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (min-width: 640px) {
    .stock-overview-header {
        grid-template-columns: repeat(3, 1fr);
    }
}

.overview-left {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.stock-badges {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #94a3b8; /* slate-400 */
}

.badge {
    border-radius: 9999px;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1); /* emerald-500/10 */
    color: #6ee7b7; /* emerald-300 */
}

.badge-default {
    background: #1e293b; /* slate-800 */
    color: #cbd5e1;
}

.company-name {
    font-size: 1.125rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-50 */
}

@media (min-width: 640px) {
    .company-name {
        font-size: 1.25rem;
    }
}

.stock-ticker {
    font-size: 0.75rem;
    color: #94a3b8; /* slate-400 */
}

.overview-middle {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.5rem;
}

@media (min-width: 640px) {
    .overview-middle {
        align-items: center;
    }
}

.price-display {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

.price-value {
    font-size: 1.5rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    color: #f1f5f9; /* slate-50 */
}

.price-change {
    font-size: 0.75rem;
}

.price-change.positive {
    color: #34d399; /* emerald-400 */
}

.price-change.negative {
    color: #f87171; /* rose-400 */
}

.day-range {
    display: flex;
    width: 100%;
    max-width: 20rem;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
}

.range-info {
    display: flex;
    justify-content: space-between;
}

.range-bar {
    height: 0.375rem;
    border-radius: 9999px;
    background: #1e293b; /* slate-800 */
}

.range-bar-fill {
    height: 0.375rem;
    border-radius: 9999px;
    background: #3b82f6; /* blue-500 */
    width: 66.67%;
}

.overview-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    font-size: 0.6875rem;
}

.stat-box {
    border-radius: 0.75rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 0.5rem 0.75rem;
}

.stat-label-small {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
    margin-bottom: 0.25rem;
}

.stat-value-small {
    font-weight: 600;
    color: #f1f5f9; /* slate-50 */
    font-size: 0.75rem;
}

.stat-value-small.positive {
    color: #34d399; /* emerald-400 */
}

/* Chart + Checklist Row */
.chart-checklist-row {
    display: grid;
    gap: 1rem;
    width: 100%;
}

@media (min-width: 1024px) {
    .chart-checklist-row {
        grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
        gap: 1.5rem;
    }
}

.chart-card {
    position: relative;
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

@media (min-width: 1024px) {
    .chart-card {
        padding: 1.5rem;
    }
}

.chart-controls {
    margin-bottom: 0.75rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    font-size: 0.6875rem;
}

.time-periods {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
}

.period-btn {
    border-radius: 9999px;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    background: #0f172a; /* slate-900 */
    color: #94a3b8; /* slate-400 */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.period-btn:hover {
    background: #1e293b; /* slate-800 */
}

.period-btn.active {
    background: #2563eb; /* blue-600 */
    color: #f1f5f9; /* slate-50 */
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.chart-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-option-btn {
    border-radius: 9999px;
    background: #0f172a; /* slate-900 */
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    color: #cbd5e1; /* slate-300 */
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.chart-option-btn:hover {
    background: #1e293b; /* slate-800 */
}

.chart-option-btn.active {
    color: #f1f5f9;
}

/* Indicators Dropdown */
.indicators-dropdown-container {
    position: relative;
}

.indicators-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.5rem;
    background: #1e293b; /* slate-800 */
    border: 1px solid #334155; /* slate-700 */
    border-radius: 0.5rem;
    padding: 0.5rem;
    min-width: 180px;
    z-index: 1000;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
}

.indicator-item {
    padding: 0.375rem 0.5rem;
    border-radius: 0.25rem;
    transition: background 0.2s;
}

.indicator-item:hover {
    background: #334155; /* slate-700 */
}

.indicator-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: #cbd5e1; /* slate-300 */
    user-select: none;
}

.indicator-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    cursor: pointer;
    accent-color: #3b82f6; /* blue-500 */
}

.indicator-checkbox span {
    flex: 1;
}

.chart-container {
    position: relative;
    height: 14rem; /* h-56 - default for mobile */
    min-height: 14rem;
    width: 100%;
    border-radius: 1rem;
    border: 1px dashed #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    padding: 1rem;
    font-size: 0.6875rem;
    color: #64748b; /* slate-500 */
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

/* Increase chart size on larger screens */
@media (min-width: 768px) {
    .chart-container {
        height: 20rem; /* h-80 - 320px */
        min-height: 20rem;
    }
}

@media (min-width: 1024px) {
    .chart-container {
        height: 28rem; /* h-[28rem] - 448px */
        min-height: 28rem;
        padding: 1.5rem;
    }
}

@media (min-width: 1280px) {
    .chart-container {
        height: 32rem; /* h-[32rem] - 512px */
        min-height: 32rem;
    }
}

.chart-container canvas {
    width: 100% !important;
    height: 100% !important;
    max-height: none;
    min-height: 200px;
}

@media (min-width: 768px) {
    .chart-container canvas {
        min-height: 300px;
    }
}

@media (min-width: 1024px) {
    .chart-container canvas {
        min-height: 400px;
    }
}

.chart-footer {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
}

.chart-legend {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.legend-color {
    height: 0.375rem;
    width: 1rem;
    border-radius: 9999px;
}

.legend-color.blue {
    background: #3b82f6; /* blue-500 */
}

.legend-color.green {
    background: #10b981; /* emerald-500 */
}

.chart-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-action-btn {
    border-radius: 9999px;
    border: 1px solid #334155; /* slate-700 */
    padding: 0.25rem 0.625rem;
    font-size: 0.625rem;
    background: transparent;
    color: #e2e8f0; /* slate-200 */
    cursor: pointer;
    transition: all 0.2s;
}

.chart-action-btn:hover {
    border-color: #475569; /* slate-500 */
}

/* Checklist Sidebar */
.checklist-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.checklist-card {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.checklist-title {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.checklist-items {
    list-style: none;
    padding: 0;
    margin: 0;
    margin-bottom: 0.75rem;
    font-size: 0.6875rem;
}

.checklist-items li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
    color: #cbd5e1; /* slate-300 */
}

.checklist-items li:last-child {
    margin-bottom: 0;
}

.checklist-icon {
    display: flex;
    height: 1rem;
    width: 1rem;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    font-size: 0.625rem;
}

.checklist-icon.success {
    background: rgba(16, 185, 129, 0.2); /* emerald-500/20 */
    color: #6ee7b7; /* emerald-300 */
}

.checklist-icon.warning {
    background: rgba(245, 158, 11, 0.2); /* amber-500/20 */
    color: #fcd34d; /* amber-300 */
}

.checklist-icon.error {
    background: rgba(244, 63, 94, 0.2); /* rose-500/20 */
    color: #fda4af; /* rose-300 */
}

.quality-score {
    margin-top: 0.75rem;
    border-radius: 1rem;
    background: rgba(15, 23, 42, 0.8); /* slate-950/80 */
    padding: 0.75rem;
    font-size: 0.6875rem;
}

.score-header {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.score-header span:first-child {
    color: #cbd5e1; /* slate-300 */
}

.score-value {
    font-size: 0.75rem;
    font-weight: 600;
    color: #34d399; /* emerald-400 */
}

.score-bar {
    height: 0.375rem;
    border-radius: 9999px;
    background: #1e293b; /* slate-800 */
}

.score-bar-fill {
    height: 0.375rem;
    border-radius: 9999px;
    background: linear-gradient(to right, #fbbf24, #34d399, #10b981); /* amber-400 to emerald-400 to emerald-500 */
    width: 82%;
}

.actions-card {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.actions-title {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.6875rem;
}

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

.notes-section {
    margin-top: 0.75rem;
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    padding: 0.5rem;
    font-size: 0.6875rem;
    color: #94a3b8; /* slate-400 */
}

.notes-label {
    margin-bottom: 0.25rem;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b; /* slate-500 */
}

.notes-text {
    font-size: 0.6875rem;
    color: #cbd5e1;
}

/* Metrics Section */
/* Analysis Sections (Financial & Price Analysis) */
.analysis-section {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    border: 1px solid #1e293b; /* slate-800 */
    border-radius: 1.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.analysis-header {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
}

.analysis-title-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.analysis-header h2 {
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
    margin: 0;
    font-size: 0.75rem;
}

.analysis-header p {
    font-size: 0.6875rem;
    color: #94a3b8; /* slate-400 */
    margin: 0;
}

/* Info Indicator Button */
.info-indicator {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 50%;
    border: 1px solid #475569; /* slate-600 */
    background: rgba(30, 41, 59, 0.6); /* slate-800/60 */
    color: #94a3b8; /* slate-400 */
    font-size: 0.6875rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.info-indicator:hover {
    background: rgba(30, 41, 59, 0.9); /* slate-800/90 */
    border-color: #64748b; /* slate-500 */
    color: #cbd5e1; /* slate-300 */
    transform: scale(1.1);
}

.info-indicator:active {
    transform: scale(0.95);
}

/* Info Tooltip/Modal */
.info-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.info-modal.active {
    display: flex;
}

.info-modal-content {
    background: rgba(15, 23, 42, 0.95); /* slate-900/95 */
    border: 1px solid #334155; /* slate-700 */
    border-radius: 1rem;
    padding: 1.5rem;
    max-width: 600px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    position: relative;
}

.info-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #334155; /* slate-700 */
}

.info-modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
    margin: 0;
}

.info-modal-close {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    border: 1px solid #475569; /* slate-600 */
    background: rgba(30, 41, 59, 0.6); /* slate-800/60 */
    color: #94a3b8; /* slate-400 */
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    line-height: 1;
}

.info-modal-close:hover {
    background: rgba(30, 41, 59, 0.9);
    border-color: #64748b;
    color: #cbd5e1;
}

.info-modal-body {
    font-size: 0.875rem;
    color: #cbd5e1; /* slate-300 */
    line-height: 1.6;
}

.info-modal-body h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
    margin: 1rem 0 0.5rem 0;
}

.info-modal-body h4:first-child {
    margin-top: 0;
}

.info-modal-body ul {
    margin: 0.5rem 0;
    padding-left: 1.5rem;
}

.info-modal-body li {
    margin: 0.25rem 0;
}

.info-modal-body p {
    margin: 0.5rem 0;
}

.analysis-content {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Score Cards Grid */
.score-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.75rem;
    font-size: 0.6875rem;
}

.score-card {
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    border: 1px solid #1e293b; /* slate-800 */
    border-radius: 1rem;
    padding: 0.75rem;
    transition: all 0.2s ease;
    position: relative;
    overflow: hidden;
}

.score-card:hover {
    border-color: #334155; /* slate-700 */
    background: rgba(15, 23, 42, 0.8);
}

.score-card-header {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.score-card-icon {
    font-size: 1rem;
    line-height: 1;
}

.score-card-title-group {
    flex: 1;
}

.score-card-title-row {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.score-card-title {
    font-size: 0.6875rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
    margin: 0;
    line-height: 1.2;
    flex: 1;
}

.score-info-indicator {
    width: 0.875rem;
    height: 0.875rem;
    font-size: 0.625rem;
    padding: 0;
    flex-shrink: 0;
}

.score-card-description {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
    margin: 0;
    line-height: 1.3;
}

.score-card-value {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.score-value-number {
    font-size: 1.125rem;
    font-weight: 600;
    line-height: 1;
}

.score-value-max {
    font-size: 0.6875rem;
    color: #94a3b8; /* slate-400 */
}

.score-card-progress {
    width: 100%;
    height: 6px;
    background: #1e293b; /* slate-800 */
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.score-progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.score-card-percentage {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
    text-align: right;
}

/* Analysis Details */
.analysis-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    font-size: 0.6875rem;
}

.analysis-metric-group {
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    border: 1px solid #1e293b; /* slate-800 */
    border-radius: 1rem;
    padding: 0.75rem;
}

.metric-group-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
    margin: 0 0 0.5rem 0;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #1e293b; /* slate-800 */
}

.metric-group-icon {
    font-size: 0.875rem;
}

.metric-group-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.analysis-metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: rgba(15, 23, 42, 0.4); /* slate-900/40 */
    border-radius: 0.5rem;
    transition: background 0.2s ease;
}

.analysis-metric-item:hover {
    background: rgba(15, 23, 42, 0.6); /* slate-900/60 */
}

.metric-label {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
    font-weight: 500;
}

.metric-value {
    font-size: 0.6875rem;
    color: #f1f5f9; /* slate-100 */
    font-weight: 600;
    text-align: right;
}

/* Responsive Design for Analysis Sections */
@media (min-width: 640px) {
    .score-cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .score-cards-grid {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .analysis-details {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .score-cards-grid {
        grid-template-columns: 1fr;
    }
    
    .analysis-details {
        grid-template-columns: 1fr;
    }
    
    .score-card-header {
        flex-direction: row;
    }
    
    .analysis-metric-item {
        flex-direction: row;
    }
}

.metrics-section {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.metrics-header {
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.metrics-header h2 {
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.metrics-header p {
    font-size: 0.6875rem;
    color: #94a3b8; /* slate-400 */
}

.metrics-grid-dark {
    display: grid;
    gap: 0.5rem;
    font-size: 0.6875rem;
}

@media (min-width: 640px) {
    .metrics-grid-dark {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 768px) {
    .metrics-grid-dark {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Technical Indicators Section */
.indicators-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--bg-secondary, rgba(15, 23, 42, 0.7));
    border-radius: 0.75rem;
    border: 1px solid var(--border-color, #1e293b);
}

.indicators-header {
    margin-bottom: 1.5rem;
}

.indicators-header h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    margin-bottom: 0.25rem;
}

.indicators-header p {
    font-size: 0.875rem;
    color: var(--text-secondary, #94a3b8);
}

.indicators-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.25rem;
}

.indicator-card {
    background: var(--bg-primary, rgba(15, 23, 42, 0.6));
    border-radius: 0.5rem;
    padding: 1.25rem;
    border: 1px solid var(--border-color, #1e293b);
    transition: transform 0.2s, box-shadow 0.2s;
}

.indicator-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.indicator-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.indicator-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.indicator-icon {
    font-size: 1.25rem;
}

.indicator-title h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary, #f1f5f9);
    margin: 0;
}

.indicator-status {
    font-size: 0.875rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 0.375rem;
    background: rgba(0, 0, 0, 0.2);
}

.indicator-value {
    font-size: 0.875rem;
    color: var(--text-secondary, #94a3b8);
    margin-bottom: 0.5rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
}

.indicator-details {
    font-size: 0.75rem;
    color: var(--text-tertiary, #64748b);
    margin-bottom: 0.75rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 0.25rem;
}

.indicator-range {
    margin-bottom: 0.75rem;
}

.range-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-secondary, rgba(15, 23, 42, 0.5));
    border-radius: 0.25rem;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.range-fill {
    height: 100%;
    border-radius: 0.25rem;
    transition: width 0.3s ease;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.625rem;
    color: var(--text-tertiary, #64748b);
}

.indicator-explanation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #1e293b);
}

.indicator-explanation p {
    font-size: 0.8125rem;
    color: var(--text-secondary, #94a3b8);
    line-height: 1.5;
    margin: 0;
}

/* Responsive adjustments for indicators */
@media (max-width: 768px) {
    .indicators-grid {
        grid-template-columns: 1fr;
    }
    
    .indicator-card {
        padding: 1rem;
    }
    
    .indicator-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .indicator-status {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .indicators-section {
        padding: 1rem;
    }
    
    .indicators-header h2 {
        font-size: 1.25rem;
    }
    
    .indicator-card {
        padding: 0.875rem;
    }
}

.metric-box {
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    padding: 0.75rem;
}

.metric-box-label {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
    margin-bottom: 0.25rem;
}

.metric-box-value {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-50 */
}

/* Financials + Pros/Cons Row */
.financials-proscons-row {
    display: grid;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent row overflow */
    overflow-y: visible;
}

@media (min-width: 1024px) {
    .financials-proscons-row {
        grid-template-columns: minmax(0, 2.1fr) minmax(260px, 0.9fr);
    }
}

.financials-card {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent card from overflowing, let inner container scroll */
    overflow-y: visible;
    position: relative;
}

.financials-header {
    margin-bottom: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    font-size: 0.75rem;
}

.financials-header h2 {
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.financial-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.financial-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: 0.6875rem;
}

.financial-view-toggle {
    display: flex;
    gap: 0.25rem;
    border-radius: 0.5rem;
    background: #0f172a; /* slate-900 */
    padding: 0.125rem;
    border: 1px solid #1e293b; /* slate-800 */
}

.view-toggle-btn {
    border-radius: 0.375rem;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    background: transparent;
    color: #94a3b8; /* slate-400 */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.view-toggle-btn:hover {
    color: #cbd5e1; /* slate-300 */
}

.view-toggle-btn.active {
    background: #1e293b; /* slate-800 */
    color: #f1f5f9; /* slate-100 */
}

.financial-content {
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent content overflow, let table container scroll */
    overflow-y: visible;
}

.financial-chart-container {
    height: 400px;
    padding: 1rem;
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
}

.financial-tab {
    border-radius: 9999px;
    padding: 0.25rem 0.625rem;
    font-size: 0.6875rem;
    font-weight: 500;
    background: #0f172a; /* slate-900 */
    color: #94a3b8; /* slate-400 */
    border: none;
    cursor: pointer;
    transition: all 0.2s;
}

.financial-tab:hover {
    background: #1e293b; /* slate-800 */
}

.financial-tab.active {
    background: #f1f5f9; /* slate-100 */
    color: #0f172a; /* slate-900 */
}

.financial-table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    font-size: 0.6875rem;
    position: relative;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Ensure container can scroll when content exceeds */
    min-width: 0;
    /* Add visual scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #475569 #1e293b;
}

.financial-table-container::-webkit-scrollbar {
    height: 8px;
}

.financial-table-container::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

.financial-table-container::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.financial-table-container::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.financial-note {
    margin: 0;
    padding: 0.75rem 1rem;
    font-size: 0.75rem;
    color: #94a3b8; /* slate-400 */
    text-align: right;
    border-top: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.8); /* slate-950/80 */
    font-style: italic;
}

.financial-chart-container {
    position: relative;
}

.financial-table {
    width: max-content; /* Allow table to expand based on content */
    min-width: 100%; /* Ensure table is at least container width */
    border-collapse: collapse;
    table-layout: auto;
    /* Ensure table doesn't cause container to overflow */
    display: table;
}

.financial-table thead {
    background: rgba(15, 23, 42, 0.8); /* slate-900/80 */
}

.financial-table th {
    font-size: 0.625rem;
    color: #cbd5e1; /* slate-300 */
    padding: 0.5rem 0.25rem;
    text-align: left;
    font-weight: 500;
    white-space: nowrap;
}

.financial-table th.sticky {
    position: sticky;
    left: 0;
    background: rgba(15, 23, 42, 0.9); /* slate-900/90 */
    z-index: 10;
}

.financial-table th.text-right {
    text-align: right;
}

.financial-table tbody tr {
    border-top: 1px solid #1e293b; /* slate-800 */
}

.financial-table tbody tr.highlight {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
}

.financial-table td {
    padding: 0.5rem 0.25rem;
    color: #e2e8f0; /* slate-200 */
    white-space: nowrap;
}

.financial-table td.sticky {
    position: sticky;
    left: 0;
    background: rgba(15, 23, 42, 0.95); /* slate-950/95 */
    z-index: 5;
    color: #cbd5e1; /* slate-300 */
}

.financial-table td.text-right {
    text-align: right;
}

.financial-table td.positive {
    color: #6ee7b7; /* emerald-300 */
}

.financial-table td.negative {
    color: #fda4af; /* rose-300 */
}

.proscons-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 100%;
    overflow-x: visible;
}

.proscons-card {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-wrap: break-word;
    word-wrap: break-word;
    overflow-x: hidden; /* Prevent card overflow, let inner sections scroll */
    overflow-y: visible;
    position: relative;
}

.proscons-card h2 {
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.proscons-grid {
    display: grid;
    gap: 0.75rem;
    font-size: 0.6875rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent grid overflow, let sections scroll */
    overflow-y: visible;
}

@media (min-width: 640px) {
    .proscons-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Pros and Cons sections - make scrollable when content exceeds */
.pros-section,
.cons-section {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: auto; /* Scroll horizontally when content exceeds */
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
    /* Add visual scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #475569 #1e293b;
}

.pros-section::-webkit-scrollbar,
.cons-section::-webkit-scrollbar {
    height: 6px;
}

.pros-section::-webkit-scrollbar-track,
.cons-section::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 3px;
}

.pros-section::-webkit-scrollbar-thumb,
.cons-section::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 3px;
}

.pros-section::-webkit-scrollbar-thumb:hover,
.cons-section::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.pros-title {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #6ee7b7; /* emerald-300 */
}

.cons-title {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #fda4af; /* rose-300 */
}

.proscons-list {
    list-style: none;
    padding: 0;
    margin: 0;
    color: #cbd5e1; /* slate-300 */
    width: 100%;
    max-width: 100%;
    overflow-x: visible; /* Let parent section handle scrolling */
    overflow-y: visible;
    min-width: 0;
    box-sizing: border-box;
}

.proscons-list li {
    margin-bottom: 0.375rem;
    font-size: 0.6875rem;
    line-height: 1.5;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    box-sizing: border-box;
    padding-right: 0.5rem; /* Space for scrollbar if needed */
    white-space: normal;
}

.proscons-list li:last-child {
    margin-bottom: 0;
}

.peer-comparison-card {
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden; /* Prevent card overflow, let table container scroll */
    overflow-y: visible;
    position: relative;
}

.peer-header {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.75rem;
}

.peer-header h2 {
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.peer-header p {
    font-size: 0.6875rem;
    color: #94a3b8; /* slate-400 */
}

.peer-table-container {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    font-size: 0.625rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    /* Add visual scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #475569 #1e293b;
}

.peer-table-container::-webkit-scrollbar {
    height: 8px;
}

.peer-table-container::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

.peer-table-container::-webkit-scrollbar-thumb {
    background: #475569;
    border-radius: 4px;
}

.peer-table-container::-webkit-scrollbar-thumb:hover {
    background: #64748b;
}

.peer-table {
    min-width: 100%;
    width: max-content; /* Allow table to expand based on content */
    border-collapse: collapse;
    table-layout: auto;
}

.peer-table thead {
    background: rgba(15, 23, 42, 0.8); /* slate-900/80 */
}

.peer-table th {
    color: #cbd5e1; /* slate-300 */
    padding: 0.5rem 0.375rem;
    text-align: left;
    font-size: 0.625rem;
    font-weight: 500;
}

.peer-table tbody tr {
    border-top: 1px solid #1e293b; /* slate-800 */
}

.peer-table tbody tr.highlight {
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
}

.peer-table tbody tr:hover {
    background: rgba(15, 23, 42, 0.5); /* slate-900/50 */
}

.peer-table td {
    padding: 0.375rem 0.375rem;
    color: #e2e8f0; /* slate-200 */
    font-size: 0.625rem;
}

.peer-table td.highlight {
    font-weight: 600;
    color: #f1f5f9; /* slate-50 */
}

/* News & Filings Section */
.news-filings-section {
    display: grid;
    gap: 1rem;
    border-radius: 1.5rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.7); /* slate-900/70 */
    padding: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

@media (min-width: 1024px) {
    .news-filings-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

.news-section h2,
.filings-section h2 {
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #f1f5f9; /* slate-100 */
}

.news-list,
.filings-list {
    font-size: 0.6875rem;
}

.news-item,
.filing-item {
    border-radius: 1rem;
    border: 1px solid #1e293b; /* slate-800 */
    background: rgba(15, 23, 42, 0.6); /* slate-950/60 */
    padding: 0.75rem;
    margin-bottom: 0.5rem;
}

.news-item:last-child,
.filing-item:last-child {
    margin-bottom: 0;
}

.news-header {
    margin-bottom: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.news-title {
    font-size: 0.6875rem;
    font-weight: 500;
    color: #f1f5f9; /* slate-100 */
}

.news-badge {
    border-radius: 9999px;
    background: rgba(16, 185, 129, 0.1); /* emerald-500/10 */
    padding: 0.125rem 0.5rem;
    font-size: 0.5625rem;
    color: #6ee7b7; /* emerald-300 */
}

.news-meta {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
}

.filing-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.filing-info p:first-child {
    font-size: 0.6875rem;
    color: #f1f5f9; /* slate-100 */
    margin-bottom: 0.125rem;
}

.filing-info p:last-child {
    font-size: 0.625rem;
    color: #94a3b8; /* slate-400 */
}

.filing-view-btn {
    border-radius: 9999px;
    border: 1px solid #334155; /* slate-700 */
    padding: 0.25rem 0.625rem;
    font-size: 0.625rem;
    background: transparent;
    color: #e2e8f0; /* slate-200 */
    cursor: pointer;
    transition: all 0.2s;
}

.filing-view-btn:hover {
    border-color: #3b82f6; /* blue-500 */
    color: #60a5fa; /* blue-400 */
}

/* Loading & Error States */
.loading-container-dark,
.error-container-dark {
    text-align: center;
    padding: 4rem 2rem;
    color: #cbd5e1;
}

.loading-spinner-dark {
    border: 3px solid #1e293b;
    border-top-color: #3b82f6;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 1rem;
}

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

.error-container-dark h2 {
    color: #f87171;
    margin-bottom: 1rem;
}

/* Footer */
.footer-dark {
    margin-bottom: 1rem;
    margin-top: 0.5rem;
    text-align: center;
    font-size: 0.625rem;
    color: #64748b; /* slate-500 */
    padding: 1rem 0;
}

/* Responsive */
@media (max-width: 768px) {
    /* Base mobile fixes */
    .container {
        padding: 0 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .stock-detail-main-dark {
        padding: 1rem 0.75rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        gap: 1rem !important;
    }
    
    .stock-detail-container {
        padding: 1rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .navbar-dark .container {
        flex-wrap: wrap;
        padding: 0.75rem 1rem !important;
    }
    
    .nav-search-dark {
        order: 3;
        width: 100%;
        padding: 0.5rem 0;
        box-sizing: border-box;
    }
    
    .stock-overview-header {
        grid-template-columns: 1fr;
        padding: 1rem !important;
        margin: 0 !important;
    }
    
    .overview-middle {
        align-items: flex-start;
        padding: 0.5rem !important;
    }
    
    .chart-checklist-row {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .financials-proscons-row {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .news-filings-section {
        grid-template-columns: 1fr;
        padding: 1rem !important;
        margin: 0 !important;
    }
    
    /* Financial card - fit to screen like Key Metrics */
    .financials-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Constrain card, let container scroll */
        overflow-y: visible !important;
    }
    
    /* Ensure financial content section allows scrolling */
    .financial-content {
        overflow-x: hidden !important; /* Constrain content, let table container scroll */
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Financial table mobile fixes - scrollable when content exceeds */
    .financial-table-container {
        overflow-x: auto !important; /* Scroll when content exceeds */
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        box-sizing: border-box !important;
        display: block !important;
        min-width: 0 !important; /* Critical: Allow container to shrink */
        /* Force hardware acceleration for smooth scrolling */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    .financial-table {
        min-width: 100% !important; /* At least container width */
        width: max-content !important; /* Allow expansion based on content */
        table-layout: auto !important;
        display: table !important;
        /* Ensure table doesn't break out of container */
        max-width: none !important;
    }
    
    /* Peer comparison card - fit to screen */
    .peer-comparison-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Prevent card overflow, let container handle scrolling */
        overflow-y: visible !important;
    }
    
    /* Peer table mobile fixes - scrollable when content exceeds */
    .peer-table-container {
        overflow-x: auto !important; /* Scroll when content exceeds */
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        position: relative !important;
    }
    
    .peer-table {
        min-width: 100% !important; /* At least container width */
        width: max-content !important; /* Allow expansion based on content */
        table-layout: auto !important;
    }
    
    /* Pros/Cons mobile fixes */
    .proscons-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
        overflow-x: visible !important;
    }
    
    .proscons-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
        overflow-x: hidden !important; /* Constrain card, let sections scroll */
        overflow-y: visible !important;
        position: relative !important;
        min-height: 0 !important;
    }
    
    .proscons-grid {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important; /* Constrain grid, let sections scroll */
        min-width: 0 !important;
        display: grid !important;
        grid-template-columns: 1fr !important; /* Single column on mobile */
        gap: 0.75rem !important;
        box-sizing: border-box !important;
    }
    
    /* Pros and Cons sections - scrollable when content exceeds */
    .pros-section,
    .cons-section {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important; /* Scroll when content exceeds */
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        display: block !important;
    }
    
    .proscons-list {
        width: auto !important; /* Allow list to expand */
        min-width: 100% !important; /* At least full width */
        max-width: none !important; /* Remove max-width constraint */
        overflow-x: visible !important; /* Let section handle scrolling */
        overflow-y: visible !important;
        display: block !important;
        box-sizing: border-box !important;
    }
    
    .proscons-list li {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto !important;
        width: auto !important; /* Allow content to determine width */
        min-width: 100% !important; /* At least full width */
        max-width: none !important; /* Remove max-width constraint */
        box-sizing: border-box !important;
        padding-right: 0.5rem !important;
        padding-left: 0 !important;
        white-space: normal !important;
        display: block !important;
    }
    
    /* If text still doesn't fit, make it scrollable */
    .proscons-card h2,
    .pros-title,
    .cons-title {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Text content fixes */
    p, span, div, h1, h2, h3, h4, h5, h6 {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }
    
    /* All cards and containers */
    .card, .section-card, .overview-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 1rem !important;
        box-sizing: border-box !important;
        margin: 0 0 1rem 0 !important;
    }
}

/* AI Agent Chat - Floating Draggable Widget */
.ai-agent-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    display: flex !important;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
    top: auto !important;
    left: auto !important;
    width: auto !important;
    height: auto !important;
    max-width: none !important;
    max-height: none !important;
    transform: none !important;
    /* Ensure it's always relative to viewport */
    contain: layout style paint !important;
    isolation: isolate !important;
}


/* When chat is open, ensure widget doesn't interfere with chat box positioning */
.ai-agent-widget.chat-open {
    pointer-events: none !important;
}

.ai-agent-widget.chat-open > *:not(.ai-agent-chat-box) {
    pointer-events: none !important;
}

.ai-agent-widget > * {
    pointer-events: all;
}

/* AI Agent Avatar Button (Always Visible) */
.ai-agent-avatar-btn {
    width: auto;
    height: auto;
    min-width: 70px;
    min-height: 70px;
    border-radius: 50%;
    background: transparent;
    border: 3px solid #3b82f6; /* blue-500 */
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.4), 0 5px 10px -5px rgba(0, 0, 0, 0.3);
    cursor: move;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    overflow: visible;
    z-index: 10000;
    padding: 0;
    touch-action: none;
}

.ai-agent-avatar-btn.dragging {
    cursor: grabbing;
    transform: scale(1.05);
}

.ai-agent-avatar-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px -5px rgba(59, 130, 246, 0.5), 0 10px 15px -5px rgba(0, 0, 0, 0.4);
    border-color: #60a5fa; /* blue-400 */
}

.ai-agent-avatar-btn:active {
    transform: scale(1.05);
}

.ai-agent-avatar-img {
    width: auto;
    height: auto;
    max-width: 70px;
    max-height: 70px;
    border-radius: 0;
    object-fit: contain;
    pointer-events: none;
    display: block;
}

/* Pulsing animation for agent */
.ai-agent-pulse {
    position: absolute;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 2px solid #3b82f6;
    animation: pulse-ring 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    pointer-events: none;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

.ai-agent-chat-box {
    width: 380px;
    max-width: calc(100vw - 40px);
    background: #0f172a; /* slate-900 */
    border: 1px solid #1e293b; /* slate-800 */
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 0;
    box-sizing: border-box;
}

.ai-agent-widget.chat-open .ai-agent-chat-box {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
    max-height: 600px;
}

.ai-agent-chat-header {
    background: #1e293b; /* slate-800 */
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
    user-select: none;
    border-bottom: 1px solid #334155;
}

.ai-agent-chat-header:active {
    cursor: grabbing;
}

.ai-agent-chat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #f1f5f9;
    font-weight: 600;
    font-size: 0.9375rem;
}

.ai-agent-chat-icon {
    width: 24px;
    height: 24px;
    border-radius: 0;
    object-fit: contain;
}

.ai-agent-close-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: all 0.2s;
    width: 28px;
    height: 28px;
}

.ai-agent-close-btn:hover {
    background: #334155;
    color: #f1f5f9;
}

.ai-agent-widget.dragging .ai-agent-chat-box {
    cursor: grabbing;
}

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: 500px;
    max-height: 70vh;
    background: #020617; /* slate-950 */
    overflow: hidden;
}

.ai-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding: 1.5rem;
    display: flex !important;
    flex-direction: column !important;
    gap: 1rem;
    min-height: 0 !important; /* Important for flex scrolling */
    width: 100% !important;
    box-sizing: border-box !important;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #0f172a;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease-in;
}

.ai-message-user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 0;
    overflow: visible;
    background: transparent;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-avatar-small {
    width: auto;
    height: 100%;
    max-width: 32px;
    max-height: 32px;
    object-fit: contain;
}

.ai-message-content {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
}

.ai-message-bot .ai-message-content {
    background: #1e293b; /* slate-800 */
    color: #e2e8f0;
    border-bottom-left-radius: 0.25rem;
}

.ai-message-formatted {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.ai-message-formatted p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.ai-message-formatted p:first-child {
    margin-top: 0;
}

.ai-message-formatted p:last-child {
    margin-bottom: 0;
}

.ai-message-formatted h1,
.ai-message-formatted h2,
.ai-message-formatted h3 {
    margin: 1rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.3;
}

.ai-message-formatted h1 {
    font-size: 1.25rem;
    color: #f1f5f9;
}

.ai-message-formatted h2 {
    font-size: 1.125rem;
    color: #e2e8f0;
}

.ai-message-formatted h3 {
    font-size: 1rem;
    color: #cbd5e1;
}

.ai-message-formatted ul,
.ai-message-formatted ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
    line-height: 1.6;
}

.ai-message-formatted li {
    margin: 0.5rem 0;
    padding-left: 0.5rem;
}

.ai-message-formatted strong {
    font-weight: 600;
    color: #f1f5f9;
}

.ai-message-formatted em {
    font-style: italic;
    color: #cbd5e1;
}

.ai-message-formatted code {
    background: #0f172a;
    color: #60a5fa;
    padding: 0.2rem 0.4rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Courier New', monospace;
}

.ai-message-formatted pre {
    background: #0f172a;
    color: #e2e8f0;
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.75rem 0;
    border: 1px solid #334155;
}

.ai-message-formatted pre code {
    background: transparent;
    padding: 0;
    color: inherit;
}

.ai-message-formatted a {
    color: #60a5fa;
    text-decoration: underline;
    transition: color 0.2s;
}

.ai-message-formatted a:hover {
    color: #93c5fd;
}

.ai-message-formatted .currency {
    color: #34d399;
    font-weight: 600;
}

.ai-message-formatted .percentage {
    color: #60a5fa;
    font-weight: 500;
}

.ai-message-formatted .number {
    color: #fbbf24;
    font-weight: 500;
}

.ai-message-user .ai-message-content {
    background: #3b82f6; /* blue-500 */
    color: #ffffff;
    border-bottom-right-radius: 0.25rem;
}

.ai-message-content p {
    margin: 0;
    font-size: 0.9375rem;
}

.ai-message-loading {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
}

.ai-message-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
    animation: bounce 1.4s infinite ease-in-out both;
}

.ai-message-loading span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-message-loading span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

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

.ai-chat-input-container {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: #0f172a;
    border-top: 1px solid #1e293b;
}

.ai-chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 0.75rem;
    color: #f1f5f9;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s;
}

.ai-chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.ai-chat-input::placeholder {
    color: #64748b;
}

.ai-chat-send-btn {
    padding: 0.75rem 1.25rem;
    background: #3b82f6;
    border: none;
    border-radius: 0.75rem;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-chat-send-btn:hover:not(:disabled) {
    background: #2563eb;
    transform: translateY(-1px);
}

.ai-chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ai-chat-send-btn svg {
    width: 20px;
    height: 20px;
}

/* Responsive adjustments for AI chat */
@media (max-width: 768px) {
    /* Ensure no horizontal overflow */
    html, body {
        overflow-x: hidden !important;
        width: 100% !important;
        max-width: 100vw !important;
        position: relative;
    }
    
    .ai-agent-widget {
        position: fixed !important;
        right: 15px !important;
        bottom: 15px !important;
        z-index: 99999 !important;
        margin: 0 !important;
        padding: 0 !important;
        top: auto !important;
        left: auto !important;
        max-width: calc(100vw - 30px) !important;
        /* Ensure it's always in viewport on mobile */
        will-change: transform !important;
        backface-visibility: hidden !important;
        box-sizing: border-box !important;
    }
    
    .ai-agent-avatar-btn {
        min-width: 60px;
        min-height: 60px;
        max-width: 60px;
        max-height: 60px;
        position: relative;
        z-index: 100000;
        box-sizing: border-box;
    }
    
    .ai-agent-avatar-img {
        max-width: 60px;
        max-height: 60px;
    }
    
    .ai-agent-pulse {
        width: 60px;
        height: 60px;
    }
    
    .ai-agent-chat-box {
        width: calc(100vw - 30px) !important;
        max-width: calc(100vw - 30px) !important;
        min-width: 0 !important;
        right: 0;
        position: relative;
    }
    
    .ai-chat-container {
        height: 400px;
        max-height: 60vh;
        overflow-x: hidden;
    }
    
    .ai-message-content {
        max-width: 85%;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    /* Ensure main content doesn't overflow, but allow proscons to scroll */
    main, .container, .stock-detail-container, .stock-detail-main-dark {
        width: 100% !important;
        max-width: 100vw !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }
    
    /* Allow proscons sidebar to scroll independently */
    .financials-proscons-row {
        overflow-x: visible !important;
    }
    
    .proscons-sidebar {
        overflow-x: visible !important;
    }
    
    /* Additional text wrapping for all content */
    .stock-overview-header,
    .chart-card,
    .checklist-card,
    .financial-content,
    .proscons-sidebar,
    .peer-comparison-card,
    .news-filings-section {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        hyphens: auto;
    }
    
    /* Ensure all text elements wrap */
    .company-name,
    .price-value,
    .stat-value-small,
    .pros-title,
    .cons-title,
    .news-title,
    .filing-info p {
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: 100% !important;
    }
}

/* Extra small devices (< 400px) - Samsung Galaxy S8+, iPhone SE, etc. */
@media (max-width: 400px) {
    /* Ensure all containers are properly constrained */
    .container,
    .stock-detail-main-dark,
    .stock-detail-container {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 0.5rem !important;
        padding-right: 0.5rem !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Prevent any horizontal overflow */
    }
    
    /* Financial card - extra constraints for very small screens */
    .financials-card {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0.75rem !important;
        margin: 0 !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Critical: Prevent card overflow */
        overflow-y: visible !important;
        position: relative !important;
    }
    
    /* Financial content - ensure no overflow */
    .financial-content {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Critical: Prevent content overflow */
        overflow-y: visible !important;
        position: relative !important;
    }
    
    /* Financial table container - must scroll, never overflow */
    .financial-table-container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important; /* Critical: Allow container to shrink */
        box-sizing: border-box !important;
        overflow-x: auto !important; /* Must scroll horizontally */
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        margin: 0 !important;
        padding: 0 !important;
        position: relative !important;
        display: block !important;
        /* Force hardware acceleration */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
        will-change: scroll-position;
    }
    
    /* Financial table - ensure it can expand but container scrolls */
    .financial-table {
        width: max-content !important; /* Table can be wider than container */
        min-width: 100% !important; /* At least container width */
        table-layout: auto !important;
        display: table !important;
        /* Ensure table doesn't break out */
        max-width: none !important;
    }
    
    /* Reduce font size and padding for very small screens */
    .financial-table th,
    .financial-table td {
        font-size: 0.5625rem !important; /* Slightly smaller */
        padding: 0.375rem 0.15rem !important; /* Reduced padding */
    }
    
    /* Ensure parent row doesn't overflow */
    .financials-proscons-row {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow-x: hidden !important; /* Critical */
        overflow-y: visible !important;
    }
    
    /* Peer table container - same fixes */
    .peer-table-container {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
        -webkit-overflow-scrolling: touch !important;
        touch-action: pan-x !important;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
    
    .peer-table {
        width: max-content !important;
        min-width: 100% !important;
        max-width: none !important;
    }
    
    .peer-table th,
    .peer-table td {
        font-size: 0.5625rem !important;
        padding: 0.375rem 0.15rem !important;
    }
}
