/**
 * styles.css - Main Stylesheet
 * Professional financial/trading theme with responsive design
 */

/* CSS Variables for theming */
:root {
    --primary-color: #1a73e8;
    --primary-color-rgb: 26, 115, 232;
    --secondary-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc04;
    --background-color: #f8f9fa;
    --surface-color: #ffffff;
    --text-primary: #202124;
    --text-secondary: #5f6368;
    --border-color: #dadce0;
    --success-color: #34a853;
    --error-color: #ea4335;
    --info-color: #4285f4;
    --info-light: rgba(66, 133, 244, 0.1);
    
    /* Watchlist hover states - Light theme */
    --watchlist-hover-bg: rgba(26, 115, 232, 0.08);
    --watchlist-selected-bg: rgba(26, 115, 232, 0.15);
    
    /* Background colors for status indicators */
    --success-background: rgba(52, 168, 83, 0.1);
    --error-background: rgba(234, 67, 53, 0.1);
    --primary-background: rgba(26, 115, 232, 0.1);
    
    --shadow-sm: 0 1px 2px 0 rgba(60, 64, 67, 0.3), 0 1px 3px 1px rgba(60, 64, 67, 0.15);
    --shadow-md: 0 1px 3px 0 rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
    --shadow-lg: 0 2px 6px 2px rgba(60, 64, 67, 0.15), 0 8px 24px 4px rgba(60, 64, 67, 0.15);
    
    /* Collapsible section variables */
    --section-border: var(--border-color);
    --section-header-bg: var(--surface-color);
    --section-header-hover: rgba(26, 115, 232, 0.05);
    
    /* Pattern Integration variables */
    --pattern-integration-bg: rgba(156, 39, 176, 0.08);
    --pattern-integration-border: #9c27b0;
    --pattern-filter-bg: var(--surface-color);
    --pattern-stat-bg: rgba(76, 175, 80, 0.1);
    
    /* Input Backgrounds */
    --input-bg: #f1f5f9;
    --text-color: var(--text-primary);
}

/* Theme System */
/* Dark Theme */
[data-theme="dark"] {
    --primary-color: #4285f4;
    --primary-color-rgb: 66, 133, 244;
    --secondary-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc04;
    --background-color: #121212;
    --surface-color: #1e1e1e;
    --text-primary: #ffffff;
    --text-secondary: #b3b3b3;
    --border-color: #333333;
    --success-color: #34a853;
    --error-color: #ea4335;
    
    /* Input Backgrounds - Dark */
    --input-bg: #3d3d3d;
    --text-color: var(--text-primary);
    
    /* Watchlist hover states - Dark theme */
    --watchlist-hover-bg: rgba(66, 133, 244, 0.15);
    --watchlist-selected-bg: rgba(66, 133, 244, 0.25);
    
    /* Background variations for nested elements */
    --success-background: rgba(52, 168, 83, 0.2);
    --error-background: rgba(234, 67, 53, 0.2);
    --primary-background: rgba(66, 133, 244, 0.2);
    
    /* Dark theme shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5), 0 1px 3px 1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 1px 3px 0 rgba(0, 0, 0, 0.5), 0 4px 8px 3px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 2px 6px 2px rgba(0, 0, 0, 0.3), 0 8px 24px 4px rgba(0, 0, 0, 0.5);
}

/* Professional Blue Theme */
[data-theme="blue"] {
    --primary-color: #0d47a1;
    --secondary-color: #1976d2;
    --danger-color: #d32f2f;
    --warning-color: #f57c00;
    --background-color: #e3f2fd;
    --surface-color: #ffffff;
    --text-primary: #0d47a1;
    --text-secondary: #1565c0;
    --border-color: #90caf9;
    --success-color: #388e3c;
    --error-color: #d32f2f;
    
    /* Watchlist hover states - Blue theme */
    --watchlist-hover-bg: rgba(13, 71, 161, 0.1);
    --watchlist-selected-bg: rgba(13, 71, 161, 0.2);
    
    /* Blue theme specific backgrounds */
    --success-background: rgba(56, 142, 60, 0.1);
    --error-background: rgba(211, 47, 47, 0.1);
    --primary-background: rgba(13, 71, 161, 0.1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background-color);
    font-size: 16px;
}

/* Header */
header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
    padding: 0;
    box-shadow: var(--shadow-md);
}

/* Dark theme header adjustments */
[data-theme="dark"] header {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
}

/* Blue theme header adjustments */
[data-theme="blue"] header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
}

.header-content {
    padding: 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-main {
    flex: 1;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.header-about-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.header-about-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-about-btn .icon {
    font-size: 1.1rem;
}

.header-about-btn .text {
    font-size: 0.9rem;
}

/* Dual Tab Controls */
.dual-tab-controls {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.75rem;
    min-width: 280px;
}

.toggle-switch {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: relative;
    width: 50px;
    height: 24px;
    background-color: rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    transition: background-color 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background-color: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider {
    background-color: rgba(52, 168, 83, 0.8);
}

.toggle-switch input[type="checkbox"]:checked + .toggle-slider::before {
    transform: translateX(26px);
}

.toggle-label {
    color: white;
    font-weight: 500;
    font-size: 0.9rem;
}

.tab-selectors {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.tab-selectors select {
    padding: 0.5rem 0.75rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-primary);
    font-size: 0.85rem;
    cursor: pointer;
    min-width: 130px;
}

.tab-selectors select:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5);
}

/* Split Workspace Layout */
.split-workspace-container {
    display: none; /* Default to hidden, activated by JavaScript */
    grid-template-columns: 1fr 4px 1fr; /* Two columns with 4px divider */
    gap: 0; /* No gap since we have the divider */
    height: calc(100vh - 200px);
    overflow: hidden;
    padding: 0 1.5rem;
    margin: 0;
    max-width: none; /* Override any width restrictions */
    width: 100vw; /* Full viewport width */
    box-sizing: border-box;
}

/* When activated, change to grid */
.split-workspace-container.active {
    display: grid;
}

.workspace-left,
.workspace-right {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    overflow-y: auto;
    border: 1px solid var(--border-color);
    min-height: 0; /* Allow grid items to shrink */
}

.workspace-left .tab-content,
.workspace-right .tab-content {
    height: 100%;
    padding: 1.5rem;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Workspace Divider */
.workspace-divider {
    position: relative;
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.workspace-divider:hover {
    background: var(--primary-color);
}

.divider-handle {
    position: absolute;
    width: 20px;
    height: 60px;
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

.divider-handle::before {
    content: '⋮';
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1;
}

.workspace-divider:hover .divider-handle {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.workspace-divider:hover .divider-handle::before {
    color: white;
}

.workspace-divider.dragging {
    background: var(--primary-color);
}

.workspace-divider.dragging .divider-handle {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.workspace-divider.dragging .divider-handle::before {
    color: white;
}

.single-tab-container {
    display: block;
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1rem;
    opacity: 0.9;
    font-weight: 400;
}

/* Main container */
main {
    position: relative;
}

/* Main container for single tab mode only */
main .single-tab-container {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

/* Dual tab container breaks out of main's width restrictions */
main .dual-tab-container {
    position: relative;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}

/* Tab Navigation */
.tab-navigation-container {
    background: var(--surface-color);
    border-radius: 8px 8px 0 0;
    box-shadow: var(--shadow-sm);
    margin-bottom: 0;
}

.tab-navigation {
    display: flex;
}

.primary-tabs {
    border-bottom: 1px solid var(--border-color);
}

.secondary-tabs {
    background: var(--background-color);
    border-radius: 0;
}

.tab-button {
    flex: 1;
    padding: 0.875rem 1.5rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 0;
    white-space: nowrap;
}

/* Primary tab styling */
.primary-tabs .tab-button:first-child {
    border-radius: 8px 0 0 0;
}

.primary-tabs .tab-button:last-child {
    border-radius: 0 8px 0 0;
}

/* Secondary tab styling  */
.secondary-tabs .tab-button {
    font-size: 0.85rem;
    padding: 0.75rem 1.25rem;
}

.secondary-tabs .tab-button:first-child {
    border-radius: 0;
}

.secondary-tabs .tab-button:last-child {
    border-radius: 0;
}

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

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

/* Feature notice styling */
.feature-notice {
    background: var(--warning-background);
    border: 1px solid var(--warning-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin: 1rem 0;
    color: var(--warning-text);
    font-size: 0.9rem;
}

/* Tab Content */
.tab-content {
    display: none;
}

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

/* Sub-Tab Navigation */
.sub-tab-navigation {
    display: flex;
    background: var(--background-color);
    border-radius: 6px;
    padding: 4px;
    margin: 1rem 0 2rem 0;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sub-tab-button {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    border-radius: 4px;
    margin: 2px;
}

.sub-tab-button:hover {
    background: var(--surface-color);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.sub-tab-button.active {
    background: var(--surface-color);
    color: var(--primary-color);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}

/* Sub-Tab Content */
.sub-tab-content {
    display: none;
}

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

/* API Status Inline (for Analysis tab) */
.api-status-inline {
    background: var(--surface-color);
    padding: 1rem 2rem;
    margin-bottom: 2rem;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

/* Fundamental Toggle Inline */
.fundamental-toggle-inline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.fundamental-config-inline {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.inline-control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.inline-checkbox {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.inline-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
}

.inline-select {
    font-size: 0.85rem;
    padding: 4px 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-width: 140px;
}

.fundamental-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
    white-space: nowrap;
}

@media (max-width: 768px) {
    .api-status-inline {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .fundamental-toggle-inline {
        align-self: flex-start;
    }
    
    .inline-control-group {
        flex-wrap: wrap;
    }
    
    .inline-select {
        min-width: 120px;
    }
    
    .fundamental-hint {
        white-space: normal;
    }
}

/* Section styles */
section {
    background: var(--surface-color);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

section h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

/* Section header with minimize/maximize functionality */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
    flex-grow: 1;
}

.minimize-btn {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-secondary);
    border-radius: 4px;
    transition: all 0.2s ease;
}

.minimize-btn:hover {
    background-color: var(--border-color);
    color: var(--text-primary);
}

/* Historical View Toggle */
.historical-view-toggle {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.view-toggle-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--surface-color);
    color: var(--text-secondary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

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

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

/* Cache Warning Styles */
.cache-warning {
    background: rgba(251, 188, 4, 0.1);
    border: 2px solid var(--warning-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.cache-warning-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.cache-warning-icon {
    font-size: 1.2rem;
}

.cache-warning-badge {
    background: var(--warning-color);
    color: #000;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: auto;
}

/* Trading Portfolio Info Styling */
.trading-portfolio-info {
    background: rgba(76, 175, 80, 0.1);
    border: 2px solid var(--success-color);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.trading-info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.trading-info-icon {
    font-size: 1.2rem;
}

.trading-info-badge {
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-left: auto;
}

.trading-portfolio-info p {
    margin: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Portfolio/Trading Data Styling */
.portfolio-summary-card {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(33, 150, 243, 0.1));
    border: 2px solid var(--success-color);
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.portfolio-summary-card h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.3rem;
    text-align: center;
}

.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}

.summary-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--accent-color);
}

.summary-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.summary-value {
    font-weight: bold;
    font-size: 1rem;
}

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

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

/* Portfolio Item Styling */
.portfolio-item {
    border-left: 4px solid var(--accent-color);
    margin-bottom: 1rem;
}

.portfolio-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.portfolio-symbol-info {
    flex: 1;
}

.status-indicator {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-left: 0.5rem;
}

.status-indicator.active {
    background: rgba(76, 175, 80, 0.2);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.status-indicator.closed {
    background: rgba(156, 156, 156, 0.2);
    color: var(--text-secondary);
    border: 1px solid var(--text-secondary);
}

.portfolio-summary {
    display: flex;
    gap: 1rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.portfolio-shares,
.portfolio-pnl,
.portfolio-roi {
    font-size: 0.9rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
}

.portfolio-pnl.positive,
.portfolio-roi.positive {
    color: var(--success-color);
    background: rgba(76, 175, 80, 0.1);
}

.portfolio-pnl.negative,
.portfolio-roi.negative {
    color: var(--error-color);
    background: rgba(244, 67, 54, 0.1);
}

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

.portfolio-details {
    padding: 0 1rem 1rem 1rem;
    border-top: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.portfolio-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.metric-group {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.metric-value {
    font-weight: 500;
    font-size: 0.85rem;
}

/* Portfolio Details Modal */
.portfolio-modal .modal-content {
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
}

.portfolio-details-modal h2 {
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.details-summary {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span:first-child {
    color: var(--text-secondary);
    font-weight: 500;
}

.detail-row span:last-child {
    font-weight: bold;
}

/* Risk Assessment in Portfolio Details */
.risk-assessment-row {
    background: rgba(26, 115, 232, 0.05);
    border-radius: 6px;
    padding: 0.75rem 0.5rem !important;
    margin: 0.5rem 0;
}

.risk-level-low {
    color: #34a853;
    font-weight: 600;
}

.risk-level-medium {
    color: #f57c00;
    font-weight: 600;
}

.risk-level-high {
    color: #ea4335;
    font-weight: 600;
}

.risk-level-unknown {
    color: #5f6368;
    font-style: italic;
}

.stop-loss-price {
    color: #ea4335;
    font-weight: 600;
    font-family: 'Monaco', 'Consolas', monospace;
}

.risk-not-available {
    color: #5f6368;
    font-style: italic;
}

.trades-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
}

.trade-item {
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 6px;
    border-left: 4px solid;
}

.trade-item.buy-trade {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: var(--success-color);
}

.trade-item.sell-trade {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: var(--error-color);
}

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

.trade-header .trade-actions {
    display: flex;
    gap: 0.25rem;
    margin-left: 0.5rem;
}

.trade-type {
    font-weight: bold;
    font-size: 0.9rem;
}

.trade-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.trade-details {
    font-size: 0.9rem;
    line-height: 1.4;
}

.trade-details small {
    color: var(--text-secondary);
    font-style: italic;
}

/* Trade Actions Styling */
.trade-actions {
    display: flex;
    gap: 0.25rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
}

.btn-micro {
    padding: 0.2rem 0.4rem;
    font-size: 0.7rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transition: all 0.2s ease;
}

.btn-micro:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.btn-micro.btn-danger {
    background: rgba(244, 67, 54, 0.2);
    color: var(--error-color);
}

.btn-micro.btn-danger:hover {
    background: rgba(244, 67, 54, 0.3);
}

.trade-notes {
    font-style: italic;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.trading-info .info-value {
    position: relative;
}

/* Responsive Portfolio Design */
@media (max-width: 768px) {
    .summary-metrics {
        grid-template-columns: 1fr;
    }
    
    .portfolio-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .portfolio-actions {
        align-self: flex-end;
    }
    
    .portfolio-metrics {
        grid-template-columns: 1fr;
    }
    
    .portfolio-summary {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .trade-actions {
        margin-top: 0.25rem;
    }
    
    .btn-micro {
        padding: 0.15rem 0.3rem;
        font-size: 0.65rem;
    }
}

.cache-warning p {
    margin: 0.5rem 0;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.section-content {
    transition: all 0.3s ease;
}

.section-content.minimized {
    display: none;
}

.section.minimized {
    padding-bottom: 1rem;
}

section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* Form styles */
.form-group {
    margin-bottom: 1.5rem;
}

label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

/* Checkbox Styling */
.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkbox-label .checkmark {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    margin-right: 0.75rem;
    position: relative;
    transition: all 0.2s ease;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: "✓";
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.checkbox-label:hover .checkmark {
    border-color: var(--primary-color);
}

.checkbox-label.disabled,
.checkbox-label input[type="checkbox"]:disabled + .checkmark {
    opacity: 0.5;
    cursor: not-allowed;
}

.checkbox-label.disabled:hover .checkmark {
    border-color: var(--border-color);
}

input[type="number"]:disabled {
    background-color: var(--background-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Target Percentage Input Styling */
.target-percentage-input {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.target-percentage-input label {
    flex-shrink: 0;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: normal;
}

.target-percentage-input input {
    width: 80px;
    padding: 0.5rem;
    margin: 0;
}

/* Stop Loss Input Styling */
.stop-loss-input {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stop-loss-input label {
    flex-shrink: 0;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: normal;
}

.stop-loss-input input {
    width: 80px;
    padding: 0.5rem;
    margin: 0;
}

/* Auto Save Criteria Styling */
.auto-save-criteria {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auto-save-criteria label {
    flex-shrink: 0;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: normal;
}

.auto-save-criteria select {
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: var(--background-primary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s;
}

.auto-save-criteria select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.auto-save-criteria select:disabled {
    background-color: var(--background-secondary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

.percentage-symbol {
    font-weight: 500;
    color: var(--text-secondary);
}

/* Batch Processing Styles */
.batch-config {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.batch-actions {
    margin-bottom: 1.5rem;
}

.batch-input-group {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.batch-controls {
    display: flex;
    gap: 0.5rem;
}

.batch-status {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 20px;
    background: var(--background-primary);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #4CAF50);
    width: 0%;
    transition: width 0.3s ease;
}

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* ================================================================
   TRANSPARENCY CONTROL SYSTEM v3.0
   Revolutionary overlay transparency management
   ================================================================ */

.transparency-indicator {
    animation: transparencyFade 0.3s ease-in-out;
}

@keyframes transparencyFade {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.transparency-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    margin-bottom: 8px;
    overflow: hidden;
}

.transparency-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff6b6b, #4ecdc4, #45b7d1);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.transparency-text {
    font-size: 14px;
    font-weight: bold;
    text-align: center;
}

/* Enhanced overlay transparency support */
#watchlistOverlay {
    transition: background-color 0.2s ease, backdrop-filter 0.2s ease;
}

#watchlistOverlay .watchlist-content {
    transition: background-color 0.2s ease, backdrop-filter 0.2s ease;
}

/* Multi-select controls */
.multi-select-controls {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

#multiSelectToggle {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

#multiSelectToggle:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

#multiSelectToggle.active {
    background: var(--secondary-color);
}

/* Selection count styling */
.selection-count {
    font-size: 12px;
    color: var(--primary-color);
    font-weight: bold;
    margin-left: 10px;
}

/* Multi-select transparency adjustments */
.multi-select-enabled.selected {
    background: rgba(0, 123, 255, 0.1);
    border: 2px solid rgba(0, 123, 255, 0.5);
}

.multi-select-enabled .selection-checkbox:checked + * {
    color: #007bff;
    font-weight: bold;
}

/* Transparency hints */
.transparency-hint {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0.7;
    pointer-events: none;
    animation: fadeInOut 4s ease-in-out;
}

@keyframes fadeInOut {
    0%, 100% { opacity: 0; }
    20%, 80% { opacity: 0.7; }
}

/* Performance indicators */
.performance-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 11px;
    z-index: 10000;
    pointer-events: none;
}

.performance-indicator.slow {
    background: rgba(255, 107, 107, 0.9);
}

.performance-indicator.fast {
    background: rgba(78, 205, 196, 0.9);
}

/* Cross-app integration indicators */
.cross-app-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.cross-app-status.connected {
    color: #28a745;
}

.cross-app-status.disconnected {
    color: #dc3545;
}

.cross-app-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

/* ================================================================
   WATCHLIST THEME SYNCHRONIZATION
   Theme support for watchlist overlay
   ================================================================ */

/* Dark Theme Variables */
#watchlistOverlay.dark-theme {
    background: rgba(20, 20, 20, 0.95);
    --text-primary: #e0e0e0;
    --text-secondary: #b0b0b0;
    --text-tertiary: #888;
    --border-color: #333;
    --surface-color: #2a2a2a;
    --input-background: #333;
    --primary-color: #4CAF50;
    --primary-dark: #45a049;
    --danger-color: #dc3545;
    --success-color: #28a745;
}

#watchlistOverlay.dark-theme .watchlist-content,
#watchlistOverlay.dark-theme .watchlist-sidebar {
    background: #1a1a1a;
    border: 1px solid #333;
    color: #e0e0e0;
}

/* Light Theme Variables */
#watchlistOverlay.light-theme {
    background: rgba(255, 255, 255, 0.95);
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #999;
    --border-color: #ddd;
    --surface-color: #f8f9fa;
    --input-background: #fff;
    --primary-color: #007bff;
    --primary-dark: #0056b3;
    --danger-color: #dc3545;
    --success-color: #28a745;
}

#watchlistOverlay.light-theme .watchlist-content,
#watchlistOverlay.light-theme .watchlist-sidebar {
    background: #ffffff;
    border: 1px solid #ddd;
    color: #333;
}

/* Blue Theme Variables */
#watchlistOverlay.blue-theme {
    background: rgba(15, 23, 42, 0.95);
    --text-primary: #e2e8f0;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --surface-color: #1e293b;
    --input-background: #334155;
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --danger-color: #ef4444;
    --success-color: #10b981;
}

#watchlistOverlay.blue-theme .watchlist-content,
#watchlistOverlay.blue-theme .watchlist-sidebar {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
}

/* Form elements theming */
#watchlistOverlay .add-symbol-form input {
    background: var(--input-background, #333) !important;
    border: 1px solid var(--border-color, #555) !important;
    color: var(--text-primary, #e0e0e0) !important;
}

#watchlistOverlay .add-symbol-form button {
    background: var(--primary-color, #4CAF50) !important;
    color: white !important;
    border: none !important;
}

#watchlistOverlay .add-symbol-form button:hover {
    background: var(--primary-dark, #45a049) !important;
}

/* Watchlist items styling with proper theme support and infinite scroll */
.watchlist-items {
    flex: 1 1 auto; /* Allow flexible growth and shrinking */
    overflow-y: auto;
    overflow-x: hidden;
    max-height: none; /* Let parent .watchlist-content control max-height */
    min-height: 200px; /* Minimum height for usability */
    height: auto; /* Automatic height based on content */
    padding: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color, #e0e0e0) transparent;
    scroll-behavior: smooth; /* Smooth scrolling support */
    /* Force layout recalculation on content changes */
    contain: layout style;
}

/* Custom scrollbar for webkit browsers */
.watchlist-items::-webkit-scrollbar {
    width: 6px;
}

.watchlist-items::-webkit-scrollbar-track {
    background: transparent;
}

.watchlist-items::-webkit-scrollbar-thumb {
    background: var(--border-color, #e0e0e0);
    border-radius: 3px;
    transition: background-color 0.2s;
}

.watchlist-items::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary, #6c757d);
}

#watchlistOverlay .watchlist-items {
    color: var(--text-primary) !important;
}

#watchlistOverlay .watchlist-items span {
    color: var(--text-primary) !important;
}

#watchlistOverlay .watchlist-items button {
    color: var(--danger-color) !important;
}

/* Headers and labels - fixed positioning for scroll */
#watchlistOverlay h3,
#watchlistOverlay h4,
#watchlistOverlay label {
    color: var(--text-primary) !important;
}

/* Fixed header sections that don't scroll */
.watchlist-header,
.realtime-controls,
.symbol-management,
.batch-controls {
    flex-shrink: 0;
    z-index: 1;
}

/* Scroll fade indicators */
.watchlist-items::before,
.watchlist-items::after {
    content: '';
    position: absolute;
    left: 0;
    right: 6px; /* Account for scrollbar */
    height: 10px;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 2;
}

.watchlist-items::before {
    top: 0;
    background: linear-gradient(to bottom, 
        var(--bg-primary, #ffffff) 0%, 
        transparent 100%);
}

.watchlist-items::after {
    bottom: 0;
    background: linear-gradient(to top, 
        var(--bg-primary, #ffffff) 0%, 
        transparent 100%);
}

/* Smooth scrolling */
.watchlist-items {
    scroll-behavior: smooth;
}

/* Symbol item hover effects for better UX */
.watchlist-symbol-item {
    transition: background-color 0.2s, transform 0.1s;
    position: relative;
}

.watchlist-symbol-item:hover {
    background-color: var(--watchlist-hover-bg);
    color: var(--text-primary);
    transform: translateX(2px);
}

/* API status and controls */
#watchlistOverlay .api-status {
    color: var(--text-secondary) !important;
}

#watchlistOverlay .toggle-text {
    color: var(--text-primary) !important;
}

.batch-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.ticker-preview {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.ticker-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.ticker-item {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Batch Log Styles */
.batch-log {
    background: var(--background-secondary);
    padding: 1rem;
    border-radius: 8px;
    margin-top: 1rem;
}

.log-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.log-content {
    max-height: 300px;
    overflow-y: auto;
    background: var(--background-primary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem;
    font-family: monospace;
    font-size: 0.85rem;
}

.log-entry {
    padding: 0.25rem 0;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-entry:last-child {
    border-bottom: none;
}

.log-entry.quality {
    background: rgba(76, 175, 80, 0.1);
    color: var(--success-color);
}

.log-entry.failed {
    background: rgba(244, 67, 54, 0.1);
    color: var(--error-color);
}

.log-ticker {
    font-weight: bold;
    width: 60px;
}

.log-score {
    font-weight: 500;
}

.log-status {
    font-size: 0.8rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
}

.log-status.saved {
    background: var(--success-color);
    color: white;
}

.log-status.skipped {
    background: var(--warning-color);
    color: white;
}

.log-status.error {
    background: var(--error-color);
    color: white;
}

.cache-indicator {
    font-size: 0.7rem;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-weight: 500;
    margin: 0 0.2rem;
    display: inline-block;
    text-transform: lowercase;
    font-family: monospace;
}

.cache-indicator.api {
    background: rgba(0, 150, 136, 0.15);
    color: #00695c;
}

.cache-indicator.cache {
    background: rgba(103, 58, 183, 0.15);
    color: #4527a0;
}

.cache-indicator.none {
    background: rgba(158, 158, 158, 0.15);
    color: #616161;
}

.cache-indicator.error {
    background: rgba(244, 67, 54, 0.15);
    color: #c62828;
}

/* Dark theme adjustments for cache indicators */
[data-theme="dark"] .cache-indicator.api {
    background: rgba(0, 150, 136, 0.25);
    color: #4db6ac;
}

[data-theme="dark"] .cache-indicator.cache {
    background: rgba(103, 58, 183, 0.25);
    color: #b39ddb;
}

[data-theme="dark"] .cache-indicator.none {
    background: rgba(158, 158, 158, 0.25);
    color: #bdbdbd;
}

[data-theme="dark"] .cache-indicator.error {
    background: rgba(244, 67, 54, 0.25);
    color: #ef5350;
}

@media (max-width: 768px) {
    .batch-config {
        grid-template-columns: 1fr;
    }
    
    .batch-input-group {
        flex-direction: column;
    }
    
    .batch-info {
        flex-direction: column;
        gap: 0.25rem;
    }
}

.input-hint {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Button styles */
button,
.btn {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.1s;
    display: inline-block;
    text-align: center;
}

button:hover,
.btn:hover {
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

button:active,
.btn:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

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

.btn-primary:hover {
    background-color: #1557b0;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #2d8e47;
}

.btn-info {
    background-color: #17a2b8;
    color: white;
    border: 2px solid transparent;
}

.btn-info:hover {
    background-color: #138496;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--text-secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: #4a4f54;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #c5221f;
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* Analysis button group */
.analysis-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.analysis-buttons button {
    flex: 1;
    min-width: 150px;
}

/* Status indicators */
.status-indicator {
    display: inline-block;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.status-success {
    background-color: rgba(76, 175, 80, 0.2);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.5);
    font-weight: 600;
}

.status-error {
    background-color: rgba(244, 67, 54, 0.2);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.5);
    font-weight: 600;
}

.status-warning {
    background-color: rgba(255, 193, 7, 0.2);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.5);
    font-weight: 600;
}

/* Input form grid */
.input-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Parameter groups styling */
.parameter-group {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow-sm);
}

.parameter-group h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 0.5rem;
}

.parameter-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    align-items: start;
}

.parameter-group .form-group {
    margin-bottom: 1rem;
}

/* Parameter subgroups for organizing related settings */
.parameter-subgroup {
    background: rgba(var(--primary-color-rgb, 26, 115, 232), 0.02);
    border: 1px solid rgba(var(--primary-color-rgb, 26, 115, 232), 0.1);
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.parameter-subgroup h4 {
    margin: 0 0 1rem 0;
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.parameter-subgroup:last-child {
    margin-bottom: 0;
}

.parameter-group .form-group:last-child {
    margin-bottom: 0;
}

/* Loading indicator */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--primary-color);
    font-weight: 500;
}

.hidden {
    display: none !important;
}

/* Error and success messages */
.error-message {
    background-color: #fce8e6;
    color: #c5221f;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--error-color);
}

.success-message {
    background-color: #e6f4ea;
    color: #137333;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid var(--success-color);
    animation: slideIn 0.3s ease-out;
}

.warning-message {
    background-color: #fef7e0;
    color: #b7791f;
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid #f9ab00;
    animation: slideIn 0.3s ease-out;
}

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

/* Stock info grid */
.stock-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.info-item {
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color);
}

.info-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.info-value {
    display: block;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

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

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

/* P/E Ratio color coding */
.pe-ratio.low-pe {
    color: var(--success-color); /* Green - potentially undervalued */
    font-weight: 700;
}

.pe-ratio.moderate-pe {
    color: var(--accent-color); /* Blue - reasonable valuation */
    font-weight: 600;
}

.pe-ratio.high-pe {
    color: #ff9800; /* Orange - high growth or overvalued */
    font-weight: 600;
}

.pe-ratio.very-high-pe {
    color: var(--error-color); /* Red - very high P/E */
    font-weight: 700;
}

.pe-ratio.negative-pe {
    color: var(--error-color); /* Red - negative earnings */
    font-weight: 700;
}

.pe-ratio.neutral {
    color: var(--text-secondary); /* Gray - no data */
}

/* Results header with inline source info */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--primary-color);
}

.results-header h2 {
    margin-bottom: 0;
    border-bottom: none;
    padding-bottom: 0;
}

.result-source-info-inline {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.source-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.source-badge.historical {
    background: var(--warning-color);
    color: var(--text-primary);
}

.analysis-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
}

.analysis-symbol {
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase;
}

/* Company name styling */
.company-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    font-style: italic;
    margin-left: 8px;
    opacity: 0.8;
}

.analysis-company-name {
    font-size: 0.85rem;
    color: var(--text-primary);
    font-weight: 500;
    max-width: 200px;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-sector-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 400;
    background-color: var(--background-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    display: none; /* Hidden by default, shown via JavaScript when data is available */
}

.analysis-timestamp {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-style: italic;
}

/* Sector Analysis Styles */
.sector-analysis-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-top: 1rem;
}

.sector-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background-color: var(--background-secondary);
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

.sector-item.full-width {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.sector-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.sector-value {
    font-weight: 500;
    color: var(--text-primary);
}

.sector-status.undervalued {
    color: var(--success-color);
    font-weight: 600;
}

.sector-status.fairly-valued,
.sector-status.market-valued {
    color: var(--warning-color);
    font-weight: 600;
}

.sector-status.premium-valued,
.sector-status.overvalued {
    color: var(--error-color);
    font-weight: 600;
}

.sector-analysis {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
}

/* Pattern Recognition Styles */
.pattern-summary {
    margin-bottom: 1.5rem;
}

.pattern-grade-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: rgba(var(--primary-rgb), 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.pattern-grade-label {
    font-weight: 600;
    color: var(--text-primary);
}

.pattern-grade {
    font-size: 1.25rem;
    font-weight: bold;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    text-align: center;
    min-width: 2.5rem;
}

/* Pattern Grade Colors */
.pattern-grade.grade-a-plus { background: linear-gradient(135deg, #2d5a27 0%, #4caf50 100%); color: white; }
.pattern-grade.grade-a { background: linear-gradient(135deg, #388e3c 0%, #66bb6a 100%); color: white; }
.pattern-grade.grade-a-minus { background: linear-gradient(135deg, #4caf50 0%, #81c784 100%); color: white; }
.pattern-grade.grade-b-plus { background: linear-gradient(135deg, #689f38 0%, #8bc34a 100%); color: white; }
.pattern-grade.grade-b { background: linear-gradient(135deg, #827717 0%, #cddc39 100%); color: black; }
.pattern-grade.grade-b-minus { background: linear-gradient(135deg, #afb42b 0%, #dce775 100%); color: black; }
.pattern-grade.grade-c-plus { background: linear-gradient(135deg, #f57f17 0%, #ffeb3b 100%); color: black; }
.pattern-grade.grade-c { background: linear-gradient(135deg, #ff8f00 0%, #ffc107 100%); color: black; }
.pattern-grade.grade-c-minus { background: linear-gradient(135deg, #ff6f00 0%, #ff9800 100%); color: white; }
.pattern-grade.grade-d-plus { background: linear-gradient(135deg, #e65100 0%, #ff5722 100%); color: white; }
.pattern-grade.grade-d { background: linear-gradient(135deg, #d84315 0%, #ff7043 100%); color: white; }
.pattern-grade.grade-d-minus { background: linear-gradient(135deg, #bf360c 0%, #ff8a65 100%); color: white; }
.pattern-grade.grade-f { background: linear-gradient(135deg, #b71c1c 0%, #f44336 100%); color: white; }

.pattern-confidence {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Pattern Progress Container */
.pattern-progress-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background-color: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.pattern-progress-container .progress-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.pattern-progress-container .progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 140px;
    flex-shrink: 0;
}

.pattern-progress-container .progress-value {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 600;
    margin-left: auto;
}

.pattern-progress-container .progress-bar-wrapper {
    flex: 1;
    height: 6px;
    background-color: var(--border-light);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.pattern-progress-container .progress-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease-out;
    position: relative;
    overflow: hidden;
}

/* Pattern progress bar shimmer effect */
.pattern-progress-container .progress-bar::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Pattern Details */
.pattern-details {
    margin-top: 1.5rem;
}

.pattern-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.pattern-item {
    background-color: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.pattern-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.pattern-name {
    font-weight: 600;
    color: var(--text-primary);
}

.pattern-type {
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.pattern-type.breakout {
    background-color: rgba(76, 175, 80, 0.2);
    color: #2e7d32;
}

.pattern-type.reversal {
    background-color: rgba(255, 152, 0, 0.2);
    color: #ef6c00;
}

.pattern-type.volume {
    background-color: rgba(63, 81, 181, 0.2);
    color: #283593;
}

.pattern-type.momentum {
    background-color: rgba(233, 30, 99, 0.2);
    color: #ad1457;
}

.pattern-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.pattern-metric {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.metric-value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Pattern Strength Colors */
.metric-value.strength-very-strong {
    color: #2e7d32;
}

.metric-value.strength-strong {
    color: #388e3c;
}

.metric-value.strength-moderate {
    color: #f57c00;
}

.metric-value.strength-weak {
    color: #e64a19;
}

.metric-value.strength-very-weak {
    color: #c62828;
}

.pattern-description {
    font-size: 0.85rem;
    line-height: 1.4;
    color: var(--text-secondary);
    font-style: italic;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-light);
}

/* Overall result */
.overall-result {
    padding: 2rem;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 2rem;
    box-shadow: var(--shadow-sm);
}

.overall-result.pass {
    background: linear-gradient(135deg, #e6f4ea 0%, #d4edda 100%);
    border: 2px solid var(--success-color);
}

.overall-result.fail {
    background: linear-gradient(135deg, #fce8e6 0%, #f8d7da 100%);
    border: 2px solid var(--error-color);
}

.overall-result h3 {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.overall-result.pass h3 {
    color: var(--success-color);
}

.overall-result.fail h3 {
    color: var(--error-color);
}

.overall-result p {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Overall result inline layout */
.overall-result-inline {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.overall-result-inline h3 {
    margin-bottom: 0;
}

.overall-result-inline p {
    margin-bottom: 0;
    font-size: 1rem;
}

/* Criteria list */
.criteria-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1rem;
}

.criterion-item {
    padding: 1.25rem;
    border-radius: 8px;
    border-left: 4px solid;
    background-color: var(--background-color);
    transition: transform 0.2s, box-shadow 0.2s;
    min-height: fit-content;
}

.criterion-item:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.criterion-item.pass {
    border-left-color: var(--success-color);
    background-color: #f0f9f4;
}

.criterion-item.fail {
    border-left-color: var(--error-color);
    background-color: #fef6f6;
}

.criterion-item.pending {
    border-left-color: var(--warning-color);
    background-color: #fffbf0;
}

.criterion-header {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
}

.criterion-icon {
    font-size: 1.5rem;
    font-weight: bold;
    margin-right: 0.75rem;
}

.criterion-item.pass .criterion-icon {
    color: var(--success-color);
}

.criterion-item.fail .criterion-icon {
    color: var(--error-color);
}

.criterion-item.pending .criterion-icon {
    color: var(--warning-color);
}

.criterion-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.criterion-description {
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
    line-height: 1.5;
    word-wrap: break-word;
    hyphens: auto;
}

.criterion-details {
    font-size: 0.9rem;
    color: var(--text-primary);
    margin-top: 0.5rem;
}

.criterion-details p {
    margin: 0.25rem 0;
    word-wrap: break-word;
    line-height: 1.4;
}

.criterion-details .note {
    font-style: italic;
    color: var(--text-secondary);
}

/* Historical controls */
.historical-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: start;
    padding: 0.75rem;
    background-color: var(--surface-alt-color);
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

.control-group-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.35rem;
    background-color: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
    min-width: 120px;
    flex: 1;
    max-width: 200px;
}

/* Special handling for Symbol Filter section */
.control-group-section:has(#historySymbolFilter) {
    min-width: 180px;
    max-width: 250px;
}

/* Trading filters - hidden by default, shown via JavaScript in Trading Data view */
.trading-filters {
    display: none;
}

/* Compact Select section */
.select-section {
    min-width: 85px;
    max-width: 105px;
    flex: 0 0 auto;
}

/* Wide Actions section for longer button text */
.actions-section {
    min-width: 180px;
    max-width: 220px;
    flex: 0 0 auto;
}

.button-row {
    display: flex;
    gap: 0.2rem;
}

.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
    padding-bottom: 0.15rem;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 100px;
}

.control-group label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.15rem;
}

.control-group select,
.control-group input[type="text"] {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-size: 0.8rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
    box-sizing: border-box;
}

.control-group select:focus,
.control-group input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Fix dropdown overflow by constraining to container */
.control-group select {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    user-select: none;
    font-size: 0.875rem;
    color: var(--text-primary);
    padding-top: 0.5rem;
}

.checkbox-label input[type="checkbox"] {
    display: none;
}

.checkmark {
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    transition: all 0.2s;
    position: relative;
}

.checkbox-label input[type="checkbox"]:checked + .checkmark {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.checkbox-label input[type="checkbox"]:checked + .checkmark::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

/* Compact checkbox for "Show Only Passing" */
.compact-checkbox {
    justify-content: center;
    align-items: center;
    padding: 0.5rem;
    min-width: 44px;
    height: 44px;
    background-color: var(--surface-color);
    border-radius: 6px;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
    position: relative;
    cursor: pointer;
}

.compact-checkbox:hover {
    background-color: var(--surface-alt-color);
    border-color: var(--success-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.compact-checkbox input[type="checkbox"]:checked ~ .checkmark-compact {
    color: var(--success-color);
    background-color: rgba(16, 185, 129, 0.15);
    border-radius: 50%;
    transform: scale(1.1);
}

.compact-checkbox:hover .checkmark-compact {
    color: var(--success-color);
}

.checkmark-compact {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 4px;
}

.btn-small {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
    border-radius: 4px;
    border: 1px solid var(--border-color);
    background-color: var(--background-color);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-small:hover {
    background-color: var(--surface-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-small.btn-secondary {
    background-color: var(--surface-color);
    color: var(--text-secondary);
}

.btn-small.btn-danger {
    background-color: var(--error-color);
    border-color: var(--error-color);
    color: white;
}

.btn-small.btn-danger:hover {
    background-color: #dc2626;
    border-color: #dc2626;
}

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

.btn-small.btn-primary:hover {
    background-color: #4f46e5;
    border-color: #4f46e5;
}

.btn-small.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-small.btn-success:hover {
    background-color: #059669;
    border-color: #059669;
}

.btn-small.btn-info {
    background-color: #1976d2;
    border-color: #1976d2;
    color: white;
}

.btn-small.btn-info:hover {
    background-color: #1565c0;
    border-color: #1565c0;
}

.btn-small.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: #333;
}

.btn-small.btn-warning:hover {
    background-color: #f9ab00;
    border-color: #f9ab00;
}

.small-input {
    padding: 0.2rem 0.3rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-size: 0.8rem;
    width: 50px;
    text-align: center;
    height: 28px;
}

.small-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.1);
}

/* Action buttons */
.action-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 1.5rem;
}

/* History list */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-height: 500px;
    overflow-y: auto;
}

.history-item {
    padding: 1rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    transition: box-shadow 0.2s;
}

.history-item:hover {
    box-shadow: var(--shadow-sm);
}

.history-item.pass {
    border-left: 4px solid var(--success-color);
}

.history-item.fail {
    border-left: 4px solid var(--error-color);
}

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

.history-symbol {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.history-status {
    font-size: 1.25rem;
    font-weight: bold;
}

.history-item.pass .history-status {
    color: var(--success-color);
}

.history-item.fail .history-status {
    color: var(--error-color);
}

.history-details {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.history-actions {
    display: flex;
    gap: 0.5rem;
}

/* Cache Item Styles */
.cache-item {
    border-left: 4px solid var(--warning-color) !important;
    background: rgba(251, 188, 4, 0.05);
}

.cache-badge {
    background: var(--warning-color);
    color: #000;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-right: 0.5rem;
}

.cache-status {
    color: var(--warning-color);
    font-size: 1.2rem;
}

.cache-info-compact {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    white-space: nowrap;
}

.score-compact.cache-score {
    background: var(--warning-color);
    color: #000;
}

/* Cache checkboxes inherit history checkbox styling */

.history-cache-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.cache-age, .cache-size {
    color: var(--text-secondary);
}

.history-data-preview {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin: 0.5rem 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    font-family: monospace;
}

.history-main-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex-grow: 1;
}

/* Compact history layout */
.history-item-compact {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: var(--surface-color);
    transition: box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 0.25rem; /* Much smaller gap to bring content closer to Load button */
    margin-bottom: 0.5rem;
}

.history-item-compact:hover {
    box-shadow: var(--shadow-sm);
}

.history-item-compact.pass {
    border-left: 4px solid var(--success-color);
}

.history-item-compact.fail {
    border-left: 4px solid var(--error-color);
}

/* Swan Score Integration Styles */
.swan-scoring-option {
    background: linear-gradient(90deg, rgba(78, 205, 196, 0.1), rgba(78, 205, 196, 0.05));
    color: var(--primary-color, #4ecdc4);
    font-weight: 500;
}

.swan-score-display {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
}

.swan-score-value {
    font-weight: 600;
}

.swan-score-grade {
    font-size: 0.75rem;
    opacity: 0.8;
}

.total-score-with-swan {
    border: 2px solid rgba(78, 205, 196, 0.3);
    background: rgba(78, 205, 196, 0.05);
}

/* Swan Score Widget Styles */
.swan-score-widget {
    border-radius: 8px;
    padding: 12px;
    background: var(--surface-color, #2a2a2a);
    border: 1px solid var(--border-color, #404040);
    margin: 8px 0;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swan-score-widget:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.swan-widget-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.swan-widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.swan-symbol {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-primary, #ffffff);
}

.swan-grade {
    font-weight: 600;
    font-size: 1rem;
}

.swan-widget-score {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.swan-score-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color, #4ecdc4);
}

/* Compact Swan Score styles for Historical Data integration */
.swan-score-display.compact .swan-score-value {
    font-size: 12px;
    font-weight: 600;
}

.swan-score-display.compact .swan-score-grade {
    font-size: 13px;
    font-weight: 500;
}

.swan-score-label {
    font-size: 0.9rem;
    color: var(--text-secondary, #888888);
}

.swan-widget-details {
    padding-top: 8px;
    border-top: 1px solid var(--border-color, #404040);
}

.swan-benefit {
    font-size: 0.85rem;
    color: var(--text-secondary, #888888);
    line-height: 1.4;
}

.swan-widget-error {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary, #888888);
}

.swan-error {
    font-size: 0.85rem;
    font-style: italic;
}

.history-checkbox {
    display: flex;
    align-items: center;
    min-width: 20px;
}

.history-checkbox-input {
    display: none;
}

.history-checkbox-label {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color);
    border-radius: 3px;
    background-color: var(--background-color);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    display: block;
}

.history-checkbox-input:checked + .history-checkbox-label {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.history-checkbox-input:checked + .history-checkbox-label::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 10px;
    font-weight: bold;
}

.history-item-compact .history-status {
    font-size: 1.1rem;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
    margin-left: 0.5rem;
}

.history-item-compact.pass .history-status {
    color: var(--success-color);
}

.history-item-compact.fail .history-status {
    color: var(--error-color);
}

.history-item-compact .history-symbol-company {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 360px; /* Increased from 320px to accommodate ~5 more characters */
    margin-left: 0.25rem; /* Smaller margin to move it even closer to Load button */
}

.history-item-compact .history-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 120px; /* Back to original size */
    text-align: center;
}

.history-item-compact .history-score-detailed {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    background-color: var(--surface-alt-color);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    min-width: 110px; /* Back to original size */
    text-align: center;
}

.history-actions-left,
.history-actions-right {
    display: flex;
    gap: 0.25rem;
}

.history-item-compact .history-date {
    font-size: 0.85rem;
    color: var(--text-secondary);
    min-width: 120px;
    flex-shrink: 0;
}

.history-item-compact .history-score,
.history-item-compact .history-score-detailed {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    min-width: 120px;
    text-align: center;
    font-family: 'Courier New', monospace; /* Monospace for better alignment */
}

.history-item-compact .history-actions {
    display: flex;
    gap: 0.5rem; /* Back to original spacing */
    margin-left: auto;
}

.history-item-compact .history-actions-left {
    display: flex;
    margin-right: 0.5rem; /* Fixed margin instead of auto to control spacing */
    flex-shrink: 0;
}

.history-item-compact .history-actions-right {
    display: flex;
    gap: 0.5rem; /* Back to original spacing */
    margin-left: 0.5rem; /* Back to original margin */
}

.no-history {
    text-align: center;
    color: var(--text-secondary);
    padding: 2rem;
    font-style: italic;
}

/* Rate limit status */
.rate-limit-status {
    font-size: 0.85rem;
    color: var(--text-secondary);
    padding: 0.5rem;
    background-color: var(--background-color);
    border-radius: 4px;
    text-align: center;
    margin-top: 1rem;
}

/* Footer */
footer {
    background-color: var(--surface-color);
    padding: 2rem 0;
    margin-top: 3rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
    color: var(--text-secondary);
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

footer p {
    margin-bottom: 0.5rem;
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
}

footer a:hover {
    text-decoration: underline;
}

/* Responsive design */
@media (max-width: 1024px) and (min-width: 769px) {
    .criteria-list {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 1.5rem;
    }
    
    section {
        padding: 1.5rem;
    }
    
    section h2 {
        font-size: 1.25rem;
    }
    
    .input-grid {
        grid-template-columns: 1fr;
    }
    
    .stock-info-grid {
        grid-template-columns: 1fr;
    }
    
    .sector-analysis-grid {
        grid-template-columns: 1fr;
    }
    
    .results-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .result-source-info-inline {
        justify-content: center;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .analysis-info {
        align-items: center;
        text-align: center;
    }
    
    .analysis-symbol,
    .analysis-timestamp {
        font-size: 0.9rem;
    }
    
    .analysis-company-name {
        font-size: 0.8rem;
        max-width: 150px;
        text-align: center;
    }
    
    .analysis-sector-info {
        font-size: 0.75rem;
        padding: 1px 4px;
    }
    
    .history-item-compact {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .history-item-compact .history-symbol-company {
        order: 1;
        flex-basis: 100%;
        font-size: 0.9rem;
        max-width: none;
    }
    
    .history-item-compact .history-date {
        order: 2;
        flex-basis: 100%;
        margin-top: 0.25rem;
        font-size: 0.75rem;
        min-width: auto;
    }
    
    .history-item-compact .history-score-detailed {
        font-size: 0.75rem;
        min-width: 100px;
    }

    .history-item-compact .history-actions {
        gap: 0.25rem;
    }
    
    .history-item-compact .history-actions-left,
    .history-item-compact .history-actions-right {
        gap: 0.25rem;
    }
    
    .criteria-list {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
    
    .action-buttons button {
        width: 100%;
    }
    
    .analysis-buttons {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .analysis-buttons button {
        min-width: auto;
        width: 100%;
    }
    
    .overall-result h3 {
        font-size: 1.5rem;
    }
    
    .overall-result-inline {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
        gap: 0.5rem;
    }
    
    .overall-result-inline p {
        font-size: 0.95rem;
    }
}

@media (max-width: 480px) {
    main {
        padding: 0 1rem;
    }
    
    section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    h1 {
        font-size: 1.25rem;
    }
    
    button,
    .btn {
        padding: 0.625rem 1rem;
        font-size: 0.9rem;
    }
    
    .historical-controls {
        flex-direction: column;
        gap: 1rem;
        padding: 0.75rem;
    }
    
    .control-group-section {
        min-width: 100%;
        padding: 0.75rem;
    }
    
    .control-group {
        min-width: 100%;
        flex-wrap: wrap;
    }
    
    .button-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .btn-small {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        flex: 1;
        margin: 0.1rem 0;
    }
    
    .small-input {
        width: 100%;
        max-width: 120px;
    }
    
    .history-item-compact {
        flex-direction: column;
        gap: 0.5rem;
        padding: 1rem;
    }
    
    .history-item-compact .history-symbol-company {
        max-width: none;
        text-align: center;
        font-size: 1rem;
    }
    
    .history-item-compact .history-date {
        min-width: auto;
        text-align: center;
    }
    
    .history-item-compact .history-score-detailed {
        min-width: auto;
        align-self: center;
    }
    
    .history-actions-left,
    .history-actions-right {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .history-checkbox {
        position: absolute;
        top: 0.5rem;
        left: 0.5rem;
    }
}

/* Print styles */
@media print {
    header,
    footer,
    .action-buttons,
    #apiKeySection,
    #inputSection {
        display: none;
    }
    
    section {
        box-shadow: none;
        border: 1px solid var(--border-color);
    }
    
    .criterion-item {
        page-break-inside: avoid;
    }
}

/* Accessibility improvements */
button:focus,
input:focus,
a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Fundamental Analysis Styles */
.fundamental-config {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.fundamental-criteria {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--border-color);
}

.criteria-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
    margin: 1.5rem 0;
}

.criterion-item {
    background: var(--card-background);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.criterion-item:hover {
    border-color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.criterion-header strong {
    color: var(--text-primary);
    font-size: 0.9rem;
}

.target-value {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.criterion-description {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

/* Fundamental Results Styles */
.fundamental-results {
    background: var(--card-background);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1rem 0;
}

.fundamental-results h3 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fundamental-score {
    background: var(--primary-color);
    color: white !important;
    padding: 0.25rem 0.75rem;
    border-radius: 16px;
    font-weight: bold;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fundamental-score.score-high {
    background: var(--success-color);
    color: white !important;
}

.fundamental-score.score-medium {
    background: #ff9800;
    color: white !important;
}

.fundamental-score.score-low {
    background: var(--error-color);
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.data-source-indicator {
    display: inline-block;
    padding: 4px 10px;
    background: rgba(0, 123, 255, 0.1);
    color: var(--info-color);
    border: 1px solid rgba(0, 123, 255, 0.3);
    border-radius: 15px;
    font-size: 0.75em;
    font-weight: 500;
    margin-left: 8px;
    vertical-align: middle;
}

.fundamental-criteria-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.fundamental-criterion-result {
    display: flex;
    flex-direction: column;
    padding: 0.6rem;
    background: var(--background-color);
    border-radius: 6px;
    border-left: 4px solid var(--border-color);
    gap: 0.25rem;
}

.fundamental-criterion-result.pass {
    border-left-color: var(--success-color);
    background: var(--success-background);
}

.fundamental-criterion-result.fail {
    border-left-color: var(--error-color);
    background: var(--error-background);
}

.fundamental-criterion-result.info {
    border-left-color: var(--primary-color);
    background: var(--primary-background);
}

.fundamental-criterion-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.2;
    margin-bottom: 0.125rem;
}

.fundamental-criterion-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.fundamental-criterion-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.fundamental-criterion-status.pass {
    background: var(--success-color);
    color: white !important;
}

.fundamental-criterion-status.fail {
    background: var(--error-color);
    color: white !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.fundamental-criterion-status.info {
    background: var(--primary-color);
}

/* Fundamental Progress Bars */
.fundamental-progress-container {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.fundamental-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.fundamental-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.fundamental-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

@keyframes progressShimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.fundamental-progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

/* Performance level colors */
.fundamental-progress-fill.excellent {
    background: linear-gradient(90deg, #4caf50, #66bb6a);
}

.fundamental-progress-fill.good {
    background: linear-gradient(90deg, #8bc34a, #9ccc65);
}

.fundamental-progress-fill.warning {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.fundamental-progress-fill.poor {
    background: linear-gradient(90deg, #ff5722, #ff7043);
}

.fundamental-progress-fill.critical {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

/* Dark theme adjustments */
[data-theme="dark"] .fundamental-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .fundamental-progress-label {
    color: rgba(255, 255, 255, 0.7);
}

/* Checklist Progress Bars - Matching Fundamental Style */
.checklist-progress-container {
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.checklist-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
}

.checklist-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.8s ease-out;
    position: relative;
    overflow: hidden;
}

.checklist-progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: progressShimmer 2s ease-in-out infinite;
}

.checklist-progress-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 35px;
    text-align: right;
}

/* Performance level colors for checklist (reuse fundamental styles) */
.checklist-progress-fill.excellent {
    background: linear-gradient(90deg, #4caf50, #66bb6a);
}

.checklist-progress-fill.good {
    background: linear-gradient(90deg, #8bc34a, #9ccc65);
}

.checklist-progress-fill.warning {
    background: linear-gradient(90deg, #ff9800, #ffb74d);
}

.checklist-progress-fill.poor {
    background: linear-gradient(90deg, #ff5722, #ff7043);
}

.checklist-progress-fill.critical {
    background: linear-gradient(90deg, #f44336, #ef5350);
}

/* Dark theme adjustments */
[data-theme="dark"] .checklist-progress-bar {
    background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .checklist-progress-label {
    color: rgba(255, 255, 255, 0.7);
}

/* Responsive design */
@media (max-width: 768px) {
    .fundamental-progress-container,
    .checklist-progress-container,
    .pattern-progress-container {
        gap: 6px;
        margin-top: 6px;
    }
    
    .fundamental-progress-bar,
    .checklist-progress-bar,
    .pattern-progress-container .progress-bar-wrapper {
        height: 4px;
    }
    
    .fundamental-progress-label,
    .checklist-progress-label,
    .pattern-progress-container .progress-label {
        font-size: 0.7rem;
        min-width: 30px;
    }
    
    .pattern-grid {
        grid-template-columns: 1fr;
    }
    
    .pattern-grade-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .pattern-metrics {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Checklist Evaluation Results - matching fundamental analysis style */
.checklist-criteria-results {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.checklist-criterion-result {
    display: flex;
    flex-direction: column;
    padding: 0.6rem;
    background: var(--background-color);
    border-radius: 6px;
    border-left: 4px solid var(--border-color);
    gap: 0.25rem;
}

.checklist-criterion-result.pass {
    border-left-color: var(--success-color);
    background: var(--success-background);
}

.checklist-criterion-result.fail {
    border-left-color: var(--error-color);
    background: var(--error-background);
}

.checklist-criterion-result.pending {
    border-left-color: var(--warning-color);
    background: var(--warning-background);
}

.checklist-criterion-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.2;
    margin-bottom: 0.125rem;
}

.checklist-criterion-value {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-primary);
    font-weight: 500;
}

.checklist-criterion-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.7rem;
    color: white;
}

.checklist-criterion-status.pass {
    background: var(--success-color);
}

.checklist-criterion-status.fail {
    background: var(--error-color);
}

.checklist-criterion-status.pending {
    background: var(--warning-color);
}

/* Score styling for both fundamental and checklist */
.fundamental-score,
.checklist-score {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.score-high {
    background: var(--success-background);
    color: var(--success-color);
}

.score-medium {
    background: var(--warning-background);
    color: var(--warning-color);
}

.score-low {
    background: var(--error-background);
    color: var(--error-color);
}

/* Responsive adjustments for fundamental and checklist analysis */
@media (max-width: 768px) {
    .criteria-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .criterion-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .fundamental-criteria-results,
    .checklist-criteria-results {
        grid-template-columns: 1fr;
    }
    
    .checklist-criterion-name,
    .fundamental-criterion-name {
        font-size: 0.85rem;
    }
    
    .checklist-criterion-value,
    .fundamental-criterion-value {
        font-size: 0.9rem;
    }
}

/* Custom scrollbar for history list */
.history-list::-webkit-scrollbar {
    width: 8px;
}

.history-list::-webkit-scrollbar-track {
    background: var(--background-color);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Fundamental API Configuration Styling */
.important-info {
    background: linear-gradient(135deg, #e3f2fd, #f8f9fa);
    border: 2px solid #2196f3;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.important-info h4 {
    color: #1976d2;
    margin-bottom: 1rem;
}

.important-info ul {
    margin: 0;
    padding-left: 1.5rem;
}

.important-info li {
    margin-bottom: 0.5rem;
    color: #333;
}

.data-source-selection {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.data-source-selection label {
    font-size: 1.1rem;
    color: #495057;
    margin-bottom: 1rem;
}

.active-source-status {
    margin-top: 1rem;
    padding: 0.5rem;
    text-align: center;
    border-radius: 4px;
    background: #fff3cd;
}

.api-keys-container {
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.api-keys-container h4 {
    color: #495057;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 0.5rem;
}

.api-key-group {
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1rem;
    background: #f8f9fa;
}

.api-key-group:last-child {
    margin-bottom: 0;
}

.api-provider-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.api-provider-info h5 {
    margin: 0;
    color: #495057;
    font-size: 1.1rem;
}

.api-limits {
    background: #17a2b8;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.api-key-controls {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
}

.api-key-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    font-family: monospace;
}

.btn-save-key {
    background: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

.btn-save-key:hover {
    background: #218838;
}

.key-status {
    min-width: 20px;
    text-align: center;
    font-size: 1.2rem;
}

.key-status.saved {
    color: #28a745;
}

.api-help {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.api-key-info {
    padding: 0.75rem;
    background: #fff3cd;
    border-radius: 4px;
    color: #856404;
}

/* Swan Score API Configuration Styling */
.api-section-divider {
    margin: 2rem 0 1.5rem 0;
    padding: 1rem 0;
    border-top: 2px solid var(--primary-color);
    position: relative;
}

.api-section-divider h3 {
    margin: 0 0 0.5rem 0;
    color: var(--primary-color);
    font-size: 1.3rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.api-section-divider .section-description {
    margin: 0;
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.4;
}

/* API Key Selection Dropdown */
.api-key-selection {
    margin-top: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: rgba(var(--primary-color-rgb), 0.05);
    border-radius: 6px;
    border: 1px solid rgba(var(--primary-color-rgb), 0.2);
}

.api-key-selection label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0;
    white-space: nowrap;
}

.api-key-selection select {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.api-key-selection select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.2);
}

/* Public API Status Display */
.api-key-status-only {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: rgba(52, 168, 83, 0.05);
    border-radius: 6px;
    border: 1px solid rgba(52, 168, 83, 0.2);
}

.public-api-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--surface-color);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.public-api-status .api-name {
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.public-api-status .key-status {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Enhanced data-source-selection for Swan Score */
.data-source-selection.swan-score {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.05), rgba(var(--primary-color-rgb), 0.02));
    border: 2px solid rgba(var(--primary-color-rgb), 0.3);
    position: relative;
}

.data-source-selection.swan-score::before {
    content: '🦢';
    position: absolute;
    top: -12px;
    right: 1rem;
    background: var(--primary-color);
    color: white;
    padding: 6px 12px;
    border-radius: 12px;
    font-size: 0.8rem;
}

/* Swan Score API provider-specific styling */
.api-key-group.swan-api {
    border-left: 4px solid var(--primary-color);
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.02), transparent);
}

.api-key-group.swan-api .api-provider-info h5 {
    color: var(--primary-color);
    font-weight: 600;
}

.api-key-group.swan-api .api-limits {
    background: var(--primary-color);
    color: white;
}

/* Connection status indicators for Swan Score APIs */
.active-source-status .status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.9rem;
}

.active-source-status .status.swan-connected {
    background: rgba(52, 168, 83, 0.15);
    color: #1b5e20;
    border: 1px solid #4caf50;
}

.active-source-status .status.swan-error {
    background: rgba(244, 67, 54, 0.15);
    color: #b71c1c;
    border: 1px solid #f44336;
}

.active-source-status .status.swan-checking {
    background: rgba(255, 193, 7, 0.15);
    color: #f57c00;
    border: 1px solid #ffc107;
}

/* Responsive design for API configuration */
@media (max-width: 768px) {
    .api-key-selection {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .api-key-selection label {
        white-space: normal;
    }
    
    .api-key-selection select {
        width: 100%;
    }
    
    .public-api-status {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }
}

.config-actions {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
}

.btn-test {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-test:hover {
    background: #0056b3;
}

.status {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
}

.status.connected {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status.disconnected {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Theme-specific enhancements */

/* Dark theme input and form enhancements */
[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background-color: #2d2d2d;
    border-color: #444444;
    color: var(--text-primary);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
}

/* Dark theme button enhancements */
[data-theme="dark"] .btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="dark"] .btn-secondary {
    background: #404040;
    border-color: #555555;
    color: var(--text-primary);
}

[data-theme="dark"] .btn-secondary:hover {
    background: #555555;
}

/* Dark theme status indicators */
[data-theme="dark"] .status.connected {
    background: rgba(52, 168, 83, 0.2);
    color: #4caf50;
    border-color: #388e3c;
}

[data-theme="dark"] .status.disconnected {
    background: rgba(234, 67, 53, 0.2);
    color: #f44336;
    border-color: #d32f2f;
}

/* Dark theme scrollbar */
[data-theme="dark"] ::-webkit-scrollbar {
    width: 8px;
}

[data-theme="dark"] ::-webkit-scrollbar-track {
    background: #2d2d2d;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: #555555;
    border-radius: 4px;
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: #666666;
}

/* Blue theme enhancements */
[data-theme="blue"] .btn-primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

[data-theme="blue"] .btn-secondary {
    background: var(--secondary-color);
    border-color: var(--secondary-color);
}

/* Dark theme API Configuration specific styles */
[data-theme="dark"] .important-info {
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-color: #4285f4;
    color: var(--text-primary);
}

[data-theme="dark"] .important-info h4 {
    color: #4285f4;
}

[data-theme="dark"] .important-info li {
    color: var(--text-secondary);
}

[data-theme="dark"] .data-source-selection {
    background: #2d2d2d;
    border-color: #444444;
}

[data-theme="dark"] .data-source-selection label {
    color: var(--text-primary);
}

[data-theme="dark"] .active-source-status {
    background: #3a3a3a;
    color: var(--text-secondary);
}

[data-theme="dark"] .api-keys-container {
    background: #2d2d2d;
    border-color: #444444;
}

[data-theme="dark"] .api-keys-container h4 {
    color: var(--text-primary);
    border-color: #444444;
}

[data-theme="dark"] .api-key-group {
    background: #333333;
    border-color: #555555;
}

[data-theme="dark"] .api-provider-info h5 {
    color: var(--text-primary);
}

[data-theme="dark"] .api-limits {
    color: var(--text-secondary);
    background: #404040;
}

[data-theme="dark"] .api-help {
    color: var(--text-secondary);
}

[data-theme="dark"] .api-help a {
    color: #4285f4;
}

[data-theme="dark"] .api-help a:hover {
    color: #6ab7ff;
}

[data-theme="dark"] .btn-test {
    background: #404040;
    border-color: #555555;
    color: var(--text-primary);
}

[data-theme="dark"] .btn-test:hover {
    background: #555555;
}

[data-theme="dark"] .btn-save-key {
    background: #2d7d32;
    border-color: #2d7d32;
}

[data-theme="dark"] .btn-save-key:hover {
    background: #388e3c;
}

[data-theme="dark"] .key-status.saved {
    color: #4caf50;
}

[data-theme="dark"] .config-actions {
    background: transparent;
}

/* Dark theme Swan Score API styling */
[data-theme="dark"] .api-section-divider {
    border-top-color: var(--primary-color);
}

[data-theme="dark"] .api-section-divider h3 {
    color: var(--primary-color);
}

[data-theme="dark"] .api-section-divider .section-description {
    color: var(--text-secondary);
}

[data-theme="dark"] .api-key-selection {
    background: rgba(var(--primary-color-rgb), 0.1);
    border-color: rgba(var(--primary-color-rgb), 0.3);
}

[data-theme="dark"] .api-key-selection select {
    background: var(--surface-color);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .api-key-status-only {
    background: rgba(52, 168, 83, 0.1);
    border-color: rgba(52, 168, 83, 0.3);
}

[data-theme="dark"] .public-api-status {
    background: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .public-api-status .api-name {
    color: var(--text-primary);
}

[data-theme="dark"] .data-source-selection.swan-score {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.1), rgba(var(--primary-color-rgb), 0.05));
    border-color: rgba(var(--primary-color-rgb), 0.4);
}

[data-theme="dark"] .api-key-group.swan-api {
    background: linear-gradient(135deg, rgba(var(--primary-color-rgb), 0.05), transparent);
}

[data-theme="dark"] .api-key-group.swan-api .api-provider-info h5 {
    color: var(--primary-color);
}

/* Comments Section Styles */
.comments-section {
    margin-top: 2rem;
    padding: 1.5rem;
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.comments-section h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: var(--text-color);
    font-size: 1.1rem;
}

.comment-input-container {
    margin-bottom: 1rem;
}

.comment-textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--input-background);
    color: var(--text-color);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    resize: vertical;
    min-height: 80px;
    box-sizing: border-box;
}

.comment-textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(26, 115, 232, 0.1);
}

.comment-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.comment-display {
    padding: 1rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-top: 1rem;
}

.comment-text {
    color: var(--text-color);
    line-height: 1.5;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 0.75rem;
}

.comment-actions-small {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    text-decoration: none;
    padding: 0;
    font-size: inherit;
}

.btn-link:hover {
    text-decoration: underline;
}

/* Historical list comment icons */
.comment-icon {
    color: var(--primary-color);
    font-size: 0.9rem;
    margin-left: 0.5rem; /* Back to original margin */
    cursor: pointer;
    opacity: 0.8;
}

.comment-icon:hover {
    opacity: 1;
}

.comment-add {
    color: var(--text-color-secondary);
    opacity: 0.5;
}

.comment-add:hover {
    opacity: 0.8;
}

.comment-tooltip {
    position: relative;
}

.comment-tooltip .tooltip-text {
    visibility: hidden;
    width: 200px;
    background-color: var(--tooltip-background, #333);
    color: var(--tooltip-text, #fff);
    text-align: left;
    border-radius: 6px;
    padding: 0.5rem;
    position: absolute;
    z-index: 1000;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.3s;
    font-size: 0.8rem;
    line-height: 1.3;
    word-wrap: break-word;
}

.comment-tooltip:hover .tooltip-text {
    visibility: visible;
    opacity: 1;
}

/* Excel Export Button Styles */
.excel-export-btn {
    width: 100% !important;
    background: #1f7a1f !important;
    border-color: #1f7a1f !important;
    color: white !important;
    font-weight: 600;
    padding: 0.6rem 1rem;
    margin-top: 0.25rem;
}

.excel-export-btn:hover {
    background: #1e6b1e !important;
    border-color: #1e6b1e !important;
}

.excel-export-btn:disabled {
    background: #ccc !important;
    border-color: #ccc !important;
    cursor: not-allowed;
    opacity: 0.6;
}

.btn-excel {
    background: #1f7a1f;
    border: 1px solid #1f7a1f;
    color: white;
}

.btn-excel:hover {
    background: #1e6b1e;
    border-color: #1e6b1e;
}

/* Theme support for Excel button */
[data-theme="dark"] .excel-export-btn {
    background: #2d7d32 !important;
    border-color: #2d7d32 !important;
}

[data-theme="dark"] .excel-export-btn:hover {
    background: #388e3c !important;
    border-color: #388e3c !important;
}

[data-theme="professional-blue"] .excel-export-btn {
    background: #1976d2 !important;
    border-color: #1976d2 !important;
}

[data-theme="professional-blue"] .excel-export-btn:hover {
    background: #1565c0 !important;
    border-color: #1565c0 !important;
}

/* Trading Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

/* Alternative centering for very small screens */
@media (max-height: 600px) {
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        margin: 10px auto;
        width: calc(100% - 20px);
        max-height: calc(100vh - 20px);
        min-height: auto;
    }
}

.modal-content {
    background-color: var(--background-color);
    margin: 5vh auto;
    padding: 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    position: relative;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
}

/* Ensure modal content is scrollable on small screens */
@media (max-height: 800px) {
    .modal-content {
        margin: 2vh auto;
        max-height: 96vh;
        padding: 15px;
    }
}

.close {
    color: var(--text-secondary);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 20px;
}

.close:hover,
.close:focus {
    color: var(--text-primary);
}

.trading-form {
    margin-top: 20px;
}

.trading-type-section {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.trading-type-section label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
}

.trading-type-section input[type="checkbox"] {
    margin: 0;
    transform: scale(1.2);
}

.trading-inputs {
    display: none;
    gap: 15px;
    margin-bottom: 20px;
}

.trading-inputs.show {
    display: flex;
    flex-direction: column;
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.input-group input,
.input-group textarea {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background-color: var(--background-color);
    color: var(--text-primary);
    font-size: 1rem;
    font-family: inherit;
}

.input-group textarea {
    resize: vertical;
    min-height: 60px;
}

.trading-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
    position: sticky;
    bottom: 0;
    background-color: var(--background-color);
    z-index: 10;
}

.trading-actions .btn {
    min-width: 80px;
}

/* Ensure trading form content has proper spacing for sticky buttons */
.trading-form {
    margin-top: 20px;
    padding-bottom: 10px;
}

/* Trading Icons */
.trading-icon {
    cursor: pointer;
    font-size: 1rem;
    margin-left: 4px;
    display: inline-block;
    transition: transform 0.2s;
}

.trading-icon:hover {
    transform: scale(1.1);
}

.trading-bought {
    color: #4caf50;
}

.trading-sold {
    color: #ff9800;
}

/* Risk Assessment Styles */
.risk-status {
    font-size: 0.85rem;
    font-weight: 500;
    padding: 2px 6px;
    border-radius: 12px;
    margin-left: 8px;
    display: inline-block;
}

/* Risk Assessment Configuration Styles */
.risk-config-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 1rem;
}

.config-group {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 1rem;
}

.config-group h4 {
    margin: 0 0 0.75rem 0;
    color: var(--accent-color);
    font-size: 1rem;
    font-weight: 600;
}

.config-description {
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.priority-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.priority-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.priority-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    background: var(--accent-color);
    color: white;
    border-radius: 50%;
    font-size: 0.8rem;
    font-weight: 600;
}

.priority-source {
    font-weight: 600;
    color: var(--text-primary);
    min-width: 140px;
}

.priority-reason {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-style: italic;
}

.parameter-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.parameter-controls .form-group {
    margin: 0;
}

.parameter-controls label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.parameter-controls .select-input {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.parameter-controls .select-input:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(30, 144, 255, 0.2);
}

.parameter-controls .select-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.risk-status.low-risk {
    background-color: rgba(52, 168, 83, 0.1);
    color: #34a853;
}

.risk-status.medium-risk {
    background-color: rgba(251, 188, 4, 0.1);
    color: #f57c00;
}

.risk-status.high-risk {
    background-color: rgba(234, 67, 53, 0.1);
    color: #ea4335;
}

.risk-status.needs-update {
    background-color: rgba(158, 158, 158, 0.1);
    color: #9e9e9e;
}

.risk-status.unknown-risk {
    background-color: rgba(158, 158, 158, 0.1);
    color: #9e9e9e;
}

.btn-risk {
    background-color: var(--warning-color) !important;
    color: white !important;
}

.btn-risk:hover {
    background-color: #e8a100 !important;
    transform: translateY(-1px);
}

/* Analysis Load Button */
.btn-analysis {
    background-color: var(--info-color) !important;
    color: white !important;
}

.btn-analysis:hover {
    background-color: #2980b9 !important;
    transform: translateY(-1px);
}

/* Risk Assessment Modal Styles */
.risk-assessment-results {
    padding: 20px;
    max-height: 70vh;
    overflow-y: auto;
}

.risk-assessment-results h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    text-align: center;
}

.current-status {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.status-row:last-child {
    margin-bottom: 0;
}

.status-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.status-value {
    font-weight: 600;
    color: var(--text-primary);
}

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

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

.risk-recommendation {
    margin-bottom: 20px;
}

.risk-recommendation h4 {
    color: var(--primary-color);
    margin-bottom: 15px;
}

.risk-level-display {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.risk-level {
    padding: 6px 12px;
    border-radius: 16px;
    font-weight: 600;
    font-size: 0.9rem;
}

.risk-level.low {
    background-color: rgba(52, 168, 83, 0.15);
    color: #34a853;
}

.risk-level.medium {
    background-color: rgba(251, 188, 4, 0.15);
    color: #f57c00;
}

.risk-level.high {
    background-color: rgba(234, 67, 53, 0.15);
    color: #ea4335;
}

.confidence-score {
    background-color: var(--primary-background);
    color: var(--primary-color);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 500;
}

.main-recommendation {
    background: var(--primary-background);
    color: var(--primary-color);
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-weight: 500;
}

.stop-loss-recommendation {
    background: var(--success-background);
    border: 1px solid rgba(52, 168, 83, 0.3);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
}

.stop-loss-recommendation h5 {
    color: var(--success-color);
    margin-bottom: 8px;
}

.detailed-analysis {
    margin-bottom: 15px;
}

.detailed-analysis h5 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.analysis-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px;
    margin-bottom: 8px;
}

.analysis-item:last-child {
    margin-bottom: 0;
}

.analysis-item strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 4px;
}

.pattern-signals {
    margin-bottom: 15px;
}

.pattern-signals h5 {
    color: var(--text-primary);
    margin-bottom: 10px;
}

.signal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.signal-tag {
    background: var(--secondary-color);
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.modal-actions .btn-primary,
.modal-actions .btn-secondary {
    min-width: 100px;
}

/* Trading Button Styles */
.btn-trading {
    min-width: 50px;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* Trading Info in Results */
.info-item.trading-info .info-label {
    font-weight: bold;
}

.info-item.trading-info .trading-bought {
    color: var(--success-color);
    font-weight: 500;
}

.info-item.trading-info .trading-sold {
    color: var(--warning-color);
    font-weight: 500;
}

.info-item.trading-info small {
    opacity: 0.8;
    font-size: 0.85em;
}

/* Advanced Target/Stop Configuration Styles */
.target-method-config,
.stop-method-config,
.risk-method-config {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
    transition: all 0.3s ease;
}

.target-method-config.active,
.stop-method-config.active,
.risk-method-config.active {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(26, 115, 232, 0.1);
}

.target-method-config h4,
.stop-method-config h4,
.risk-method-config h4 {
    margin: 0 0 0.75rem 0;
    color: var(--primary-color);
    font-size: 0.95rem;
    font-weight: 600;
}

.input-with-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-unit input {
    flex: 1;
}

.input-with-unit .unit {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 50px;
    text-align: center;
}

/* Method Configuration Animations */
.target-method-config,
.stop-method-config,
.risk-method-config {
    opacity: 0;
    transform: translateY(-10px);
    animation: slideInFade 0.3s ease forwards;
}

@keyframes slideInFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Advanced Configuration Section Headers */
.parameter-group h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.parameter-group h3::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--primary-color);
    border-radius: 2px;
}

/* Configuration Method Pills */
.config-method-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 0.25rem 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.config-method-pill.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Risk Management Visualization */
.risk-visualization {
    background: linear-gradient(135deg, #f8f9fa 0%, #e8f0fe 100%);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 0.75rem;
}

.risk-bar {
    height: 8px;
    background: var(--background-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.risk-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--danger-color) 0%, var(--warning-color) 50%, var(--success-color) 100%);
    transition: width 0.3s ease;
}

/* Professional Configuration Tooltips */
.config-tooltip {
    position: relative;
    cursor: help;
}

.config-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 125%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--text-primary);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    font-size: 0.75rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1000;
}

.config-tooltip:hover::after {
    opacity: 1;
}

/* Trading Methods Display */
.trading-methods-container {
    margin-top: 2rem;
    border-top: 2px solid var(--border-color);
    padding-top: 1.5rem;
}

.trading-method-section {
    margin-bottom: 2rem;
}

.trading-method-section h4 {
    margin: 0 0 1rem 0;
    color: var(--text-primary);
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.trading-method-average {
    background: var(--primary-background);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.clickable-average {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.clickable-average:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: var(--success-color);
    background: var(--success-background);
}

.clickable-average.selected {
    border-color: var(--success-color);
    background: var(--success-background);
    box-shadow: var(--shadow-lg);
}

.clickable-average.selected::after {
    content: "✓ Selected";
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--success-color);
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.click-hint {
    font-size: 0.75rem;
    color: var(--text-secondary);
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.clickable-average:hover .click-hint {
    opacity: 1;
    color: var(--success-color);
}

.trading-method-average strong {
    color: var(--primary-color);
    font-size: 1.1rem;
}

.average-percent {
    background: var(--primary-background);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 600;
    margin: 0 0.5rem;
    border: 1px solid var(--primary-color);
}

.average-percent.stop-loss-percent {
    background: var(--error-background);
    color: var(--error-color);
    border-color: var(--error-color);
}

.average-percent.target-price-percent {
    background: var(--success-background);
    color: var(--success-color);
    border-color: var(--success-color);
}

.confidence-indicator {
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
}

.trading-methods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.trading-method-option {
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    padding-top: 1.2rem; /* Extra space for confidence badge */
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: auto;
}

.trading-method-option:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.trading-method-option.selected {
    border-color: var(--success-color);
    background: var(--success-background);
    box-shadow: var(--shadow-lg);
}

.trading-method-option.recommended {
    border-color: var(--primary-color);
    background: var(--primary-background);
}

.trading-method-option.recommended::after {
    content: "⭐ Recommended";
    position: absolute;
    top: -10px;
    right: 8px;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Adjust confidence badge position for recommended items */
.trading-method-option.recommended .method-confidence {
    top: 1.2rem;
}

.method-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
    line-height: 1.2;
}

.method-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.125rem;
}

.method-percent {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.trading-method-option[data-method-type="stopLoss"] .method-percent {
    color: var(--error-color);
}

.trading-method-option[data-method-type="targetPrice"] .method-percent {
    color: var(--success-color);
}

.method-description {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    line-height: 1.25;
    margin-right: 4rem; /* Leave space for confidence badge */
}

.method-confidence {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.65rem;
    padding: 0.15rem 0.35rem;
    border-radius: 6px;
    font-weight: 500;
    display: inline-block;
    z-index: 1;
}

.confidence-high .method-confidence {
    background: var(--success-background);
    color: var(--success-color);
    border: 1px solid var(--success-color);
}

.confidence-medium .method-confidence {
    background: var(--warning-color);
    color: white;
}

.confidence-low .method-confidence {
    background: var(--error-background);
    color: var(--error-color);
    border: 1px solid var(--error-color);
}

.confidence-user-defined .method-confidence {
    background: var(--primary-background);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

/* Responsive adjustments for trading methods */
@media (max-width: 768px) {
    .trading-methods-grid {
        grid-template-columns: 1fr;
    }
    
    .trading-method-average {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
}

/* Enhancement Highlights Styling */
.feature-highlights {
    margin: 2rem 0;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary-background), var(--success-background));
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
}

.feature-highlights h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhancement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.enhancement-item {
    background: var(--surface-color);
    padding: 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.enhancement-item h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.enhancement-item p {
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--text-secondary);
    margin: 0;
}

.enhancement-item strong {
    color: var(--text-primary);
}

/* Sector Analysis Styling */
.sector-enhanced {
    position: relative;
    border-left: 3px solid var(--primary-color) !important;
    background: linear-gradient(90deg, var(--primary-background), transparent);
}

.sector-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.sector-analysis {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border-radius: 4px;
    font-size: 0.85rem;
}

.sector-analysis.high-confidence {
    background: var(--success-background);
    border: 1px solid var(--success-color);
}

.sector-analysis.medium-confidence {
    background: var(--warning-color);
    color: white;
    border: 1px solid var(--warning-color);
}

.sector-analysis.low-confidence {
    background: var(--error-background);
    border: 1px solid var(--error-color);
}

.sector-message {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.sector-ratio {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Sector info in stock-info-grid */
.info-item.sector-info {
    border-left: 3px solid var(--primary-color);
    background: var(--primary-background);
}

.info-item.sector-info .info-value {
    font-weight: 500;
}

.info-item.sector-info small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.sector-ratio {
    font-size: 0.8rem;
    opacity: 0.9;
}



/* Single column fallback for smaller screens */
@media (max-width: 1199px) {
    .dual-column-container {
        display: none !important;
    }
    
    .single-column-container {
        display: block;
    }
    
    .left-column, .right-column {
        width: 100%;
        margin-bottom: 2rem;
    }
    
    .layout-toggle {
        display: none;
    }
}

/* Container states */
.single-column-container #dualColumnContent {
    display: none;
}

.dual-column-container #singleColumnContent {
    display: none;
}

.dual-column-container #dualColumnContent {
    display: grid;
}

/* ===== COLLAPSIBLE SECTIONS ===== */
.collapsible-section {
    margin-bottom: 1.5rem;
    border: 1px solid var(--section-border);
    border-radius: 8px;
    background: var(--surface-color);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: all 0.3s ease;
}

.collapsible-section.collapsed {
    box-shadow: var(--shadow-sm);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--section-header-bg);
    border-bottom: 1px solid var(--section-border);
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
}

.section-header:hover {
    background: var(--section-header-hover);
}

.section-header h3,
.section-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-header .checklist-score {
    font-size: 0.9rem;
    margin-left: 0.5rem;
}

.collapse-icon {
    font-size: 1rem;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
    font-weight: bold;
}

.collapsible-section.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.section-content {
    padding: 1.25rem;
}

.collapsible-section.collapsed .section-content {
    display: none;
}

/* Trading methods container adjustments */
.trading-methods-container {
    margin-bottom: 0;
}

.trading-method-section {
    margin-bottom: 0;
}

.trading-method-section h4 {
    margin: 0 0 1rem 0;
}

/* Stock info grid adjustments */
.stock-info-grid {
    margin-bottom: 0;
}

/* Checklist results adjustments */
.checklist-criteria-results {
    margin-bottom: 0;
}

/* Theme transition animations */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* Responsive Design for Dual Tab System */
@media (max-width: 1024px) {
    .header-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
    
    .header-actions {
        order: -1; /* Show About button above split controls */
    }
    
    .dual-tab-controls {
        align-items: center;
        min-width: auto;
    }
    
    .tab-selectors {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .dual-tab-container {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr 1fr;
        height: auto;
        min-height: calc(100vh - 250px);
        padding: 0 1rem;
    }
    
    .dual-tab-left,
    .dual-tab-right {
        height: auto;
        min-height: 400px;
    }
}

@media (max-width: 768px) {
    .header-content {
        padding: 0 1rem;
    }
    
    .header-about-btn .text {
        display: none; /* Hide text on mobile, show only icon */
    }
    
    .header-about-btn {
        padding: 0.75rem;
        min-width: 48px;
        justify-content: center;
    }
    
    .dual-tab-controls {
        display: none; /* Hide dual tab controls on mobile */
    }
    
    .dual-tab-container {
        display: none !important; /* Force single column on mobile */
    }
    
    .single-tab-container {
        display: block !important;
    }
}

/* Desktop optimization for dual tab layout */
@media (min-width: 1200px) {
    .dual-tab-container {
        gap: 2rem;
        height: calc(100vh - 180px);
        padding: 0 2rem;
    }
    
    .dual-tab-left .tab-content,
    .dual-tab-right .tab-content {
        padding: 2rem;
    }
}

/* Extra large screens */
@media (min-width: 1600px) {
    .dual-tab-container {
        gap: 2.5rem;
        padding: 0 3rem;
    }
    
    .dual-tab-left .tab-content,
    .dual-tab-right .tab-content {
        padding: 2.5rem;
    }
}

/* Export to Applications Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

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

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

.modal-body {
    padding: 20px 24px 24px;
}

.applications-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.app-card {
    padding: 20px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background: var(--card-background, var(--surface-color));
}

.app-card:hover {
    border-color: var(--primary-color) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--shadow-hover, var(--shadow-md)) !important;
}

.modal-actions {
    margin-top: 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Responsive modal */
@media (max-width: 768px) {
    .modal-content {
        max-width: 95vw;
        margin: 10px;
    }
    
    .applications-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-header,
    .modal-body {
        padding-left: 16px;
        padding-right: 16px;
    }
}

/* ========================================
   REAL-TIME INSTITUTIONAL INTELLIGENCE
   ======================================== */

/* System Status Bar */
.system-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.1), rgba(33, 150, 243, 0.1));
    border: 1px solid rgba(76, 175, 80, 0.3);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.live {
    background: #4CAF50;
    animation: pulse-green 2s infinite;
}

.status-dot.warning {
    background: #FF9800;
    animation: pulse-orange 2s infinite;
}

.status-dot.error {
    background: #f44336;
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); }
    70% { opacity: 0.7; box-shadow: 0 0 0 10px rgba(76, 175, 80, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0); }
}

@keyframes pulse-orange {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.7); }
    70% { opacity: 0.7; box-shadow: 0 0 0 10px rgba(255, 152, 0, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(255, 152, 0, 0); }
}

@keyframes pulse-red {
    0% { opacity: 1; box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7); }
    70% { opacity: 0.7; box-shadow: 0 0 0 10px rgba(244, 67, 54, 0); }
    100% { opacity: 1; box-shadow: 0 0 0 0 rgba(244, 67, 54, 0); }
}

.update-time {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Real-Time Loading Card */
.institutional-card.real-time-loading {
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    text-align: center;
    padding: 2rem;
    border: none;
}

.loading-content h3 {
    margin: 1rem 0;
    color: white;
    font-size: 1.5rem;
}

.loading-content p {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1.5rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

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

.loading-details {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 300px;
    margin: 0 auto;
    text-align: left;
}

.loading-step {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.3rem 0;
}

.loading-step.active {
    color: white;
    font-weight: 600;
    animation: flash 1.5s infinite;
}

@keyframes flash {
    0%, 50% { opacity: 1; }
    25%, 75% { opacity: 0.7; }
}

/* Institutional Insights Section */
.institutional-insights {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.insight-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.5rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.insight-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.insight-icon {
    font-size: 1.5rem;
}

.insight-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.insight-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.insight-content p {
    margin: 0;
}

/* Responsive Design for Real-Time Elements */
@media (max-width: 768px) {
    .system-status-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .status-indicator {
        justify-content: center;
    }
    
    .institutional-insights {
        grid-template-columns: 1fr;
    }
    
    .loading-details {
        text-align: center;
    }
}

/* Dark Theme Adjustments for Real-Time Elements */
[data-theme="dark"] .system-status-bar {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15), rgba(33, 150, 243, 0.15));
    border-color: rgba(76, 175, 80, 0.4);
}

[data-theme="dark"] .insight-card {
    background: var(--surface-color);
    border-color: var(--border-color);
}

[data-theme="dark"] .insight-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

/* Real-Time Institutional Cards */
.institutional-card.real-time {
    position: relative;
    border: 2px solid transparent;
    background: var(--surface-color);
    transition: all 0.3s ease;
}

.institutional-card.real-time:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.real-time-indicator {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(76, 175, 80, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.live-dot {
    width: 6px;
    height: 6px;
    background: #4CAF50;
    border-radius: 50%;
    animation: pulse-green 2s infinite;
}

.live-text {
    font-weight: 500;
    color: #4CAF50;
}

/* Alert Items */
.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 8px;
    border-left: 4px solid;
    background: var(--surface-color);
}

.alert-item.bullish {
    border-left-color: #4CAF50;
    background: rgba(76, 175, 80, 0.05);
}

.alert-item.bearish {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.05);
}

.alert-icon {
    font-size: 1.2rem;
}

.alert-details {
    flex: 1;
    font-size: 0.9rem;
}

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

.alert-details small {
    color: var(--text-secondary);
}

/* Recommendation Classes */
.metric-value.positive {
    color: #4CAF50;
    font-weight: 600;
}

.metric-value.negative {
    color: #f44336;
    font-weight: 600;
}

.metric-value.neutral {
    color: var(--text-secondary);
    font-weight: 500;
}

/* ========================================== */
/* UNIVERSAL HAMBURGER WATCHLIST SYSTEM */
/* ========================================== */

/* Hamburger Menu Button - Day 2 Enhanced */
.hamburger-menu-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.75rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 1rem;
    position: relative;
    z-index: 10000;
}

.hamburger-menu-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.3);
    border-color: rgba(76, 175, 80, 0.5);
}

.hamburger-menu-btn:hover {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.3) 100%);
    border-color: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.hamburger-menu-btn.active {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
    border-color: var(--primary-color);
    color: white;
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 8px 25px rgba(var(--primary-color-rgb), 0.3), 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Day 2: Active state text color */
.hamburger-menu-btn.active .hamburger-text {
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

/* Day 2: Loading and loaded states */
.hamburger-menu-btn.loading {
    opacity: 0.8;
    pointer-events: none;
}

.hamburger-menu-btn.loading .hamburger-text::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

.hamburger-menu-btn.loaded {
    animation: successPulse 0.6s ease-out;
}

@keyframes loadingDots {
    0%, 20% { opacity: 0.2; }
    40% { opacity: 0.5; }
    60% { opacity: 0.8; }
    80%, 100% { opacity: 0.2; }
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px rgba(76, 175, 80, 0.4); }
    100% { transform: scale(1); }
}

.hamburger-menu-btn.active .hamburger-lines span {
    background-color: white;
}

/* Hamburger Lines Animation */
.hamburger-lines {
    display: flex;
    flex-direction: column;
    width: 18px;
    height: 14px;
    justify-content: space-between;
}

.hamburger-lines span {
    height: 2px;
    background: white;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    border-radius: 1px;
    transform-origin: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.hamburger-menu-btn.active .hamburger-lines span:nth-child(1) {
    transform: rotate(45deg) translate(4px, 4px);
    background: #4CAF50;
}

.hamburger-menu-btn.active .hamburger-lines span:nth-child(2) {
    opacity: 0;
    transform: scale(0);
}

.hamburger-menu-btn.active .hamburger-lines span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
    background: #4CAF50;
}

/* Visual connection line between hamburger and watchlist */
.hamburger-menu-btn.active::after {
    content: '';
    position: absolute;
    right: -10px;
    top: 50%;
    width: 10px;
    height: 1px;
    background: linear-gradient(to right, #4CAF50, transparent);
    transform: translateY(-50%);
    opacity: 0.6;
    animation: connectionPulse 2s ease-in-out infinite;
}

@keyframes connectionPulse {
    0%, 100% { opacity: 0.3; transform: translateY(-50%) scaleX(0.5); }
    50% { opacity: 0.8; transform: translateY(-50%) scaleX(1); }
}

.hamburger-text {
    font-size: 0.85rem;
    color: var(--text-primary);
}

/* Watchlist Overlay System - Day 2 Enhanced */
.watchlist-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.4) 0%, rgba(20, 30, 60, 0.6) 100%);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
    backdrop-filter: blur(8px) saturate(1.2);
    -webkit-backdrop-filter: blur(8px) saturate(1.2);
    cursor: pointer;
}

.watchlist-overlay.active {
    display: block;
    opacity: 1;
}

.watchlist-overlay.loading {
    display: block;
    opacity: 0.3;
}

.watchlist-overlay.loading .watchlist-sidebar {
    transform: translateX(100%) translateY(-20px) scale(0.95);
}

.watchlist-sidebar {
    position: absolute;
    top: 60px;
    right: 20px;
    width: 420px;
    max-width: calc(100vw - 40px);
    max-height: calc(100vh - 100px);
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fb 50%, #f0f2f5 100%);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    box-shadow: 
        0 24px 80px rgba(0, 0, 0, 0.12),
        0 12px 40px rgba(0, 0, 0, 0.08),
        0 6px 20px rgba(0, 0, 0, 0.04),
        0 2px 8px rgba(0, 0, 0, 0.02),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    overflow: hidden;
    transform: translateX(100%) translateY(-20px) scale(0.92);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
    backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    cursor: default;
}

.watchlist-overlay.active .watchlist-sidebar {
    transform: translateX(0) translateY(0) scale(1);
    opacity: 1;
}

/* Day 2: Enhanced animation states */
.watchlist-sidebar.loading {
    transform: translateX(0) translateY(0) scale(0.98);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.watchlist-sidebar.loaded {
    transform: translateX(0) translateY(0) scale(1);
    opacity: 1;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Watchlist Header */
.watchlist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
}

.watchlist-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.watchlist-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.watchlist-close-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    position: relative;
    overflow: hidden;
}

.watchlist-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.watchlist-close-btn:active {
    transform: scale(0.95);
}

/* Real-Time Data Controls */
.realtime-controls {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

/* Real-Time Data Controls in API Configuration */
.realtime-data-controls {
    margin-top: 20px;
    padding: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--surface-color);
}

.realtime-controls-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

@media (max-width: 768px) {
    .realtime-controls-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.control-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.toggle-label {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 8px;
}

.toggle-input {
    display: none;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 12px;
    position: relative;
    transition: all 0.3s ease;
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-slider {
    background: #4CAF50;
}

.toggle-input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

.toggle-text {
    font-weight: 500;
    color: white;
}

.api-status {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    background: #dc3545;
    color: white;
}

.api-status.active {
    background: #28a745;
}

.update-frequency {
    margin-top: 8px;
}

.update-frequency label {
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.9rem;
    margin-right: 8px;
}

.update-frequency select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
}

/* Day 3: Enhanced Symbol Management */
.symbol-management {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.add-symbol-form {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.smart-input-wrapper {
    position: relative;
    flex: 1;
}

.add-symbol-form input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: white;
    font-size: 1rem;
    text-transform: uppercase;
    transition: all 0.2s ease;
}

.add-symbol-form input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.1);
}

.add-symbol-form input.has-suggestions {
    border-radius: 8px 8px 0 0;
    border-bottom-color: var(--primary-color);
}

.symbol-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid var(--primary-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-left: 3px solid var(--primary-color);
}

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

.suggestion-symbol {
    font-weight: 600;
    color: var(--primary-color);
    font-size: 1rem;
}

.suggestion-name {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

.add-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.add-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 4px 16px rgba(76, 175, 80, 0.3);
}

.add-btn:active {
    transform: translateY(0) scale(0.98);
}

/* Day 3: Bulk Actions */
.bulk-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    margin-top: 8px;
    animation: slideInFromTop 0.3s ease-out;
}

.bulk-controls {
    display: flex;
    gap: 8px;
}

.bulk-btn {
    background: white;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.bulk-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-1px);
}

/* Day 4: Specialized bulk action button colors */
.export-analysis-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1e40af 100%);
    color: white;
    border-color: #3b82f6;
}

.export-analysis-btn:hover {
    background: linear-gradient(135deg, #1e40af 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.sync-data-btn {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-color: #10b981;
}

.sync-data-btn:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-2px) rotate(180deg);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

/* Day 4: Export status indicator */
.export-status {
    margin-top: 12px;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
    animation: slideInFromTop 0.3s ease-out;
}

.export-status.success {
    background: rgba(34, 197, 94, 0.1);
    color: #059669;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.export-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.export-status.loading {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.sync-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
}

.selection-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.last-sync {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    font-style: italic;
}

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

/* Day 3: Minimal checkbox styling - theme compatible */
.symbol-checkbox {
    cursor: pointer;
    accent-color: var(--primary-color, #007bff);
}

/* Active suggestion styling */
.suggestion-item.active {
    background: var(--primary-color);
    color: white;
}

.suggestion-item.active .suggestion-symbol,
.suggestion-item.active .suggestion-name {
    color: white;
}

/* Watchlist Content - Day 2 Enhanced */
.watchlist-content {
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 300px);
    min-height: 300px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    /* Force hardware acceleration for better scrolling performance */
    transform: translateZ(0);
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    animation: fadeInContent 0.6s ease 0.3s forwards;
}

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

/* Enhanced Watchlist Items */
.watchlist-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s ease;
    cursor: pointer;
}

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

.watchlist-item.selected {
    background: var(--watchlist-selected-bg);
    border-left: 4px solid var(--primary-color);
    color: var(--text-primary);
}

.item-checkbox {
    margin-right: 12px;
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.item-symbol {
    font-weight: bold;
    font-size: 1rem;
    color: #2c3e50;
    min-width: 60px;
}

.item-company {
    flex: 1;
    font-size: 0.9rem;
    color: #666;
    margin: 0 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.item-price {
    text-align: right;
    min-width: 100px;
}

.price-current {
    font-weight: bold;
    font-size: 1rem;
    color: #2c3e50;
}

.price-change {
    font-size: 0.8rem;
    margin-top: 2px;
}

.price-change.positive {
    color: #28a745;
}

.price-change.negative {
    color: #dc3545;
}

.price-updated {
    font-size: 0.7rem;
    color: #999;
    margin-top: 2px;
}

.item-actions {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.action-btn {
    background: none;
    border: 1px solid #ddd;
    padding: 4px 6px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.action-btn:hover {
    background: #f0f0f0;
    transform: scale(1.1);
}

.action-btn.analyze {
    border-color: #007bff;
    color: #007bff;
}

.action-btn.analyze:hover {
    background: #007bff;
    color: white;
}

.action-btn.remove {
    border-color: #dc3545;
    color: #dc3545;
}

.action-btn.remove:hover {
    background: #dc3545;
    color: white;
}

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

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

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

/* Transparency Control */
/* Batch Controls */
.batch-controls {
    padding: 16px 20px;
    border-top: 2px solid #f0f0f0;
    background: #f8f9fa;
}

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

.batch-header h4 {
    margin: 0;
    color: #2c3e50;
    font-size: 1rem;
}

.selected-count {
    background: #007bff;
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: bold;
}

.batch-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.batch-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

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

/* App Compatibility Grid */
.app-compatibility {
    display: grid;
    gap: 8px;
}

.app-option {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.app-option.compatible {
    border-color: #4CAF50;
    background: #f1f8e9;
}

.app-option.incompatible {
    border-color: #f44336;
    background: #ffebee;
    opacity: 0.6;
    cursor: not-allowed;
}

.app-option:hover.compatible {
    background: #e8f5e8;
    transform: scale(1.02);
}

.app-icon {
    font-size: 1.2rem;
    margin-right: 8px;
}

.app-info {
    flex: 1;
}

.app-name {
    font-weight: bold;
    color: #2c3e50;
    display: block;
}

.app-capacity {
    font-size: 0.8rem;
    color: #666;
}

/* Smart Symbol Input System */
.smart-symbol-input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: 'Courier New', monospace;
    font-size: 1rem;
    background: white;
    transition: all 0.3s ease;
    resize: vertical;
    min-height: 60px;
}

.smart-symbol-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.symbol-count {
    color: #666;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: auto;
}

/* Analysis Mode Buttons */
.analysis-buttons {
    margin-top: 20px;
}

.single-symbol-actions,
.batch-symbol-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.batch-symbol-actions .btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.batch-symbol-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Batch Configuration Panel */
.batch-config-panel {
    margin-top: 16px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
}

.batch-config-panel h3 {
    margin: 0 0 16px 0;
    color: #495057;
    font-size: 1.1rem;
}

/* Transparency classes for different overlay levels */
.watchlist-overlay.transparent-20 { background: rgba(0, 0, 0, 0.2); }
.watchlist-overlay.transparent-30 { background: rgba(0, 0, 0, 0.3); }
.watchlist-overlay.transparent-40 { background: rgba(0, 0, 0, 0.4); }
.watchlist-overlay.transparent-50 { background: rgba(0, 0, 0, 0.5); }
.watchlist-overlay.transparent-60 { background: rgba(0, 0, 0, 0.6); }
.watchlist-overlay.transparent-70 { background: rgba(0, 0, 0, 0.7); }
.watchlist-overlay.transparent-80 { background: rgba(0, 0, 0, 0.8); }
.watchlist-overlay.transparent-90 { background: rgba(0, 0, 0, 0.9); }

/* Mobile Responsive */
@media (max-width: 768px) {
    .hamburger-text {
        display: none;
    }
    
    .hamburger-menu-btn {
        padding: 8px;
        margin-right: 4px;
    }
    
    .watchlist-sidebar {
        width: 320px;
        right: 10px;
        top: 60px;
        max-height: calc(100vh - 80px);
    }
    
    .watchlist-header {
        padding: 12px 16px;
    }
    
    .watchlist-content {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .watchlist-sidebar {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        max-height: calc(100vh - 80px);
        top: 60px;
    }
    
    /* Day 2: Enhanced mobile touch targets */
    .hamburger-menu-btn {
        min-width: 44px;
        min-height: 44px;
        padding: 10px;
    }
    
    .watchlist-overlay {
        -webkit-tap-highlight-color: transparent;
    }
}

/* ================================================
 * PHASE 8 PRIORITY 3: UNIFIED SMART INPUT SYSTEM
 * Enhanced drop zone integration & professional styling
 * ================================================ */

/* Base Smart Input Styling */
.smart-input-unified {
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
    background: var(--surface-color);
    border: 2px solid var(--border-color);
    border-radius: 8px;
}

.smart-input-container {
    position: relative;
    display: block;
}

/* Mode-specific styling */
.smart-input-empty {
    border-color: var(--border-color);
    background: var(--surface-color);
}

.smart-input-single {
    border-color: var(--primary-color);
    background: var(--primary-background);
    box-shadow: 0 0 0 1px rgba(var(--primary-color-rgb), 0.2);
}

.smart-input-batch {
    border-color: var(--secondary-color);
    background: var(--success-background);
    box-shadow: 0 0 0 1px rgba(52, 168, 83, 0.2);
}

/* Drop Zone States */
.smart-input-drop-active {
    border-color: var(--primary-color) !important;
    background: var(--primary-background) !important;
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2) !important;
    transform: scale(1.02);
}

.smart-input-drop-hover {
    border-color: var(--primary-color) !important;
    background: rgba(var(--primary-color-rgb), 0.15) !important;
    box-shadow: 0 0 0 2px rgba(var(--primary-color-rgb), 0.3) !important;
}

.smart-input-drop-success {
    border-color: var(--success-color) !important;
    background: var(--success-background) !important;
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.3) !important;
}

.smart-input-drop-error {
    border-color: var(--error-color) !important;
    background: var(--error-background) !important;
    box-shadow: 0 0 0 3px rgba(234, 67, 53, 0.3) !important;
}

/* Professional Animations */
.smart-input-transition {
    transition: all 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.smart-input-pulse {
    animation: smartInputPulse 1.5s ease-in-out infinite;
}

.smart-input-shake {
    animation: smartInputShake 0.6s ease-in-out;
}

@keyframes smartInputPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

@keyframes smartInputShake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

/* Drop Zone Overlay */
.smart-input-drag-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--primary-color-rgb), 0.95);
    border: 2px dashed rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
    animation: fadeInOverlay 0.2s ease-out;
}

.smart-input-drag-overlay .drop-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: white;
    text-align: center;
}

.smart-input-drag-overlay .drop-indicator svg {
    margin-bottom: 8px;
    animation: bounceIcon 1s ease-in-out infinite;
}

.smart-input-drag-overlay .drop-text {
    font-size: 16px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

@keyframes fadeInOverlay {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

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

/* Enhanced Input Focus States */
.smart-input-unified:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
}

.smart-input-unified:focus.smart-input-single {
    box-shadow: 0 0 0 3px rgba(var(--primary-color-rgb), 0.3);
}

.smart-input-unified:focus.smart-input-batch {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 168, 83, 0.3);
}

/* Dark Theme Adjustments */
[data-theme="dark"] .smart-input-drag-overlay {
    background: rgba(66, 133, 244, 0.9);
    border-color: rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .smart-input-unified {
    background: var(--surface-color);
    border-color: #444746;
}

[data-theme="dark"] .smart-input-single {
    background: rgba(66, 133, 244, 0.15);
}

[data-theme="dark"] .smart-input-batch {
    background: rgba(52, 168, 83, 0.15);
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
    .smart-input-drag-overlay .drop-text {
        font-size: 14px;
    }
    
    .smart-input-drag-overlay .drop-indicator svg {
        width: 40px;
        height: 40px;
    }
    
    .smart-input-drop-active {
        transform: scale(1.01);
    }
}

@media (max-width: 480px) {
    .smart-input-drag-overlay .drop-text {
        font-size: 12px;
    }
    
    .smart-input-drag-overlay .drop-indicator svg {
        width: 36px;
        height: 36px;
    }
}

/* Phase 12.1: AI Stock Scoring Pattern Enhancement Styles */
.insight-premium {
    background: linear-gradient(135deg, rgba(0, 255, 65, 0.1), rgba(0, 230, 118, 0.05));
    border-left: 4px solid #00ff41;
    animation: premiumGlow 2s ease-in-out infinite alternate;
}

.confidence-premium {
    background: linear-gradient(135deg, #00ff41, #00e676);
    color: #000;
    font-weight: 700;
    animation: confidencePulse 1.5s ease-in-out infinite;
}

.pattern-component {
    background: rgba(0, 255, 65, 0.02);
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
}

.pattern-quality-section {
    background: linear-gradient(135deg, rgba(0, 255, 65, 0.05), rgba(0, 230, 118, 0.02));
    border-radius: 12px;
    padding: 1rem;
    margin: 0.5rem 0;
}

.pattern-quality-unavailable {
    background: rgba(158, 158, 158, 0.1);
    border-left: 4px solid #9e9e9e;
    opacity: 0.7;
}

/* Premium animations */
@keyframes premiumGlow {
    0% { box-shadow: 0 0 5px rgba(0, 255, 65, 0.3); }
    100% { box-shadow: 0 0 20px rgba(0, 255, 65, 0.6); }
}

@keyframes confidencePulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Pattern dashboard integration */
.pattern-dashboard-link button:hover {
    background: #1a1a1a !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 255, 65, 0.3);
}

/* Enhanced insight styling */
.insight-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.insight-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.insight-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.insight-title i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

.confidence-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* 🌐 API Status Indicator Styling */
.api-status {
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    position: relative;
    transition: all 0.3s ease;
}

.api-status::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.api-status.connected {
    background-color: rgba(52, 168, 83, 0.15);
    color: #34a853;
    border: 1px solid rgba(52, 168, 83, 0.3);
}

.api-status.connected::before {
    background-color: #34a853;
    animation: pulse-green 2s infinite;
}

.api-status.disconnected {
    background-color: rgba(234, 67, 53, 0.15);
    color: #ea4335;
    border: 1px solid rgba(234, 67, 53, 0.3);
}

.api-status.disconnected::before {
    background-color: #ea4335;
}

.api-status.checking {
    background-color: rgba(251, 188, 4, 0.15);
    color: #fbbc04;
    border: 1px solid rgba(251, 188, 4, 0.3);
}

.api-status.checking::before {
    background-color: #fbbc04;
    animation: pulse-yellow 1s infinite;
}

@keyframes pulse-green {
    0% {
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0.7);
    }
    70% {
        box-shadow: 0 0 0 8px rgba(52, 168, 83, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(52, 168, 83, 0);
    }
}

@keyframes pulse-yellow {
    0% {
        box-shadow: 0 0 0 0 rgba(251, 188, 4, 0.7);
    }
    70% {
        box-shadow: 0 0 0 6px rgba(251, 188, 4, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(251, 188, 4, 0);
    }
}

/* Dark theme API status */
[data-theme="dark"] .api-status.connected {
    background-color: rgba(52, 168, 83, 0.2);
    border-color: rgba(52, 168, 83, 0.4);
}

[data-theme="dark"] .api-status.disconnected {
    background-color: rgba(234, 67, 53, 0.2);
    border-color: rgba(234, 67, 53, 0.4);
}

[data-theme="dark"] .api-status.checking {
    background-color: rgba(251, 188, 4, 0.2);
    border-color: rgba(251, 188, 4, 0.4);
}

/* =============================================================================
   PATTERN INTEGRATION STYLES
   ============================================================================= */

/* Pattern Integration Section */
.pattern-integration-section {
    background: var(--pattern-integration-bg);
    border: 2px solid var(--pattern-integration-border);
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.pattern-integration-section:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.pattern-integration-section .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--pattern-integration-border);
}

.pattern-integration-section .section-header h3 {
    color: var(--pattern-integration-border);
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.integration-status {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

/* Pattern Filters */
.pattern-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.filter-group {
    background: var(--pattern-filter-bg);
    padding: 16px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.filter-group label {
    display: block;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 8px;
    font-size: 0.9rem;
}

.filter-group select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--pattern-integration-border);
    box-shadow: 0 0 0 3px rgba(156, 39, 176, 0.1);
}

.filter-group select:hover {
    border-color: var(--pattern-integration-border);
}

/* Pattern Statistics */
.pattern-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.stat-card {
    background: var(--pattern-stat-bg);
    padding: 16px;
    border-radius: 10px;
    border: 1px solid rgba(76, 175, 80, 0.2);
    text-align: center;
    transition: all 0.3s ease;
}

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

.stat-label {
    display: block;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    display: block;
    color: #4caf50;
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
}

/* Enhanced Result Cards with Pattern Data */
.discovery-result-card[data-pattern-grade],
.stock-card[data-pattern-grade] {
    position: relative;
    border-left: 4px solid transparent;
}

/* Grade-based coloring */
.discovery-result-card[data-pattern-grade="A+"],
.stock-card[data-pattern-grade="A+"] {
    border-left-color: #4caf50;
    background: linear-gradient(90deg, rgba(76, 175, 80, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="A"],
.stock-card[data-pattern-grade="A"] {
    border-left-color: #8bc34a;
    background: linear-gradient(90deg, rgba(139, 195, 74, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="B+"],
.stock-card[data-pattern-grade="B+"] {
    border-left-color: #cddc39;
    background: linear-gradient(90deg, rgba(205, 220, 57, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="B"],
.stock-card[data-pattern-grade="B"] {
    border-left-color: #ffeb3b;
    background: linear-gradient(90deg, rgba(255, 235, 59, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="C+"],
.stock-card[data-pattern-grade="C+"] {
    border-left-color: #ffc107;
    background: linear-gradient(90deg, rgba(255, 193, 7, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="C"],
.stock-card[data-pattern-grade="C"] {
    border-left-color: #ff9800;
    background: linear-gradient(90deg, rgba(255, 152, 0, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="D"],
.stock-card[data-pattern-grade="D"] {
    border-left-color: #ff5722;
    background: linear-gradient(90deg, rgba(255, 87, 34, 0.05) 0%, var(--surface-color) 10%);
}

.discovery-result-card[data-pattern-grade="F"],
.stock-card[data-pattern-grade="F"] {
    border-left-color: #f44336;
    background: linear-gradient(90deg, rgba(244, 67, 54, 0.05) 0%, var(--surface-color) 10%);
}

/* Pattern grade badge */
.pattern-grade-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--surface-color);
    color: var(--text-primary);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* Signal indicators */
.pattern-signal-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 4px;
}

.pattern-signal-badge.STRONG_BUY {
    background: rgba(76, 175, 80, 0.15);
    color: #4caf50;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.pattern-signal-badge.BUY {
    background: rgba(139, 195, 74, 0.15);
    color: #8bc34a;
    border: 1px solid rgba(139, 195, 74, 0.3);
}

.pattern-signal-badge.HOLD {
    background: rgba(255, 193, 7, 0.15);
    color: #ffc107;
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.pattern-signal-badge.SELL {
    background: rgba(244, 67, 54, 0.15);
    color: #f44336;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

/* VWAP state indicators */
.vwap-state-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.vwap-state-indicator.breakout {
    background: rgba(156, 39, 176, 0.15);
    color: #9c27b0;
    border: 1px solid rgba(156, 39, 176, 0.3);
}

.vwap-state-indicator.bounce {
    background: rgba(33, 150, 243, 0.15);
    color: #2196f3;
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.vwap-state-indicator.consolidation {
    background: rgba(96, 125, 139, 0.15);
    color: #607d8b;
    border: 1px solid rgba(96, 125, 139, 0.3);
}

/* Dark theme pattern integration */
[data-theme="dark"] .pattern-integration-section {
    background: rgba(156, 39, 176, 0.15);
    border-color: #9c27b0;
}

[data-theme="dark"] .filter-group {
    background: var(--surface-color);
    border-color: rgba(156, 39, 176, 0.2);
}

[data-theme="dark"] .stat-card {
    background: rgba(76, 175, 80, 0.15);
    border-color: rgba(76, 175, 80, 0.3);
}

[data-theme="dark"] .pattern-grade-badge {
    background: var(--surface-color);
    border-color: rgba(156, 39, 176, 0.3);
}

/* Responsive design for pattern integration */
@media (max-width: 768px) {
    .pattern-filters {
        grid-template-columns: 1fr;
    }
    
    .pattern-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .pattern-integration-section .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .integration-status {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .pattern-stats {
        grid-template-columns: 1fr;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
}

/* ========================================
   COPY-PASTE CONTEXT MENU STYLING
   ======================================== */

.history-context-menu {
    position: fixed;
    background: var(--surface-color, #2a2a2a);
    border: 1px solid var(--border-color, #404040);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 10000;
    min-width: 220px;
    padding: 6px 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    backdrop-filter: blur(10px);
}

.context-menu-item {
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text-primary, #ffffff);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: background-color 0.2s ease;
    user-select: none;
}

.context-menu-item:hover:not([disabled]) {
    background: var(--primary-color, #4ecdc4);
    color: white;
}

.context-menu-item[disabled] {
    opacity: 0.5;
    cursor: not-allowed;
    color: var(--text-secondary, #888888);
}

.context-menu-separator {
    height: 1px;
    background: var(--border-color, #404040);
    margin: 4px 8px;
}

/* Keyboard shortcut hints */
.historical-controls::after {
    content: "💡 Tip: Select symbols and press Ctrl+C to copy, or right-click for more options";
    display: block;
    font-size: 12px;
    color: var(--text-secondary, #888888);
    margin-top: 8px;
    padding: 8px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 4px;
    border-left: 3px solid var(--primary-color, #4ecdc4);
}

/* =============================================================================
   🦢 SWAN SCORE ANALYSIS STYLES
   ============================================================================= */

/* Swan Score Section Container */
#swanScoreContainer {
    margin: 1.5rem 0;
}

#swanScoreSection {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--surface-color);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

#swanScoreSection:hover {
    box-shadow: var(--shadow-md);
}

/* Swan Score Header */
#swanScoreSection .section-header {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.1), rgba(255, 193, 7, 0.05));
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#swanScoreSection .section-header:hover {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.15), rgba(255, 193, 7, 0.08));
}

#swanScoreSection .section-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Swan Score Badge */
.swan-score-badge {
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.swan-score-badge.loading {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

/* Swan Score Classes */
.swan-score-excellent {
    background: rgba(0, 255, 136, 0.2);
    border: 1px solid #00ff88;
    color: #00cc66;
}

.swan-score-very-good {
    background: rgba(34, 255, 102, 0.2);
    border: 1px solid #22ff66;
    color: #1acd55;
}

.swan-score-good {
    background: rgba(136, 255, 0, 0.2);
    border: 1px solid #88ff00;
    color: #77dd00;
}

.swan-score-fair {
    background: rgba(170, 221, 0, 0.2);
    border: 1px solid #aadd00;
    color: #99bb00;
}

.swan-score-poor {
    background: rgba(255, 119, 0, 0.2);
    border: 1px solid #ff7700;
    color: #dd6600;
}

.swan-score-bad {
    background: rgba(255, 51, 0, 0.2);
    border: 1px solid #ff3300;
    color: #dd2200;
}

/* Swan Components Grid */
.swan-components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-bottom: 1rem;
}

.swan-component {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 1rem;
    transition: all 0.3s ease;
}

.swan-component:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

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

.swan-component-header strong {
    color: var(--text-primary);
    font-size: 0.95rem;
}

.swan-component-score {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(var(--primary-color-rgb), 0.1);
    padding: 0.2rem 0.6rem;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* Swan Component Progress Bars */
.swan-component-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.75rem;
}

.swan-component-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.swan-component-description {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Humanity Impact Section */
.swan-humanity-impact {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid var(--border-color);
}

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

.swan-impact-header strong {
    color: var(--text-primary);
    font-size: 1rem;
}

/* Swan Score Actions */
.swan-score-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0.75rem;
    background: var(--background-color);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.swan-score-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.swan-score-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Loading Animation for Swan Score */
@keyframes loading-bar {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0%); }
    100% { transform: translateX(100%); }
}

/* Swan Score Loading State */
.swan-score-loading {
    text-align: center;
    padding: 2rem;
}

.swan-score-loading h4 {
    margin: 0.5rem 0;
    color: var(--text-primary);
}

.swan-score-loading p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.5;
}

/* Philosophy Section */
.swan-score-philosophy {
    margin-bottom: 1rem;
    padding: 0.75rem;
    border-radius: 8px;
    border-left: 4px solid var(--info-color);
    font-size: 0.9rem;
    line-height: 1.4;
}

.swan-score-philosophy strong {
    color: var(--text-primary);
}

.swan-score-philosophy small {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* Responsive Design for Swan Score */
@media (max-width: 768px) {
    .swan-components-grid {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .swan-score-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    
    .swan-score-actions .btn {
        width: 100%;
        text-align: center;
    }
    
    #swanScoreSection .section-header h3 {
        font-size: 1rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

/* Dark Theme Swan Score Adjustments */
[data-theme="dark"] .swan-component {
    background: var(--surface-color);
    border-color: #333333;
}

[data-theme="dark"] .swan-score-actions {
    background: var(--surface-color);
}

[data-theme="dark"] #swanScoreSection .section-header {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.08), rgba(255, 193, 7, 0.03));
}

[data-theme="dark"] #swanScoreSection .section-header:hover {
    background: linear-gradient(135deg, rgba(255, 165, 0, 0.12), rgba(255, 193, 7, 0.05));
}

/* ESG Analysis Components - Specialized Styling */

/* ESG Component Analysis */
.esg-analysis-container {
    display: grid;
    gap: 20px;
    margin-top: 20px;
}

.esg-category-card {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    transition: all 0.3s ease;
}

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

/* Environmental Component */
.environmental-component {
    border-left: 4px solid #4CAF50;
}

.environmental-component .esg-category-icon {
    color: #4CAF50;
}

/* Social Component */
.social-component {
    border-left: 4px solid #2196F3;
}

.social-component .esg-category-icon {
    color: #2196F3;
}

/* Governance Component */
.governance-component {
    border-left: 4px solid #FF9800;
}

.governance-component .esg-category-icon {
    color: #FF9800;
}

/* ESG Category Header */
.esg-category-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 15px;
}

.esg-category-icon {
    font-size: 1.5rem;
}

.esg-category-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
}

.esg-category-score {
    margin-left: auto;
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.9rem;
}

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

.esg-metric {
    background: var(--background-color);
    padding: 12px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.esg-metric-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.esg-metric-value {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-primary);
}

.esg-metric-trend {
    font-size: 0.8rem;
    margin-top: 2px;
}

.trend-positive {
    color: #4CAF50;
}

.trend-negative {
    color: #F44336;
}

.trend-neutral {
    color: var(--text-secondary);
}

/* ESG Progress Indicators */
.esg-progress-section {
    margin-bottom: 20px;
}

.esg-progress-title {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.esg-progress-score {
    font-weight: bold;
    color: var(--text-primary);
}

.esg-progress-bar {
    width: 100%;
    height: 10px;
    background: var(--border-color);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.esg-progress-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.6s ease, background 0.3s ease;
    position: relative;
}

/* ESG Score Color Coding */
.esg-score-excellent {
    background: linear-gradient(90deg, #4CAF50, #45a049);
}

.esg-score-good {
    background: linear-gradient(90deg, #8BC34A, #7CB342);
}

.esg-score-average {
    background: linear-gradient(90deg, #FFC107, #FFB300);
}

.esg-score-poor {
    background: linear-gradient(90deg, #FF9800, #F57C00);
}

.esg-score-critical {
    background: linear-gradient(90deg, #F44336, #D32F2F);
}

/* Data Source Indicators */
.esg-data-sources {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.data-source-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.data-source-badge.epa {
    border-color: #4CAF50;
    color: #4CAF50;
}

.data-source-badge.yahoo {
    border-color: #6A0DAD;
    color: #6A0DAD;
}

.data-source-badge.worldbank {
    border-color: #0073E6;
    color: #0073E6;
}

.data-source-badge.community {
    border-color: #FF9800;
    color: #FF9800;
}

/* ESG Timeline */
.esg-timeline {
    margin-top: 20px;
}

.esg-timeline-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
    padding: 10px;
    background: var(--background-color);
    border-radius: 6px;
    border-left: 3px solid var(--accent-color);
}

.esg-timeline-date {
    font-size: 0.8rem;
    color: var(--text-secondary);
    min-width: 80px;
}

.esg-timeline-content {
    flex: 1;
}

.esg-timeline-title {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.esg-timeline-description {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

/* Community Input Section */
.community-input-section {
    background: var(--background-color);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 15px;
    margin-top: 20px;
}

.community-input-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.community-input-title {
    font-weight: bold;
    color: var(--text-primary);
}

.community-score {
    margin-left: auto;
    background: var(--primary-color);
    color: white;
    padding: 2px 8px;
    border-radius: 8px;
    font-size: 0.8rem;
}

.community-feedback {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 15px;
}

.feedback-item {
    text-align: center;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.feedback-item:hover {
    background: var(--surface-color);
}

.feedback-item.selected {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.feedback-icon {
    font-size: 1.2rem;
    display: block;
    margin-bottom: 4px;
}

.feedback-label {
    font-size: 0.8rem;
}

/* ESG Comparison Chart */
.esg-comparison {
    margin-top: 20px;
    padding: 15px;
    background: var(--background-color);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.comparison-header {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 15px;
    text-align: center;
}

.comparison-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.comparison-item {
    text-align: center;
}

.comparison-symbol {
    font-weight: bold;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.comparison-bar {
    width: 100%;
    height: 80px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 8px;
}

.comparison-fill {
    width: 100%;
    bottom: 0;
    position: absolute;
    border-radius: 4px;
    transition: height 0.6s ease;
}

.comparison-score {
    font-weight: bold;
    color: var(--text-primary);
}

/* ESG Alert System */
.esg-alert {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.esg-alert.warning {
    background: rgba(255, 193, 7, 0.1);
    border: 1px solid #FFC107;
    color: #F57C00;
}

.esg-alert.success {
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid #4CAF50;
    color: #388E3C;
}

.esg-alert.info {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid #2196F3;
    color: #1976D2;
}

.esg-alert-icon {
    font-size: 1.2rem;
}

.esg-alert-content {
    flex: 1;
    font-size: 0.9rem;
    line-height: 1.4;
}

/* ESG Responsive Design Extensions */
@media (max-width: 768px) {
    .esg-metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .comparison-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .community-feedback {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .esg-category-header {
        flex-wrap: wrap;
        gap: 8px;
    }
    
    .esg-category-score {
        margin-left: 0;
        margin-top: 5px;
    }
}
