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

/* Priority keyword highlighting */
.priority-keyword {
    background-color: #fff3cd;
    color: #856404;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
    border: 1px solid #ffeaa7;
}

body {
    font-family: 'Poppins', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary, #333);
    background-color: var(--bg-primary, #f8f9fa);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* CSS Variables for Theme Support */
:root {
    /* Light Theme (Default) */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f4;
    --text-primary: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --accent-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --chart-grid-color: rgba(0, 0, 0, 0.1);
    --chart-bg: #ffffff;
}

/* Dark Theme - Enhanced */
[data-theme="dark"] {
    --bg-primary: #0f1419; /* Deep dark blue-gray */
    --bg-secondary: #1a2332; /* Slightly lighter blue-gray */
    --bg-tertiary: #243447; /* Medium blue-gray for hover states */
    --bg-quaternary: #2d4155; /* Lighter for active states */
    --text-primary: #e8f4f8; /* Soft white with blue tint */
    --text-secondary: #b8c5d1; /* Light gray-blue */
    --text-muted: #8193a4; /* Medium gray-blue */
    --border-color: #3d4f63; /* Subtle blue-gray border */
    --border-light: #2a3b4d; /* Lighter border variant */
    --shadow-color: rgba(0, 0, 0, 0.6); /* Deeper shadows */
    --shadow-light: rgba(0, 0, 0, 0.3); /* Lighter shadows */
    --accent-color: #00d4ff; /* Bright cyan */
    --accent-hover: #00c4ef; /* Darker cyan for hover */
    --accent-light: rgba(0, 212, 255, 0.1); /* Light cyan background */
    --success-color: #00e676; /* Bright green */
    --success-light: rgba(0, 230, 118, 0.1); /* Light green background */
    --warning-color: #ffb74d; /* Warm orange */
    --warning-light: rgba(255, 183, 77, 0.1); /* Light orange background */
    --danger-color: #ff5252; /* Bright red */
    --danger-light: rgba(255, 82, 82, 0.1); /* Light red background */
    --info-color: #42a5f5; /* Blue */
    --info-light: rgba(66, 165, 245, 0.1); /* Light blue background */
    --chart-grid-color: rgba(184, 197, 209, 0.15); /* Subtle grid lines */
    --chart-bg: #1a2332; /* Chart background */
    --gradient-primary: linear-gradient(135deg, #0f1419 0%, #1a2332 50%, #243447 100%);
    --gradient-accent: linear-gradient(135deg, #00d4ff 0%, #0099cc 100%);
    --glow-accent: 0 0 20px rgba(0, 212, 255, 0.3); /* Subtle glow effect */
}

/* Apply enhanced theme variables to existing elements */
.main-container {
    background: var(--gradient-primary);
    color: var(--text-primary);
    min-height: 100vh;
}

.vertical-tabs {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    box-shadow: 2px 0 10px var(--shadow-light);
    backdrop-filter: blur(10px);
}

.vertical-tabs a {
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-light);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.vertical-tabs a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--gradient-accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.vertical-tabs a.active::before,
.vertical-tabs a:hover::before {
    transform: scaleY(1);
}

.vertical-tabs a.active,
.vertical-tabs a:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: translateX(2px);
}

.vertical-tabs a.active {
    background: var(--bg-quaternary);
    box-shadow: inset 0 0 20px var(--accent-light);
}

.horizontal-tabs ul {
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 10px var(--shadow-light);
}

.horizontal-tabs .h-tab {
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
    position: relative;
}

.horizontal-tabs .h-tab::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.horizontal-tabs .h-tab.active::after {
    transform: scaleX(1);
}

.horizontal-tabs .h-tab.active {
    color: var(--accent-color);
    text-shadow: 0 0 10px var(--accent-light);
}

.horizontal-tabs .h-tab:hover {
    color: var(--text-primary);
    background: var(--bg-tertiary);
}

.subtab-content {
    background: var(--bg-primary);
    border-radius: 12px 12px 0 0;
    box-shadow: 0 -2px 20px var(--shadow-light);
}

/* Enhanced Input and select elements */
input, select, textarea {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    transition: all 0.3s ease !important;
}

input:focus, select:focus, textarea:focus {
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px var(--accent-light), var(--glow-accent) !important;
    background: var(--bg-tertiary) !important;
}

input:hover, select:hover, textarea:hover {
    border-color: var(--text-muted) !important;
    background: var(--bg-tertiary) !important;
}

/* Enhanced Button theming */
.btn {
    background: var(--bg-secondary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color) !important;
    border-radius: 8px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    position: relative !important;
    overflow: hidden !important;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: var(--gradient-accent) !important;
    color: white !important;
    border: 1px solid var(--accent-color) !important;
    box-shadow: var(--glow-accent) !important;
    font-weight: 600 !important;
}

.btn:hover:not(:disabled) {
    background: var(--bg-tertiary) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 15px var(--shadow-color) !important;
}

.btn-primary:hover:not(:disabled) {
    background: var(--gradient-accent) !important;
    filter: brightness(1.2) !important;
    transform: translateY(-2px) !important;
    box-shadow: var(--glow-accent), 0 4px 20px rgba(0, 212, 255, 0.4) !important;
}

.btn:active {
    transform: translateY(0) !important;
}

/* Enhanced Card and container theming */
.card, .panel, .section {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    box-shadow: 0 4px 20px var(--shadow-light) !important;
    backdrop-filter: blur(10px) !important;
    transition: all 0.3s ease !important;
}

.card:hover, .panel:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 30px var(--shadow-color) !important;
    border-color: var(--accent-color) !important;
}

/* Paper Trading Tab Styles */
.paper-trade-tabs-container {
    margin-bottom: 20px;
}

.refresh-timer {
    float: right;
    font-size: 0.85em;
    color: #00ff41;
    font-weight: normal;
    padding: 2px 8px;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 4px;
    margin-left: 10px;
}

.paper-trade-tabs {
    display: flex;
    align-items: center;
    background-color: #f0f0f0;
    border-radius: 8px 8px 0 0;
    padding: 5px 5px 0 5px;
    overflow-x: auto;
    max-width: 100%;
}

.paper-trade-tabs ul {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    flex-grow: 1;
}

.paper-trade-tab {
    display: flex;
    align-items: center;
    background-color: #e0e0e0;
    border: 1px solid #ccc;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    margin-right: 2px;
    padding: 8px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
    max-width: 200px;
}

.paper-trade-tab:hover {
    background-color: #d5d5d5;
}

.paper-trade-tab.active {
    background-color: white;
    border-color: #007bff;
    z-index: 2;
}

.paper-trade-tab .tab-name {
    flex-grow: 1;
    margin-right: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 14px;
}

.paper-trade-tab .close-tab-btn {
    background: none;
    border: none;
    color: #666;
    font-size: 18px;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.2s ease;
    flex-shrink: 0;
}

.paper-trade-tab .close-tab-btn:hover {
    color: #dc3545;
    font-weight: bold;
}

.add-tab-btn {
    background-color: transparent;
    border: 1px solid #ccc;
    border-radius: 6px;
    padding: 6px 12px;
    margin-left: 5px;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.add-tab-btn:hover {
    background-color: #007bff;
    color: white;
    border-color: #007bff;
}

.paper-trade-content {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 0 0 8px 8px;
    padding: 20px;
    min-height: 400px;
}

.algo-content {
    display: none;
}

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

.tab-name-input {
    background: white;
    border: 1px solid #007bff;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-right: 8px;
}

/* Paper Trade Controls */
.paper-trade-controls {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 20px;
}

.stock-search-container {
    position: relative;
    margin-bottom: 15px;
}

.stock-search-input {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    transition: border-color 0.3s ease;
}

.stock-search-input:focus {
    border-color: #007bff;
}

.stock-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
}

.stock-suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
}

.suggestion-symbol {
    font-weight: bold;
    color: #007bff;
    font-size: 14px;
    display: block;
    margin-bottom: 2px;
}

.suggestion-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.suggestion-name {
    color: #333;
    font-size: 12px;
    flex: 1;
    margin-right: 10px;
}

.suggestion-type {
    color: #666;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

.stock-suggestion-item:hover {
    background-color: #f8f9fa;
}

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

.suggestion-symbol {
    font-weight: bold;
    color: #007bff;
}

.suggestion-name {
    color: #666;
    font-size: 14px;
    margin-left: 10px;
}

.selected-stock-info {
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.stock-details {
    display: flex;
    align-items: center;
    gap: 15px;
    flex: 1;
}

.stock-symbol {
    font-weight: bold;
    color: #007bff;
    font-size: 16px;
}

.stock-name {
    color: #666;
    font-size: 14px;
}

.stock-ltp {
    font-weight: bold;
    color: #28a745;
    padding: 4px 8px;
    background: #d4edda;
    border-radius: 4px;
}

.trade-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.quantity-input {
    width: 80px;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    text-align: center;
    font-size: 14px;
}

.total-value-display {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 4px;
    border: 1px solid #e0e0e0;
}

.total-value-label {
    font-size: 13px;
    color: #666;
    font-weight: 500;
}

.total-value {
    font-size: 14px;
    font-weight: bold;
    color: #00ff41;
    min-width: 80px;
    text-align: right;
}

.trade-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 60px;
}

.buy-btn {
    background: #28a745;
    color: white;
}

.buy-btn:hover {
    background: #218838;
}

.sell-btn {
    background: #dc3545;
    color: white;
}

.sell-btn:hover {
    background: #c82333;
}

.positions-container {
    margin-top: 20px;
}

.positions-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.positions-table th,
.positions-table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.positions-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.positions-table .positive {
    color: #28a745;
    font-weight: bold;
}

.positions-table .negative {
    color: #dc3545;
    font-weight: bold;
}

.position-actions {
    display: flex;
    gap: 5px;
}

.position-btn {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    font-weight: bold;
}

.position-buy-btn {
    background: #28a745;
    color: white;
}

.position-sell-btn {
    background: #dc3545;
    color: white;
}

/* Toggle button styles */
.tab-collapse-toggle {
    display: block;
}

.tab-collapse-toggle button {
    background: #34495e;
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tab-collapse-toggle button:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

/* Main container layout */
.main-container {
    display: flex;
    min-height: calc(100vh - 150px); /* Account for header and footer */
}

/* Vertical tabs navigation */
.vertical-tabs {
    width: 250px;
    background-color: #34495e;
    color: white;
    height: 100%;
    transition: all 0.3s ease;
    overflow-y: auto;
    border-right: 1px solid #2c3e50;
    position: relative;
    z-index: 100;
}

.vertical-tabs.collapsed {
    width: 60px;
}

/* Hide scrollbar but allow scrolling */
.vertical-tabs::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* Handle backdrop for mobile */
.sidebar-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 90;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tabs-header {
    padding: 0.7rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background-color: #2c3e50;
    display: flex;
    justify-content: center;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.vertical-tabs.collapsed .tabs-header {
    padding: 0.7rem;
}

.vertical-tabs ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.vertical-tabs ul li {
    margin: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.vertical-tabs ul li a {
    color: #ecf0f1;
    text-decoration: none;
    padding: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-icon {
    margin-right: 10px;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}

.vertical-tabs.collapsed .tab-icon {
    margin-right: 0;
}

.tab-text {
    transition: opacity 0.3s ease, width 0.3s ease;
}

.vertical-tabs.collapsed ul li a span:not(.tab-icon) {
    opacity: 0;
    width: 0;
    position: absolute;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.vertical-tabs ul li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: #3498db;
}

.vertical-tabs ul li a.active {
    background-color: rgba(52, 152, 219, 0.2);
    color: #3498db;
    border-left: 4px solid #3498db;
}

/* Main content */
main {
    flex: 1;
    padding: 1.5rem 2rem;
    overflow-y: auto;
    max-width: 100%;
}

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

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

/* Horizontal Tabs */
.horizontal-tabs {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e6e6e6;
}

.horizontal-tabs ul {
    display: flex;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}

.horizontal-tabs ul li {
    margin-right: 0.5rem;
}

.horizontal-tabs ul li a {
    display: block;
    padding: 0.7rem 1rem;
    color: #555;
    text-decoration: none;
    border-radius: 5px 5px 0 0;
    border: 1px solid transparent;
    font-weight: 500;
    transition: all 0.3s ease;
}

.horizontal-tabs ul li a:hover {
    color: #3498db;
    background-color: rgba(52, 152, 219, 0.05);
}

.horizontal-tabs ul li a.active {
    color: #3498db;
    border: 1px solid #e6e6e6;
    border-bottom: 2px solid white;
    margin-bottom: -1px;
    background-color: white;
}

/* Subtab Content */
.subtab-content {
    display: none;
}

.subtab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Horizontal Tabs */
@media screen and (max-width: 768px) {
    .horizontal-tabs ul li {
        margin-right: 0.2rem;
    }
    
    .horizontal-tabs ul li a {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}

@media screen and (max-width: 480px) {
    .horizontal-tabs {
        overflow-x: auto;
        white-space: nowrap;
        padding-bottom: 0.5rem;
    }
    
    .horizontal-tabs ul {
        flex-wrap: nowrap;
        width: auto;
    }
}


/* Responsive Styles */
@media screen and (max-width: 1024px) {
    main {
        padding: 1.2rem;
    }
}

@media screen and (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .vertical-tabs {
        position: fixed;
        top: 0;
        left: 0;
        width: 250px;
        height: 100vh;
        border-right: none;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        z-index: 1000;
        max-height: 100vh;
    }
    
    .vertical-tabs.expanded {
        transform: translateX(0);
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
    }
    
    /* Don't collapse width on mobile, just slide out */    
    .vertical-tabs.collapsed {
        width: 250px;
        transform: translateX(-100%);
    }
    
    .vertical-tabs ul {
        display: flex;
        flex-direction: column;
        padding-top: 60px; /* Space for the fixed header */
    }
    
    .vertical-tabs ul li {
        margin: 0;
    }
    
    /* Show the hamburger menu button on mobile */
    .tab-collapse-toggle {
        display: block !important;
        position: fixed;
        top: 10px;
        left: 10px;
        z-index: 1010;
    }
    
    .tab-collapse-toggle button {
        font-size: 1.4rem;
        width: 50px;
        height: 50px;
        display: flex !important;
        align-items: center;
        justify-content: center;
        background-color: #2c3e50;
        color: white;
        border: 1px solid rgba(255,255,255,0.2);
        border-radius: 4px;
        box-shadow: 0 2px 5px rgba(0,0,0,0.2);
        cursor: pointer;
    }
    
    .vertical-tabs.expanded .tab-collapse-toggle button {
        position: absolute;
    }
    
    /* Show backdrop when sidebar is expanded */
    .sidebar-backdrop.active {
        display: block;
        opacity: 1;
    }
    
    .tabs-header {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        padding: 0.8rem;
        background-color: #2c3e50;
        z-index: 1000;
    }
    
    .tabs-header h3 {
        font-size: 1rem;
    }
    
    /* Adjust main content for fixed header and hamburger button */
    main {
        margin-top: 70px;
        padding-top: 0;
        width: 100%;
        margin-left: 0;
    }
    
    .filter-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-controls button {
        margin-top: 0.5rem;
    }
}

@media screen and (max-width: 480px) {
    section {
        padding: 1rem;
    }
    
    .vertical-tabs ul li a {
        padding: 0.8rem;
    }
    
    .settings-container {
        padding: 0;
    }
    
    .button-group {
        flex-direction: column;
    }
    
    .button-group button {
        width: 100%;
    }
}

section {
    margin-bottom: 2.5rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 1.5rem;
}

section h2 {
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    color: #2c3e50;
}

/* Basic layout containers */
.card-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

/* Colors and indicators - keeping these as they might be used elsewhere */
.positive {
    color: #27ae60;
}

.negative {
    color: #e74c3c;
}

.neutral {
    color: #f39c12;
}

.prediction {
    font-weight: 600;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1.5rem;
    width: 100%;
    margin-top: auto;
}

/* Loading state */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
}

.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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


/* Placeholder Styles */
.placeholder {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 4rem 2rem;
    text-align: center;
    border: 2px dashed #ccc;
    margin: 2rem 0;
}

.placeholder h2 {
    margin-bottom: 1.5rem;
    color: #2c3e50;
    border-bottom: none;
}

.placeholder-content {
    color: #7f8c8d;
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
}

/* Live Market Dashboard Styles */
.live-market-dashboard, .live-stocks-movements {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.market-overview-section, .stocks-movements-section {
    margin-bottom: 0;
    height: calc(100vh - 100px); /* Set fixed height to viewport height minus header/footer space */
    max-height: calc(100vh - 100px);
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent section from scrolling */
}

.card {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    flex: 1; /* Take up all available height */
    display: flex;
    flex-direction: column;
}

.card-header {
    background-color: #f8f9fa;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2, .card-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.last-updated {
    font-size: 0.85rem;
    color: #7f8c8d;
}

.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    flex: 1; /* Take up all available height */
    overflow: hidden; /* Prevent scrolling inside the card */
}

@media (min-width: 992px) {
    .card-body {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

/* Ensure card-body stacks on mobile */
@media (max-width: 991px) {
    .card-body {
        flex-direction: column;
        overflow: visible; /* Allow scrolling on mobile */
    }
}

.chart-container {
    height: 100%;
    max-height: calc(100vh - 150px); /* Limit to viewport height minus header space */
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

.chart-container canvas {
    flex: 1;
    height: auto !important;
    min-height: 300px;
}

.pie-chart-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    position: relative;
}

/* Market Sentiment Bar Styles */
.market-sentiment-bar {
    margin-bottom: 1rem;
    padding: 0.5rem 0;
}

.sentiment-bar-container {
    width: 100%;
}

.sentiment-label {
    font-size: 0.85rem;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.sentiment-progress-container {
    width: 100%;
}

.sentiment-progress-bar {
    width: 100%;
    height: 6px;
    background-color: #f1f1f1;
    border-radius: 3px;
    display: flex;
    overflow: hidden;
}

.sentiment-positive, .strength-positive {
    height: 100%;
    background-color: #27ae60;
    transition: width 0.5s ease;
}

.sentiment-negative, .strength-negative {
    height: 100%;
    background-color: #e74c3c;
    transition: width 0.5s ease;
}

.sentiment-stats {
    font-size: 0.75rem;
    color: #7f8c8d;
    margin-top: 0.3rem;
    text-align: right;
}

.sentiment-stats .positive-count {
    color: #27ae60;
    font-weight: 600;
}

.sentiment-stats .total-count {
    font-weight: 600;
}

.sentiment-stats .net-change {
    font-weight: 600;
}

.chart-legend {
    max-height: 100px;
    overflow-y: auto;
    padding-right: 0.5rem;
    width: 100%;
}

.chart-legend-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    margin-right: 0.75rem;
    padding: 0.4rem;
    border-radius: 4px;
    transition: background-color 0.2s ease;
    flex: 0 0 auto;
    max-width: 140px;
}

.legend-item:hover {
    background-color: #f8f9fa;
}

.color-box {
    width: 16px;
    height: 16px;
    border-radius: 3px;
    margin-right: 10px;
}

.legend-label {
    flex: 1;
    font-size: 0.9rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.legend-value {
    font-weight: 600;
    font-size: 0.9rem;
    color: #2c3e50;
    margin-left: 0.5rem;
}

@media (max-width: 768px) {
    .chart-container {
        height: 250px;
    }
    
    .card-body {
        flex-direction: column;
    }
    
    .chart-legend {
        flex: none;
        max-height: none;
    }
}

/* Error Messages */
.connection-error,
.empty-data-message {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: 100%;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.connection-error h3,
.empty-data-message h3 {
    color: #e74c3c;
    margin-bottom: 1rem;
}

.empty-data-message h3 {
    color: #3498db;
}

.connection-error p,
.empty-data-message p {
    color: #7f8c8d;
    margin-bottom: 1rem;
    max-width: 400px;
}

.retry-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    margin-top: 1rem;
    transition: background-color 0.2s ease;
}

.retry-button:hover {
    background-color: #2980b9;
}

.loading-spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    margin-bottom: 1rem;
    animation: spin 1s linear infinite;
}

/* Indices Table Styles */
.indices-table-container {
    width: 100%;
    flex: 1;
}

.indices-table-container h3 {
    margin-bottom: 0.5rem;
    color: #2c3e50;
    font-size: 1.1rem;
    font-weight: 600;
}

.table-responsive {
    overflow-y: auto;
    max-height: calc(100vh - 150px); /* Limit to viewport height minus header space */
    height: 100%;
    width: 100%;
}

.indices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.05);
    border-radius: 4px;
    table-layout: auto; /* Changed to auto for better content fitting */
    min-width: 100%; /* Ensure table takes full width of container */
}

.indices-table thead {
    position: sticky;
    top: 0;
    z-index: 10;
    background-color: #f8f9fa;
}

.indices-table th,
.indices-table td {
    padding: 0.8rem;
    text-align: left;
    border-bottom: 1px solid #eee;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.indices-table th {
    font-weight: 600;
    color: #2c3e50;
}

/* First column (Index) */
.indices-table th:nth-child(1),
.indices-table td:nth-child(1) {
    width: 40%;
    max-width: 150px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Second column (Current) */
.indices-table th:nth-child(2),
.indices-table td:nth-child(2) {
    width: 30%;
    min-width: 75px;
    text-align: right;
    white-space: nowrap;
}

/* Third column (Change) */
.indices-table th:nth-child(3),
.indices-table td:nth-child(3) {
    width: 30%;
    min-width: 65px;
    text-align: right;
    white-space: nowrap;
}

.indices-table tr:hover {
    background-color: #f8f9fa;
}

.indices-table tr:last-child td {
    border-bottom: none;
}

.indices-table .loading-data,
.indices-table .error-data,
.indices-table .empty-data {
    text-align: center;
    padding: 2rem 1rem;
    color: #7f8c8d;
    font-style: italic;
}

.indices-table .error-data {
    color: #e74c3c;
}

/* Mobile responsiveness for Sector Watch section */
@media screen and (max-width: 768px) {
    /* Stack chart and table vertically on mobile */
    .card-header-with-timestamp {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 1rem;
    }

    .card-header-with-timestamp .section-title {
        font-size: 1.25rem;
    }

    .last-updated-container {
        gap: 0.5rem;
        font-size: 0.75rem;
    }

    .live-indicator-main {
        font-size: 0.75rem;
    }

    .last-updated-text {
        font-size: 0.75rem;
    }

    .market-overview-section {
        height: auto !important;
        max-height: none !important;
    }

    .market-overview-section .card-body {
        flex-direction: column !important;
        padding: 1rem;
        gap: 1rem;
    }

    .chart-side, .table-side {
        width: 100% !important;
        max-width: 100% !important;
        padding: 0 !important;
        margin-bottom: 0 !important;
        min-height: auto;
    }

    .chart-side {
        order: 1;
        margin-bottom: 1.5rem;
    }

    .table-side {
        order: 2;
    }

    .pie-chart-wrapper {
        height: 300px !important;
        min-height: 300px !important;
    }

    .market-sentiment-bar {
        margin-bottom: 1rem;
    }
    
    /* Make table responsive with horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -0.5rem;
        padding: 0 0.5rem;
        max-width: calc(100vw - 2rem);
    }
    
    /* Adjust table for mobile */
    .indices-table {
        font-size: 0.85rem;
        min-width: 320px; /* Minimum width to ensure readability */
        table-layout: fixed; /* Fixed layout for predictable column widths */
    }
    
    .indices-table th,
    .indices-table td {
        padding: 0.6rem 0.4rem;
    }
    
    /* Optimize column widths for mobile */
    .indices-table td:first-child,
    .indices-table th:first-child {
        width: 35%; /* Further reduce index column width */
        max-width: 120px;
        font-size: 0.8rem;
        padding-right: 0.3rem;
    }
    
    .indices-table td:nth-child(2),
    .indices-table th:nth-child(2) {
        width: 35%; /* Current value column */
        padding-left: 0.3rem;
        padding-right: 0.3rem;
        min-width: 70px;
    }
    
    .indices-table td:nth-child(3),
    .indices-table th:nth-child(3) {
        width: 30%; /* Change column */
        padding-left: 0.3rem;
        min-width: 60px;
    }
    
    /* Adjust donut chart size */
    .pie-chart-wrapper {
        height: 250px;
        margin: 0 auto;
    }
    
    /* Adjust sentiment bars */
    .market-sentiment-bar {
        margin-bottom: 1rem;
    }
    
    .sentiment-bar-container {
        margin-bottom: 0.75rem;
    }
    
    .sentiment-label {
        font-size: 0.85rem;
    }
    
    .sentiment-stats {
        font-size: 0.85rem;
    }
}

@media screen and (max-width: 480px) {
    /* Very small screens */
    .market-overview-section {
        height: auto !important;
        max-height: none !important;
        overflow: visible !important;
    }
    
    .chart-side {
        margin-bottom: 1rem;
    }
    
    /* Further reduce chart size */
    .pie-chart-wrapper {
        height: 200px;
    }
    
    /* Adjust table font */
    .indices-table {
        font-size: 0.75rem;
        min-width: 300px; /* Slightly smaller minimum width */
    }
    
    .indices-table th,
    .indices-table td {
        padding: 0.4rem 0.3rem;
    }
    
    /* Further optimize columns for very small screens */
    .indices-table td:first-child,
    .indices-table th:first-child {
        width: 30%; /* Much smaller index column */
        max-width: 100px;
        font-size: 0.75rem;
    }
    
    .indices-table td:nth-child(2),
    .indices-table th:nth-child(2) {
        width: 38%; /* More space for current value */
        font-size: 0.75rem;
        min-width: 65px;
    }
    
    .indices-table td:nth-child(3),
    .indices-table th:nth-child(3) {
        width: 32%; /* More space for change value */
        font-size: 0.75rem;
        min-width: 55px;
    }
    
    /* Adjust constituent header */
    .constituent-title {
        font-size: 0.9rem;
        padding: 0.6rem !important;
        white-space: normal !important; /* Allow wrapping on very small screens */
    }
    
    .live-indicator {
        font-size: 0.7rem;
    }
}

/* Constituent table styles */
.constituent-header {
    background-color: #f1f8ff;
}

.constituent-title {
    font-weight: 600;
    padding: 0.8rem !important; 
    color: #3498db !important;
    text-align: center !important;
    border-bottom: 2px solid #3498db !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 8px !important;
    width: 100% !important;
    overflow: hidden !important; 
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.live-indicator {
    color: #27ae60;
    font-size: 0.75rem;
    background-color: rgba(39, 174, 96, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    animation: pulse 1.5s infinite;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.stock-link {
    color: #2980b9;
    text-decoration: none;
    position: relative;
    font-weight: 500;
}

.stock-link:hover {
    color: #3498db;
    text-decoration: underline;
}

.stock-link:after {
    content: '↗';
    font-size: 0.8em;
    position: relative;
    top: -0.3em;
    margin-left: 2px;
    opacity: 0.7;
}

/* Chart and table sides */
.chart-side, .table-side {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.chart-side {
    width: 48%;
    flex: 1;
}

.table-side {
    width: 48%;
    flex: 1;
}

/* Adjust card body layout for different screens */
@media (min-width: 993px) {
    /* Desktop layout */
    .card-body {
        display: flex;
        justify-content: space-between;
        align-items: stretch; /* Changed from flex-start to stretch */
        height: 100%;
    }
    
    .chart-container {
        max-height: calc(100vh - 150px); /* Limit height on desktop */
    }
    
    .chart-legend {
        padding-top: 10px;
        max-height: none;
        order: 2;
    }
    
    .table-responsive {
        max-height: calc(100vh - 150px); /* Limit height on desktop */
    }
}

@media (max-width: 992px) {
    /* Mobile and tablet layout */
    .card-body {
        flex-direction: column;
        height: 100%;
        overflow-y: auto; /* Enable scrolling for the card body on mobile */
    }
    
    .chart-side, .table-side {
        width: 100%;
        flex: none; /* Don't flex grow on mobile */
    }
    
    .chart-side {
        height: 45vh; /* Take approximately half of the viewport height */
        max-height: 45vh;
        margin-bottom: 1rem;
    }
    
    .table-side {
        height: 45vh; /* Take approximately half of the viewport height */
        max-height: 45vh;
    }
    
    .chart-container {
        height: 100%;
        max-height: 45vh;
    }
    
    .table-responsive {
        height: 100%;
        max-height: 45vh;
        width: 100%;
    }
}

/* NSE Heatmap Styles */
.nse-heatmap-fullscreen {
    width: 98%;
    height: calc(100vh - 150px);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    max-width: 98vw;
    margin: 0 auto;
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background-color: #34495e;
    color: white;
    z-index: 10;
}

.heatmap-header h3 {
    margin: 0;
    font-size: 16px;
}

.last-update {
    color: #bdc3c7;
    font-size: 12px;
}

.fullscreen-heatmap-container {
    flex: 1;
    overflow: hidden;
    position: relative;
    background-color: #2c3e50; /* Match the grid background color */
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    max-width: 99%; /* Slightly reduce max width to ensure no overflow */
    padding: 0;
    margin: 0 auto; /* Center horizontally */
}

.fullscreen-heatmap-grid {
    display: grid;
    gap: 0; /* Remove gaps between tiles for seamless look */
    width: 100%;
    height: auto; /* Let height be determined by the grid template rows */
    background-color: #2c3e50;
    padding-bottom: 40px; /* Add padding at the bottom to prevent stocks from being covered by legend */
    overflow: hidden; /* Prevent all scrolling */
    max-width: 99%; /* Slightly reduce width to ensure all tiles fit */
    box-sizing: border-box;
    margin: 0 auto; /* Center the grid horizontally */
}

.floating-legend {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px;
    background-color: rgba(52, 73, 94, 0.9);
    z-index: 10;
    height: 36px;
    overflow: hidden;
}

.legend-group {
    display: flex;
    align-items: center;
    padding: 0 5px;
}

.legend-group.negative {
    border-right: 1px solid rgba(255, 255, 255, 0.3);
}

.legend-group.positive {
    border-left: 1px solid rgba(255, 255, 255, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 10px;
    color: white;
    white-space: nowrap;
    margin: 0 2px;
}

.legend-item.neutral {
    margin: 0 5px;
}

.legend-color {
    width: 8px;
    height: 8px;
    margin-right: 2px;
    border-radius: 2px;
}

.legend-divider {
    width: 1px;
    height: 20px;
    background-color: rgba(255, 255, 255, 0.3);
    margin: 0 5px;
}

.heatmap-tile-link {
    display: block;
    text-decoration: none;
    position: relative;
    z-index: 1;
}

.heatmap-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 3px 0;
    overflow: hidden;
    font-size: 11px;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer; /* Show pointer cursor to indicate clickable */
    height: 44px; /* Moderately increased height */
    width: 100%;
    min-width: 0; /* Prevent content from forcing expansion */
    min-height: 0; /* Prevent content from forcing expansion */
    max-width: 100%; /* Ensure no horizontal overflow */
    box-sizing: border-box;
}

.heatmap-tile:hover, .heatmap-tile-link:hover .heatmap-tile {
    z-index: 5;
    transform: scale(1.05); /* Increased scale for larger tiles */
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
    filter: brightness(1.08);
}

.stock-symbol {
    font-weight: 600;
    font-size: 10px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    color: #2c3e50;
    line-height: 1.2;
}

.heatmap-tile .stock-link {
    text-decoration: none;
    font-weight: 600;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.heatmap-tile .stock-link:hover {
    text-decoration: underline;
    filter: brightness(1.3);
}

.heatmap-tile .stock-link:after {
    content: '↗';
    font-size: 0.8em;
    opacity: 0;
    position: relative;
    top: -0.3em;
    margin-left: 1px;
    transition: opacity 0.2s ease;
}

.heatmap-tile .stock-link:hover:after {
    opacity: 0.8;
}

.stock-change {
    font-size: 10px;
    font-weight: 500;
    width: 100%;
    text-align: center;
    line-height: 1.2;
}

/* Loading and error states */
.loading-data,
.empty-data-message,
.connection-error,
.loading-message,
.retry-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 20;
}

.loading-message {
    background-color: rgba(255, 255, 255, 0.95);
}

.loading-message h3 {
    color: #3498db;
    margin: 15px 0 10px;
    font-size: 18px;
}

.loading-message p {
    color: #7f8c8d;
    margin-bottom: 0;
    font-size: 14px;
}

.loading-message .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.retry-message {
    background-color: rgba(255, 255, 255, 0.95);
    padding: 25px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.retry-message h3 {
    color: #e74c3c;
    margin: 0 0 15px;
    font-size: 18px;
}

.retry-message p {
    color: #7f8c8d;
    margin-bottom: 20px;
    font-size: 14px;
}

.retry-message .retry-button {
    background-color: #3498db;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.retry-message .retry-button:hover {
    background-color: #2980b9;
}

/* Mobile tweaks */
@media (max-width: 768px) {
    .floating-legend {
        position: fixed;
    }
}

/* Live Trades Table Styles */
.positions-stats, .orders-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.stat-card {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
}

.stat-title {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.stat-value.positive {
    color: #27ae60;
}

.stat-value.negative {
    color: #e74c3c;
}

.positions-controls, .orders-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    text-transform: capitalize;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-warning {
    background-color: #f39c12;
    color: white;
}

.btn-warning:hover {
    background-color: #e67e22;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.form-select {
    padding: 0.6rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.9rem;
    background-color: white;
    color: #495057;
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.form-select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.positions-table-container, .orders-table-container {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    margin-top: 1rem;
}

.positions-table, .orders-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
}

.positions-table thead, .orders-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.positions-table th, .orders-table th {
    padding: 1rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.positions-table td, .orders-table td {
    padding: 0.9rem 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    color: #495057;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.positions-table tbody tr, .orders-table tbody tr {
    transition: all 0.2s ease;
}

.positions-table tbody tr:hover, .orders-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.positions-table tbody tr:nth-child(even), .orders-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

/* Portfolio Summary Styles */
.portfolio-summary {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.portfolio-summary h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.summary-card {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    border: 1px solid #e0e0e0;
}

.summary-card .label {
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 5px;
}

.summary-card .value {
    font-size: 1.2rem;
    font-weight: 600;
    color: #333;
}

.summary-card .value.positive {
    color: #16a34a;
}

.summary-card .value.negative {
    color: #dc2626;
}

/* Net Positions Styles */
.net-positions-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.net-positions-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

/* Trades Container Styles */
.trades-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.trades-container h3 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #333;
}

/* Square Off Button */
.square-off-btn {
    background: #f59e0b;
    color: white;
    border: none;
    padding: 5px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: background 0.2s;
}

.square-off-btn:hover {
    background: #d97706;
}

/* Closed Position Row */
.closed-position {
    opacity: 0.6;
    background-color: #f9f9f9;
}

.position-type {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.position-type.long {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.position-type.short {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.status {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

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

.status.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.no-data {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.error-content {
    text-align: center;
    padding: 2rem;
    background-color: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.error-content p {
    margin-bottom: 1rem;
    font-weight: 500;
}

/* Responsive design for live trades tables */
@media (max-width: 1200px) {
    .positions-table, .orders-table {
        font-size: 0.85rem;
    }
    
    .positions-table th, .orders-table th,
    .positions-table td, .orders-table td {
        padding: 0.7rem 0.5rem;
    }
}

@media (max-width: 768px) {
    .positions-stats, .orders-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .stat-card {
        padding: 0.75rem 0.5rem;
    }
    
    .stat-title {
        font-size: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.2rem;
    }
    
    .positions-controls, .orders-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .form-select {
        width: 100%;
    }
    
    .positions-table-container, .orders-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .positions-table, .orders-table {
        min-width: 800px;
        font-size: 0.8rem;
    }
    
    .positions-table th, .orders-table th,
    .positions-table td, .orders-table td {
        padding: 0.6rem 0.4rem;
        white-space: nowrap;
    }
}

/* Historical Data Tab Styles */
.historical {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.controls {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    align-items: flex-end;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 200px;
    flex: 1;
}

.control-group label {
    font-size: 0.9rem;
    margin-bottom: 0.3rem;
    color: #555;
    font-weight: 500;
}

.control-group select {
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
}

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
}

.data-table-container {
    margin-top: 2rem;
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin-top: 1rem;
}

.data-table th, 
.data-table td {
    padding: 0.7rem;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.data-table th {
    background-color: #f8f9fa;
    color: #2c3e50;
    font-weight: 600;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

.chart-container {
    margin-top: 1rem;
    height: 400px;
    width: 100%;
}

#no-data-message {
    color: #7f8c8d;
    text-align: center;
    padding: 2rem;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-style: italic;
}

/* Enhanced Dashboard Section Styles */

/* Corporate Results Styles */
.corporate-results-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.corporate-results-container .section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f3f4;
}

.corporate-results-container .section-header h2 {
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.corporate-results-container .controls {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.corporate-results-container .search-input {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    width: 280px;
    transition: all 0.3s ease;
    background-color: #fdfdfd;
}

.corporate-results-container .search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
    background-color: white;
}

.corporate-results-container .results-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.corporate-results-container .stat-item {
    text-align: center;
    padding: 1rem;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #f1f3f4;
    transition: transform 0.2s ease;
}

.corporate-results-container .stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.corporate-results-container .stat-label {
    display: block;
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 600;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.corporate-results-container .stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: #2c3e50;
    line-height: 1.2;
}

.corporate-results-container .loading-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.corporate-results-container .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.corporate-results-container .error-message {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid #f5c6cb;
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 500;
}

.table-container {
    background-color: white;
    border-radius: 12px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    margin-bottom: 1.5rem;
}

.corporate-results-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
    min-width: 600px; /* Ensure table maintains minimum width for readability */
}

.corporate-results-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.corporate-results-table th {
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.corporate-results-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f3f4;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
}

.corporate-results-table tbody tr {
    transition: all 0.2s ease;
}

.corporate-results-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.corporate-results-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.corporate-results-table .no-data {
    text-align: center;
    color: #6c757d;
    font-style: italic;
    padding: 3rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

/* Corporate Actions Enhanced Styles */
.corporate-actions-section .card,
.corporate-announcements-section .card {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.corporate-actions-section .card h2,
.corporate-announcements-section .card h2 {
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #f1f3f4;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.corporate-actions-controls,
.corporate-announcements-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    gap: 1.5rem;
    flex-wrap: wrap;
    padding: 1.5rem;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.search-filter {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.search-filter input,
.search-filter select {
    padding: 0.75rem 1rem;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 0.9rem;
    background-color: white;
    color: #495057;
    transition: all 0.3s ease;
    min-width: 200px;
}

.search-filter input:focus,
.search-filter select:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.refresh-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

.last-updated {
    font-size: 0.8rem;
    color: #6c757d;
    font-style: italic;
}

/* Enhanced table styles for all dashboard tables */
.actions-table,
.announcements-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
}

.actions-table thead,
.announcements-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.actions-table th,
.announcements-table th {
    padding: 1.2rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border: none;
    position: sticky;
    top: 0;
    z-index: 10;
}

.actions-table td,
.announcements-table td {
    padding: 1rem 0.75rem;
    border-bottom: 1px solid #f1f3f4;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
}

.actions-table tbody tr,
.announcements-table tbody tr {
    transition: all 0.2s ease;
}

.actions-table tbody tr:hover,
.announcements-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.actions-table tbody tr:nth-child(even),
.announcements-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.actions-table .security-name,
.actions-table .company-name {
    font-weight: 600;
    color: #2c3e50;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-table .purpose {
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.actions-table .dividend {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.announcements-table .company-info {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.announcements-table .company-long-name {
    font-weight: 600;
    color: #2c3e50;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.announcements-table .scrip-code {
    font-size: 0.8rem;
    color: #6c757d;
    font-weight: 500;
}

.announcements-table .headline {
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    line-height: 1.4;
}

.announcements-table .category {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #e3f2fd;
    color: #1565c0;
    border: 1px solid #bbdefb;
}

.announcements-table .subcategory {
    padding: 0.3rem 0.6rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background-color: #f3e5f5;
    color: #7b1fa2;
    border: 1px solid #e1bee7;
}

.announcements-table .critical-yes {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.announcements-table .critical-no {
    background-color: #e9ecef;
    color: #6c757d;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.announcements-table .pdf-download {
    font-size: 1.5rem;
    text-decoration: none;
    color: #e67e22;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
}

.announcements-table .pdf-download:hover {
    color: #d35400;
    transform: scale(1.2);
}

.actions-table .no-data,
.announcements-table .no-data {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    font-style: italic;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.actions-table .loading,
.announcements-table .loading {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.actions-table .error,
.announcements-table .error {
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
    border-radius: 8px;
    font-weight: 500;
}

.actions-table .error button,
.announcements-table .error button {
    margin-top: 1rem;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.actions-table .error button:hover,
.announcements-table .error button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

/* Enhanced Sector Watch (Live Market Dashboard) Styles */
.live-market-dashboard {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.market-overview-section {
    margin-bottom: 0;
    height: calc(100vh - 120px);
    max-height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.market-overview-section .card {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: none;
    border: none;
    background: transparent;
}

.card-header-with-timestamp {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e9ecef;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
}

.card-header-with-timestamp .section-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #2c3e50;
}

.last-updated-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.live-indicator-main {
    font-size: 0.85rem;
    font-weight: 600;
    transition: color 0.3s ease;
}

.live-indicator-main.live {
    color: #27ae60;
    animation: pulse-green 2s ease-in-out infinite;
}

.live-indicator-main.stale {
    color: #f39c12;
    animation: pulse-orange 2s ease-in-out infinite;
}

.live-indicator-main.offline {
    color: #e74c3c;
    animation: none;
}

.last-updated-text {
    font-size: 0.85rem;
    color: #6c757d;
    font-weight: 500;
}

.last-updated-text span {
    color: #495057;
    font-weight: 600;
}

@keyframes pulse-green {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

@keyframes pulse-orange {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.market-overview-section .card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: row;
    gap: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

.market-overview-section .card-body::-webkit-scrollbar {
    width: 8px;
}

.market-overview-section .card-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.market-overview-section .card-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.market-overview-section .card-body::-webkit-scrollbar-thumb:hover {
    background: #555;
}

.chart-side {
    width: 60%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: fit-content;
}

.table-side {
    width: 40%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    min-height: fit-content;
}

.market-sentiment-bar {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1rem;
    margin-bottom: 0;
    border: 1px solid #e9ecef;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.sentiment-bar-container {
    margin-bottom: 1.5rem;
}

.sentiment-bar-container:last-child {
    margin-bottom: 0;
}

.sentiment-label {
    font-size: 0.9rem;
    color: #2c3e50;
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sentiment-progress-container {
    width: 100%;
}

.sentiment-progress-bar {
    width: 100%;
    height: 8px;
    background-color: #f1f3f4;
    border-radius: 6px;
    display: flex;
    overflow: hidden;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.sentiment-positive, .strength-positive {
    height: 100%;
    background: linear-gradient(90deg, #27ae60, #2ecc71);
    transition: width 0.6s ease;
    border-radius: 6px 0 0 6px;
}

.sentiment-negative, .strength-negative {
    height: 100%;
    background: linear-gradient(90deg, #e74c3c, #c0392b);
    transition: width 0.6s ease;
    border-radius: 0 6px 6px 0;
}

.sentiment-stats {
    font-size: 0.8rem;
    color: #6c757d;
    margin-top: 0.75rem;
    text-align: right;
    font-weight: 500;
}

.sentiment-stats .positive-count {
    color: #27ae60;
    font-weight: 700;
}

.sentiment-stats .total-count {
    font-weight: 700;
    color: #2c3e50;
}

.sentiment-stats .net-change {
    font-weight: 700;
}

#top-indices-donut-chart {
    flex: 1;
    height: 300px;
    background: white;
    border-radius: 8px;
}

.table-side .table-responsive {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
    height: 100%;
    max-height: 100%;
    overflow-y: auto;
}

.indices-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    margin: 0;
}

.indices-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.indices-table th {
    padding: 1.2rem 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border: none;
}

.indices-table td {
    padding: 1rem;
    border-bottom: 1px solid #f1f3f4;
    color: #495057;
    font-weight: 500;
    transition: all 0.2s ease;
}

.indices-table tbody tr {
    transition: all 0.2s ease;
}

.indices-table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.indices-table tbody tr:nth-child(even) {
    background-color: #fdfdfd;
}

.indices-table tbody tr.positive-row {
    background-color: rgba(39, 174, 96, 0.18);
}

.indices-table tbody tr.positive-row:hover {
    background-color: rgba(39, 174, 96, 0.28);
}

.indices-table tbody tr.negative-row {
    background-color: rgba(231, 76, 60, 0.18);
}

.indices-table tbody tr.negative-row:hover {
    background-color: rgba(231, 76, 60, 0.28);
}

.constituent-header {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%) !important;
}

.constituent-title {
    font-weight: 600;
    padding: 1rem !important;
    color: #1565c0 !important;
    text-align: center !important;
    border-bottom: 2px solid #3498db !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    gap: 10px !important;
    width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
}

.live-indicator {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: white;
    font-size: 0.7rem;
    padding: 4px 8px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    animation: pulse 2s infinite;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

@keyframes pulse {
    0% { opacity: 0.7; transform: scale(1); }
    50% { opacity: 1; transform: scale(1.05); }
    100% { opacity: 0.7; transform: scale(1); }
}

.stock-link {
    color: #2980b9;
    text-decoration: none;
    position: relative;
    font-weight: 600;
    transition: all 0.2s ease;
}

.stock-link:hover {
    color: #3498db;
    text-decoration: underline;
    transform: translateY(-1px);
}

.stock-link:after {
    content: '↗';
    font-size: 0.7em;
    position: relative;
    top: -0.3em;
    margin-left: 3px;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.stock-link:hover:after {
    opacity: 1;
}

/* Enhanced Stocks Movements Section Styles */
.live-stocks-movements {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 110px);
    overflow: hidden;
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid #e9ecef;
}

.dashboard-title-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 50px;
    padding: 0 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    margin-bottom: 0;
    font-weight: 600;
}

.dashboard-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.indicator-wrapper {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    gap: 1rem;
}

.legend-indicator {
    display: inline-flex;
    align-items: center;
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.positive-indicator {
    color: #d4edda;
    border: 1px solid rgba(212, 237, 218, 0.3);
}

.negative-indicator {
    color: #f8d7da;
    border: 1px solid rgba(248, 215, 218, 0.3);
}

.legend-indicator::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.positive-indicator::before {
    background: linear-gradient(135deg, #27ae60, #2ecc71);
}

.negative-indicator::before {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
}

.last-updated {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

.stocks-movements-section {
    height: calc(50% - 25px);
    margin-bottom: 0;
    position: relative;
    padding: 1rem;
}

.stocks-movements-section:last-child {
    margin-bottom: 0;
}

.stocks-movements-section .chart-container {
    height: 100%;
    width: 100%;
    background-color: white;
    border-radius: 8px;
    border: 1px solid #f1f3f4;
    position: relative;
    padding: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.loading-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid rgba(52, 152, 219, 0.2);
    border-radius: 50%;
    border-top-color: #3498db;
    animation: spin 1s ease-in-out infinite;
    z-index: 5;
}

/* Enhanced NSE Heatmap Styles */
.nse-heatmap-fullscreen {
    width: 100%;
    height: calc(100vh - 80px);
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid #e9ecef;
}

.heatmap-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    z-index: 10;
    border-radius: 8px 8px 0 0;
    flex-shrink: 0;
}

.heatmap-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.last-update {
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.3rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    backdrop-filter: blur(5px);
}

.fullscreen-heatmap-container {
    flex: 1;
    overflow: auto;
    position: relative;
    background-color: #f8f9fa;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
}

.fullscreen-heatmap-grid {
    display: grid;
    gap: 1px;
    width: 100%;
    height: auto;
    background-color: #e9ecef;
    border-radius: 6px;
    padding: 0.5rem;
    overflow: visible;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0 auto;
    flex: 1;
    min-height: 0;
}

.floating-legend {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.6rem;
    background: linear-gradient(135deg, rgba(52, 73, 94, 0.95) 0%, rgba(44, 62, 80, 0.95) 100%);
    backdrop-filter: blur(10px);
    z-index: 10;
    height: 45px;
    overflow: hidden;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
    margin-top: auto;
}

.legend-group {
    display: flex;
    align-items: center;
    padding: 0 0.5rem;
    gap: 0.3rem;
}

.legend-group.negative {
    border-right: 2px solid rgba(255, 255, 255, 0.3);
}

.legend-group.positive {
    border-left: 2px solid rgba(255, 255, 255, 0.3);
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 0.75rem;
    color: white;
    white-space: nowrap;
    margin: 0 0.3rem;
    padding: 0.3rem 0.6rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.legend-item.neutral {
    margin: 0 1rem;
    background: rgba(255, 255, 255, 0.15);
}

.legend-color {
    width: 12px;
    height: 12px;
    margin-right: 0.4rem;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.legend-divider {
    width: 2px;
    height: 30px;
    background: linear-gradient(to bottom, transparent 0%, rgba(255, 255, 255, 0.3) 50%, transparent 100%);
    margin: 0 0.75rem;
}

.heatmap-tile-link {
    display: block;
    text-decoration: none;
    position: relative;
    z-index: 1;
    border-radius: 4px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.heatmap-tile-link:hover {
    transform: scale(1.03);
    z-index: 5;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.heatmap-tile {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0.3rem 0.25rem;
    overflow: hidden;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    cursor: pointer;
    height: 46px;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    box-sizing: border-box;
    position: relative;
}

.heatmap-tile:hover {
    z-index: 5;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Responsive adjustments for smaller screens */
@media (max-height: 800px) {
    .nse-heatmap-fullscreen {
        height: calc(100vh - 60px);
    }
    
    .heatmap-header {
        padding: 0.6rem 0.8rem;
    }
    
    .fullscreen-heatmap-container {
        padding: 0.3rem;
    }
    
    .fullscreen-heatmap-grid {
        padding: 0.3rem;
    }
    
    .floating-legend {
        height: 40px;
        padding: 0.4rem;
    }
}

@media (max-width: 1200px) {
    .legend-group {
        padding: 0 0.3rem;
        gap: 0.2rem;
    }
    
    .legend-item {
        font-size: 0.8rem;
    }
}

.stock-symbol {
    font-weight: 700;
    font-size: 0.7rem;
    margin-bottom: 0.15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    line-height: 1.1;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.heatmap-tile .stock-link {
    text-decoration: none;
    font-weight: 700;
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    color: inherit;
}

.heatmap-tile .stock-link:hover {
    text-decoration: underline;
    filter: brightness(1.3);
}

.heatmap-tile .stock-link:after {
    content: '↗';
    font-size: 0.6em;
    opacity: 0;
    position: absolute;
    top: -0.2em;
    right: -0.8em;
    transition: opacity 0.2s ease;
}

.heatmap-tile .stock-link:hover:after {
    opacity: 0.8;
}

.stock-change {
    font-size: 0.7rem;
    font-weight: 600;
    width: 100%;
    text-align: center;
    line-height: 1.1;
}

/* Enhanced loading and error states for heatmap */
.loading-data,
.empty-data-message,
.connection-error,
.loading-message,
.retry-message {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.95) 0%, rgba(248, 249, 250, 0.95) 100%);
    backdrop-filter: blur(10px);
    z-index: 20;
    border-radius: 8px;
}

.loading-message {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
}

.loading-message h3 {
    color: #3498db;
    margin: 1rem 0 0.75rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.loading-message p {
    color: #6c757d;
    margin-bottom: 0;
    font-size: 0.9rem;
    font-weight: 500;
}

.loading-message .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.retry-message,
.connection-error {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(248, 249, 250, 0.98) 100%);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid #e9ecef;
    max-width: 400px;
    margin: 2rem;
}

.retry-message h3,
.connection-error h3 {
    color: #e74c3c;
    margin: 0 0 1rem;
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.retry-message p,
.connection-error p {
    color: #6c757d;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.5;
}

.retry-message .retry-button,
.connection-error .retry-button {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.3);
}

.retry-message .retry-button:hover,
.connection-error .retry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9 0%, #3498db 100%);
}

/* Enhanced Responsive Design for Dashboard */
@media (max-width: 1200px) {
    /* Corporate tables and forms */
    .corporate-results-container,
    .corporate-actions-section .card,
    .corporate-announcements-section .card {
        padding: 1.5rem;
    }
    
    .corporate-results-container .section-header h2,
    .corporate-actions-section .card h2,
    .corporate-announcements-section .card h2 {
        font-size: 1.5rem;
    }
    
    .corporate-results-table,
    .actions-table,
    .announcements-table {
        font-size: 0.85rem;
    }
    
    .corporate-results-table th,
    .corporate-results-table td,
    .actions-table th,
    .actions-table td,
    .announcements-table th,
    .announcements-table td {
        padding: 0.8rem 0.6rem;
    }
    
    /* Sector Watch responsive */
    .market-overview-section .card-body {
        padding: 1.5rem;
        gap: 1.5rem;
    }
    
    .chart-side {
        width: 65%;
    }
    
    .table-side {
        width: 35%;
    }
    
    .indices-table th,
    .indices-table td {
        padding: 0.8rem 0.6rem;
        font-size: 0.85rem;
    }
    
    /* Stocks Movements responsive */
    .dashboard-title-bar {
        padding: 0 1.5rem;
        height: 45px;
    }
    
    .dashboard-title {
        font-size: 0.8rem;
    }
    
    .indicator-wrapper {
        gap: 0.75rem;
    }
    
    .legend-indicator {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
    
    /* NSE Heatmap responsive */
    .heatmap-header {
        padding: 1.2rem 1.5rem;
    }
    
    .heatmap-header h3 {
        font-size: 1.1rem;
    }
    
    .heatmap-tile {
        height: 45px;
        font-size: 0.7rem;
    }
    
    .stock-symbol {
        font-size: 0.65rem;
    }
    
    .stock-change {
        font-size: 0.65rem;
    }
}

@media (max-width: 768px) {
    .controls {
        flex-direction: column;
        gap: 1rem;
    }
    
    .control-group {
        width: 100%;
    }
    
    .btn {
        width: 100%;
    }
    
    .chart-container {
        height: 300px;
    }
    
    /* Enhanced Dashboard Mobile Styles */
    
    /* Sector Watch Mobile */
    .market-overview-section {
        height: auto;
        max-height: none;
    }
    
    .market-overview-section .card-body {
        flex-direction: column;
        padding: 1rem;
        gap: 1rem;
    }
    
    .chart-side,
    .table-side {
        width: 100%;
    }
    
    .chart-side {
        height: 400px;
    }
    
    .pie-chart-wrapper {
        min-height: 250px;
    }
    
    .table-side {
        height: 300px;
    }
    
    .market-sentiment-bar {
        padding: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .sentiment-label {
        font-size: 0.8rem;
    }
    
    .sentiment-stats {
        font-size: 0.7rem;
    }
    
    .indices-table th,
    .indices-table td {
        padding: 0.6rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .constituent-title {
        font-size: 0.8rem;
        gap: 6px !important;
    }
    
    .live-indicator {
        font-size: 0.6rem;
        padding: 3px 6px;
    }
    
    /* Stocks Movements Mobile */
    .live-stocks-movements {
        height: auto;
        max-height: none;
    }
    
    .dashboard-title-bar {
        padding: 0 1rem;
        height: 60px;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 0.5rem;
    }
    
    .dashboard-title {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .indicator-wrapper {
        flex-direction: column;
        gap: 0.5rem;
        align-items: center;
    }
    
    .legend-indicator {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    .last-updated {
        font-size: 0.7rem;
        padding: 0.2rem 0.5rem;
    }
    
    .stocks-movements-section {
        height: 250px;
        padding: 0.5rem;
    }
    
    .stocks-movements-section .chart-container {
        padding: 0;
    }
    
    /* NSE Heatmap Mobile */
    .nse-heatmap-fullscreen {
        height: calc(100vh - 100px);
    }
    
    .heatmap-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        height: auto;
    }
    
    .heatmap-header h3 {
        font-size: 1rem;
        text-align: center;
    }
    
    .last-update {
        font-size: 0.75rem;
        text-align: center;
    }
    
    .fullscreen-heatmap-container {
        padding: 0.5rem;
    }
    
    .fullscreen-heatmap-grid {
        padding: 0.5rem;
        gap: 1px;
    }
    
    .heatmap-tile {
        height: 40px;
        padding: 0.3rem 0.2rem;
        font-size: 0.65rem;
    }
    
    .stock-symbol {
        font-size: 0.6rem;
        margin-bottom: 0.1rem;
    }
    
    .stock-change {
        font-size: 0.6rem;
    }
    
    .floating-legend {
        height: 50px;
        padding: 0.5rem;
        overflow-x: auto;
        overflow-y: hidden;
        justify-content: flex-start;
    }
    
    .legend-group {
        padding: 0 0.5rem;
        gap: 0.3rem;
        flex-shrink: 0;
    }
    
    .legend-item {
        font-size: 0.65rem;
        padding: 0.2rem 0.4rem;
        margin: 0 0.2rem;
        white-space: nowrap;
    }
    
    .legend-color {
        width: 8px;
        height: 8px;
        margin-right: 0.3rem;
    }
    
    .legend-divider {
        height: 20px;
        margin: 0 0.5rem;
    }
    
    /* Corporate sections mobile */
    .corporate-results-container {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 8px;
    }
    
    .corporate-results-container .section-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
    }
    
    .corporate-results-container .section-header h2 {
        font-size: 1.3rem;
        text-align: center;
    }
    
    .corporate-results-container .controls {
        width: 100%;
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .corporate-results-container .search-input {
        width: 100%;
        min-width: unset;
    }
    
    .corporate-results-container .results-stats {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .corporate-results-container .stat-item {
        padding: 0.75rem 0.5rem;
    }
    
    .corporate-results-container .stat-label {
        font-size: 0.75rem;
    }
    
    .corporate-results-container .stat-value {
        font-size: 1.2rem;
    }
    
    .corporate-actions-section .card,
    .corporate-announcements-section .card {
        padding: 1rem;
        border-radius: 8px;
    }
    
    .corporate-actions-section .card h2,
    .corporate-announcements-section .card h2 {
        font-size: 1.3rem;
        margin-bottom: 1.5rem;
        padding-bottom: 0.75rem;
        text-align: center;
    }
    
    .corporate-actions-controls,
    .corporate-announcements-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1rem;
        margin-bottom: 1.5rem;
    }
    
    .search-filter {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .search-filter input,
    .search-filter select {
        width: 100%;
        min-width: unset;
    }
    
    .refresh-controls {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .btn-primary {
        width: 100%;
        padding: 0.75rem;
        font-size: 0.85rem;
    }
    
    .table-container {
        border-radius: 8px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -1rem;
        padding: 0 1rem;
        max-width: calc(100vw - 2rem);
    }
    
    .corporate-results-table,
    .actions-table,
    .announcements-table {
        font-size: 0.8rem;
        min-width: 700px;
    }
    
    .corporate-results-table th,
    .corporate-results-table td,
    .actions-table th,
    .actions-table td,
    .announcements-table th,
    .announcements-table td {
        padding: 0.7rem 0.5rem;
        white-space: nowrap;
    }
    
    .actions-table .security-name,
    .actions-table .company-name {
        max-width: 150px;
    }
    
    .announcements-table .company-long-name {
        max-width: 150px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .announcements-table .headline {
        max-width: 200px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .actions-table .purpose,
    .announcements-table .category,
    .announcements-table .subcategory {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .announcements-table .critical-yes,
    .announcements-table .critical-no {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
    }
    
    .announcements-table .pdf-download {
        font-size: 1.2rem;
    }
    
    /* Enhanced mobile responsiveness for Results table */
    .table-container {
        margin: 0 -0.5rem;
        padding: 0;
        border-radius: 0;
    }
    
    .corporate-results-table {
        min-width: 550px;
        font-size: 0.75rem;
    }
    
    .corporate-results-table th {
        padding: 0.8rem 0.5rem;
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }
    
    .corporate-results-table td {
        padding: 0.6rem 0.5rem;
        font-size: 0.75rem;
    }
    
    /* Mobile card layout for announcements table */
    .announcements-table thead {
        position: relative;
    }
    
    .pagination {
        justify-content: center;
        gap: 0.25rem;
        flex-wrap: wrap;
    }
    
    .pagination-btn {
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
        min-width: 40px;
    }
}

@media (max-width: 480px) {
    .corporate-results-container .results-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .corporate-results-container .stat-item {
        padding: 0.75rem;
    }
    
    .search-filter input,
    .search-filter select {
        font-size: 0.85rem;
        padding: 0.7rem;
    }
    
    .btn-primary {
        font-size: 0.8rem;
        padding: 0.7rem;
    }
    
    .corporate-results-table,
    .actions-table,
    .announcements-table {
        font-size: 0.75rem;
        min-width: 600px;
    }
    
    .corporate-results-table th,
    .corporate-results-table td,
    .actions-table th,
    .actions-table td,
    .announcements-table th,
    .announcements-table td {
        padding: 0.6rem 0.4rem;
    }
    
    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
        min-width: 35px;
    }
}

/* Corporate Actions specific styles */
.corporate-actions-section {
    padding: 0;
}

.corporate-actions-section .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.corporate-actions-section .card h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

.corporate-actions-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.actions-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 1000px;
}

.actions-table th,
.actions-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
}

.actions-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.actions-table tr:hover {
    background-color: #f8f9fa;
}

.actions-table .security-name {
    font-weight: 500;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-table .company-name {
    font-weight: 500;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.actions-table .purpose {
    font-weight: 500;
    color: #27ae60;
}

.actions-table .dividend {
    font-weight: 500;
    color: #e67e22;
}

.actions-table .no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.actions-table .loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.actions-table .error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
}

.actions-table .error button {
    margin-top: 0.5rem;
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Corporate Announcements specific styles */
.corporate-announcements-section {
    padding: 0;
}

.corporate-announcements-section .card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.corporate-announcements-section .card h2 {
    margin-bottom: 1rem;
    color: #2c3e50;
    font-size: 1.8rem;
    font-weight: 600;
}

.corporate-announcements-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #e1e8ed;
    border-radius: 4px;
    background: white;
}

.announcements-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
    min-width: 1000px;
    table-layout: fixed;
}

.announcements-table th,
.announcements-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e1e8ed;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Column width definitions */
.announcements-table .col-datetime,
.announcements-table .datetime {
    width: 140px;
}

.announcements-table .col-company,
.announcements-table .company-name {
    width: 200px;
}

.announcements-table .col-headline,
.announcements-table .headline {
    width: 300px;
}

.announcements-table .col-category,
.announcements-table .category {
    width: 120px;
}

.announcements-table .col-subcategory,
.announcements-table .subcategory {
    width: 130px;
}

.announcements-table .col-critical,
.announcements-table .critical {
    width: 80px;
}

.announcements-table .col-pdf,
.announcements-table .pdf-link {
    width: 60px;
}

.announcements-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
    z-index: 10;
}

.announcements-table tr:hover {
    background-color: #f8f9fa;
}

.announcements-table .datetime {
    font-size: 0.85rem;
    color: #666;
    white-space: nowrap;
    min-width: 140px;
}

.announcements-table .company-info {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.announcements-table .company-long-name {
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.announcements-table .scrip-code {
    font-size: 0.8rem;
    color: #666;
}

.announcements-table .headline {
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
}

.announcements-table .category {
    font-weight: 500;
    color: #3498db;
}

.announcements-table .subcategory {
    font-weight: 500;
    color: #9b59b6;
}

.announcements-table .critical-yes {
    background-color: #e74c3c;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

.announcements-table .critical-no {
    background-color: #95a5a6;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 3px;
    font-size: 0.8rem;
    font-weight: 500;
}

.announcements-table .pdf-download {
    font-size: 1.2rem;
    text-decoration: none;
    color: #e67e22;
    cursor: pointer;
}

.announcements-table .pdf-download:hover {
    color: #d35400;
}

.announcements-table .no-data {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

.announcements-table .loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

.announcements-table .error {
    text-align: center;
    padding: 2rem;
    color: #e74c3c;
}

.announcements-table .error button {
    margin-top: 0.5rem;
    background-color: #e74c3c;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
}

/* Table info and pagination styles */
.table-info {
    padding: 0.75rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e1e8ed;
    font-size: 0.85rem;
    color: #666;
    text-align: center;
}

.pagination-container {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 0.5rem 0.75rem;
    border: 1px solid #ddd;
    background-color: white;
    color: #333;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    min-width: 40px;
}

.pagination-btn:hover {
    background-color: #f8f9fa;
    border-color: #3498db;
}

.pagination-btn.active {
    background-color: #3498db;
    color: white;
    border-color: #3498db;
}

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

.pagination-ellipsis {
    padding: 0.5rem;
    color: #666;
    font-size: 0.85rem;
}

/* Additional responsive styles for corporate actions and announcements */
@media (max-width: 768px) {
    .corporate-actions-controls,
    .corporate-announcements-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .search-filter {
        flex-direction: column;
        gap: 0.5rem;
    }

    .actions-table,
    .announcements-table {
        font-size: 0.8rem;
        min-width: 800px;
    }

    .actions-table th,
    .actions-table td,
    .announcements-table th,
    .announcements-table td {
        padding: 0.5rem;
    }

    /* Mobile table cards */
    .announcements-table thead {
        display: none;
    }

    .announcements-table tr {
        display: block;
        border: 1px solid #e1e8ed;
        margin-bottom: 0.5rem;
        border-radius: 4px;
        background: white;
    }

    .announcements-table td {
        display: block;
        text-align: left;
        border-bottom: 1px solid #f0f0f0;
        position: relative;
        padding: 0.5rem 0.5rem 0.5rem 120px;
    }

    .announcements-table td:before {
        content: attr(data-label) ": ";
        position: absolute;
        left: 0.5rem;
        width: 110px;
        padding-right: 10px;
        white-space: nowrap;
        font-weight: 600;
        color: #666;
    }

    .announcements-table td:last-child {
        border-bottom: none;
    }

    .pagination {
        justify-content: center;
        gap: 0.25rem;
    }

    .pagination-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
        min-width: 35px;
    }
}

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

.chart-modal-content {
    background-color: white;
    margin: 2% auto;
    padding: 0;
    border-radius: 8px;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s ease-out;
}

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

.chart-modal-header {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #34495e;
}

.chart-modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chart-modal-close {
    color: white;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.chart-modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.chart-modal-controls {
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.chart-modal-controls label {
    font-weight: 600;
    color: #495057;
}

.chart-modal-controls select {
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    min-width: 150px;
}

.chart-modal-controls button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.chart-modal-controls button:hover {
    background-color: #0056b3;
}

.chart-container {
    padding: 1.5rem;
    height: 600px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.price-chart-wrapper {
    flex: 3;
    position: relative;
    min-height: 400px;
}

.volume-chart-wrapper {
    flex: 1;
    position: relative;
    min-height: 150px;
    border-top: 1px solid #e0e0e0;
    padding-top: 1rem;
    overflow: hidden;
}

.price-chart-wrapper canvas,
.volume-chart-wrapper canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Symbol Link Styles */
.symbol-link {
    color: #007bff;
    text-decoration: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 2px 6px;
    border-radius: 4px;
}

.symbol-link:hover {
    background-color: #e3f2fd;
    color: #0056b3;
    text-decoration: underline;
}

.symbol-link:active {
    background-color: #bbdefb;
}

/* Loading spinner for chart */
#chart-loading {
    text-align: center;
    padding: 2rem;
    color: #666;
}

#chart-loading.error {
    color: #dc3545;
}

/* Responsive chart modal */
@media (max-width: 768px) {
    .chart-modal-content {
        width: 95%;
        margin: 5% auto;
        max-height: 85vh;
    }
    
    .chart-modal-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .chart-modal-controls select {
        width: 100%;
    }
    
    .chart-container {
        height: 400px;
        padding: 1rem;
    }
    
    .price-chart-wrapper {
        min-height: 250px;
    }
    
    .volume-chart-wrapper {
        min-height: 100px;
        overflow-x: auto;
        overflow-y: hidden;
    }
}

/* Compact Search Stock Styles */
.search-stock-compact {
    height: calc(100vh - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0.5rem;
    gap: 0.5rem;
}

.search-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
    background: white;
    padding: 0.75rem;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
}

.search-input-wrapper {
    position: relative;
    flex: 1;
    max-width: 300px;
}

#stock-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    font-size: 0.9rem;
    background-color: white;
    transition: all 0.2s ease;
}

#stock-search-input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
}

.search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-item {
    padding: 0.6rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.suggestion-item:hover {
    background-color: #f8f9fa;
}

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

.suggestion-item.no-results {
    color: #6c757d;
    font-style: italic;
    text-align: center;
    cursor: default;
    padding: 0.75rem;
}

.suggestion-item.no-results:hover {
    background-color: transparent;
}

.suggestion-symbol {
    font-weight: 600;
    color: #2c3e50;
    font-size: 0.85rem;
}

.suggestion-name {
    color: #6c757d;
    font-size: 0.75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-stock-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border-radius: 4px;
    border: 1px solid #90caf9;
}

.stock-symbol-display {
    color: #1565c0;
    font-size: 0.9rem;
    font-weight: 700;
}

.stock-name-display {
    color: #1976d2;
    font-size: 0.8rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.chart-container-compact {
    flex: 1;
    background: white;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid #e9ecef;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chart-controls-compact {
    padding: 0.5rem 0.75rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.form-select-compact {
    padding: 0.3rem 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 3px;
    background-color: white;
    font-size: 0.8rem;
    min-width: 60px;
}

.btn-compact {
    padding: 0.3rem 0.6rem;
    border: none;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.8rem;
    min-width: 30px;
}

.btn-compact.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-compact.btn-primary:hover {
    background-color: #0056b3;
}

.btn-compact.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-compact.btn-secondary:hover {
    background-color: #545b62;
}

.chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.price-chart-wrapper-compact {
    flex: 3;
    position: relative;
    min-height: 0;
    padding: 0.5rem;
}

.volume-chart-wrapper-compact {
    flex: 1;
    position: relative;
    min-height: 0;
    border-top: 1px solid #e9ecef;
    padding: 0 0.5rem 0.5rem;
}

.price-chart-wrapper-compact canvas,
.volume-chart-wrapper-compact canvas {
    width: 100% !important;
    height: 100% !important;
}

.loading-compact {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    padding: 1rem;
    color: #6c757d;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    z-index: 10;
    font-size: 0.8rem;
}

.loading-compact.error {
    color: #dc3545;
}

/* Responsive Compact Search Stock Styles */
@media (max-width: 768px) {
    .search-stock-compact {
        height: calc(100vh - 140px);
        padding: 0.3rem;
        gap: 0.3rem;
    }
    
    .search-header {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        padding: 0.5rem;
    }
    
    .search-input-wrapper {
        max-width: 100%;
    }
    
    #stock-search-input {
        padding: 0.6rem;
        font-size: 0.9rem;
    }
    
    .selected-stock-info {
        justify-content: center;
        text-align: center;
    }
    
    .stock-name-display {
        max-width: 150px;
    }
    
    .chart-controls-compact {
        padding: 0.4rem 0.5rem;
        flex-wrap: wrap;
        gap: 0.3rem;
    }
    
    .form-select-compact,
    .btn-compact {
        font-size: 0.75rem;
    }
    
    .price-chart-wrapper-compact,
    .volume-chart-wrapper-compact {
        padding: 0.3rem;
    }
}

/* Chart button styles */
.chart-btn {
    background-color: #3498db;
    border: none;
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
}

.chart-btn:hover {
    background-color: #2980b9;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.chart-btn:active {
    transform: translateY(1px);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.chart-unavailable {
    color: #95a5a6;
    font-style: italic;
}

/* Trend highlighting for corporate results table */
.trend-green {
    background-color: rgba(46, 204, 113, 0.25) !important;
    border-left: 5px solid #27ae60;
    border: 1px solid rgba(46, 204, 113, 0.3);
}

.trend-red {
    background-color: rgba(231, 76, 60, 0.25) !important;
    border-left: 5px solid #c0392b;
    border: 1px solid rgba(231, 76, 60, 0.3);
}

.trend-green td {
    color: #1e8449;
    font-weight: 500;
}

.trend-red td {
    color: #a93226;
    font-weight: 500;
}

.trend-green:hover {
    background-color: rgba(46, 204, 113, 0.35) !important;
}

.trend-red:hover {
    background-color: rgba(231, 76, 60, 0.35) !important;
}

/* Trend badges for 3-day trend column */
.trend-badge {
    display: inline-block;
    padding: 0.3rem 0.6rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    min-width: 60px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.trend-badge-green {
    background-color: #27ae60;
    color: white;
    box-shadow: 0 2px 4px rgba(39, 174, 96, 0.3);
}

.trend-badge-red {
    background-color: #e74c3c;
    color: white;
    box-shadow: 0 2px 4px rgba(231, 76, 60, 0.3);
}

.trend-badge-neutral {
    background-color: #95a5a6;
    color: white;
    box-shadow: 0 2px 4px rgba(149, 165, 166, 0.3);
}

.trend-badge-green:hover {
    background-color: #2ecc71;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(39, 174, 96, 0.4);
}

.trend-badge-red:hover {
    background-color: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(231, 76, 60, 0.4);
}

.trend-badge-neutral:hover {
    background-color: #7f8c8d;
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(149, 165, 166, 0.4);
}

/* Trend row backgrounds */
.trend-row-green {
    background-color: rgba(39, 174, 96, 0.25) !important;
}

.trend-row-green:hover {
    background-color: rgba(39, 174, 96, 0.35) !important;
}

.trend-row-red {
    background-color: rgba(231, 76, 60, 0.25) !important;
}

.trend-row-red:hover {
    background-color: rgba(231, 76, 60, 0.35) !important;
}

/* Exploration Dashboard Styles */
.exploration-container {
    padding: 20px;
    color: #333 !important;
}

.exploration-container * {
    color: inherit;
}

.controls-panel {
    background: white;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: flex-end;
    color: #333 !important;
}

.controls-panel label {
    color: #333 !important;
    font-weight: 500;
    margin-bottom: 5px;
    display: block;
}

.controls-panel select,
.controls-panel input {
    color: #333 !important;
}

.control-group {
    display: flex;
    flex-direction: column;
    min-width: 150px;
    position: relative;
}

/* Specific styling for the stock search control group */
.control-group:has(#explorationStockSearch),
.control-group:has(.exploration-search-input),
.stock-search-control {
    min-width: 280px; /* Wider minimum width for stock search */
    flex: 1.5; /* Take up more space in flex layout */
}

/* Fallback for browsers that don't support :has() */
.exploration-container .control-group:nth-child(2) {
    min-width: 280px;
    flex: 1.5;
}

.control-group label {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.control-group select,
.control-group input {
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.suggestions {
    position: absolute;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    width: 100%;
    margin-top: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    top: 100%;
}

.suggestion-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.suggestion-item:hover {
    background-color: #f5f5f5;
}

.no-suggestions {
    padding: 8px 12px;
    color: #999;
}

.fields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.field-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.field-item input[type="checkbox"] {
    cursor: pointer;
}

.field-item label {
    cursor: pointer;
    font-size: 13px;
}

#plotButton {
    padding: 10px 20px;
    background-color: #007bff !important;
    color: white !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

#plotButton:hover:not(:disabled) {
    background-color: #0056b3 !important;
    transform: translateY(-1px);
}

#plotButton:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chart-container {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
    position: relative;
}

.chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #999;
}

#stockChart {
    display: none;
    width: 100% !important;
    height: 400px !important;
}



/* Exploration Search Suggestions - Proper UI Styling */
.exploration-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: -100px; /* Extend beyond the input width */
    min-width: 400px; /* Minimum width for long futures/options names */
    width: max(100%, 400px); /* At least 400px or input width, whichever is larger */
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 12px 12px;
    max-height: 350px; /* Increased height for more results */
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 40px var(--shadow-color);
    backdrop-filter: blur(15px);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.exploration-suggestions .suggestion-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
    user-select: none;
}

.suggestion-item.data-unavailable {
    opacity: 0.75;
    border-left: 3px solid var(--warning-color);
    background: var(--warning-light);
    position: relative;
}

.suggestion-item.data-unavailable::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--warning-light), transparent);
    pointer-events: none;
}

.suggestion-item.data-available {
    border-left: 3px solid var(--success-color);
    position: relative;
}

.suggestion-item.data-available::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--success-light), transparent);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.suggestion-item.data-available:hover::before {
    opacity: 1;
}

.stock-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.availability-indicator {
    font-size: 12px;
    opacity: 0.8;
    margin-left: 6px;
}

.stock-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.stock-exchange, .instrument-type {
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    font-weight: 500;
}

.instrument-type {
    background: var(--accent-color);
    color: white;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.instrument-info {
    font-style: italic;
    color: var(--text-muted);
    font-size: 10px;
}

.data-warning {
    background: linear-gradient(135deg, var(--warning-color), #ffeaa7);
    color: #856404;
    margin: 8px;
    padding: 12px;
    border-radius: 6px;
    border: 1px solid #ffeaa7;
    animation: slideIn 0.3s ease-out;
}

.warning-content {
    font-size: 12px;
    line-height: 1.4;
}

.warning-content strong {
    font-weight: 600;
}

.warning-content small {
    opacity: 0.8;
    font-style: italic;
}

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

.exploration-suggestions .suggestion-item * {
    pointer-events: none;
}

.exploration-suggestions .suggestion-item:hover {
    background: var(--bg-tertiary);
    transform: translateX(4px) translateY(-1px);
    box-shadow: 4px 4px 20px var(--shadow-light);
    border-left-width: 4px;
}

.exploration-suggestions .suggestion-item:last-child {
    border-bottom: none;
}

.exploration-suggestions .stock-symbol {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap; /* Prevent symbol wrapping */
    overflow: visible; /* Allow full display */
    font-family: 'Courier New', monospace; /* Monospace for better symbol readability */
}

.exploration-suggestions .stock-name {
    color: var(--text-secondary);
    font-size: 12px;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 350px; /* Allow more space for long names */
}

.exploration-suggestions .stock-exchange {
    color: #17a2b8;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 6px;
    background: rgba(23, 162, 184, 0.1);
    border-radius: 12px;
    display: inline-block;
    width: fit-content;
    margin-top: 2px;
}

.exploration-suggestions .suggestion-item:hover .stock-symbol {
    color: #007bff;
}

.exploration-suggestions .suggestion-item:hover .stock-exchange {
    background: rgba(0, 123, 255, 0.15);
    color: #007bff;
}

.exploration-suggestions .searching-message,
.exploration-suggestions .no-suggestions,
.exploration-suggestions .error-message {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #6c757d;
    font-style: italic;
}

.exploration-suggestions .searching-message {
    color: #17a2b8;
    position: relative;
}

.exploration-suggestions .searching-message::after {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    margin-left: 8px;
    border: 2px solid #17a2b8;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

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

.exploration-suggestions .error-message {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.05);
}

.exploration-suggestions .no-suggestions {
    color: #6c757d;
}

/* Exploration Search Input Styling */
.exploration-search-input {
    transition: all 0.2s ease;
    border: 1px solid #e9ecef !important;
    border-radius: 6px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    background: white !important;
}

.exploration-search-input:focus {
    border-color: #007bff !important;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1) !important;
    outline: none !important;
}

.exploration-search-input:focus + .exploration-suggestions {
    border-color: #007bff;
}

/* Fix Exploration Layout Distortion Issues */
.exploration-container {
    display: flex;
    flex-direction: column;
    max-width: 100%;
    overflow: visible;
    background: var(--gradient-primary);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px var(--shadow-color);
    backdrop-filter: blur(10px);
    animation: fadeInUp 0.6s ease-out;
    border: 1px solid var(--border-light);
}

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

.exploration-container .controls-panel {
    flex-shrink: 0;
    margin-bottom: 20px;
    min-height: auto;
    overflow: visible;
}

.exploration-container .chart-container {
    flex: 1;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
    position: relative;
    margin-top: 0;
}

.exploration-container .chart-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: #999;
    font-style: italic;
}

.exploration-container .fields-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.exploration-container .field-item {
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.exploration-container .btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 120px;
}

.exploration-container .btn-primary {
    background: #007bff;
    color: white;
}

.exploration-container .btn-primary:hover:not(:disabled) {
    background: #0056b3;
    transform: translateY(-1px);
}

.exploration-container .btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Multi-Select Dropdown Styles */
.multi-select-container {
    position: relative;
    width: 100%;
}

.multi-select-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    min-height: 42px;
}

.multi-select-field:hover {
    border-color: #007bff;
    background: #f8f9fa;
}

.multi-select-field:focus,
.multi-select-field.active {
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
    outline: none;
}

.multi-select-field .selected-text {
    flex: 1;
    color: #495057;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-field .dropdown-arrow {
    color: #6c757d;
    font-size: 12px;
    transition: transform 0.2s ease;
    margin-left: 8px;
    flex-shrink: 0;
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e9ecef;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: scaleY(0);
    transform-origin: top;
    transition: transform 0.2s ease, opacity 0.2s ease;
    opacity: 0;
    visibility: hidden;
}

.multi-select-dropdown.show {
    transform: scaleY(1);
    opacity: 1;
    visibility: visible;
}

.field-option {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid #f8f9fa;
    gap: 8px;
}

.field-option:hover {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    transform: translateX(2px);
}

.field-option:last-child {
    border-bottom: none;
}

.field-option.selected {
    background: rgba(0, 123, 255, 0.05);
    color: #007bff;
}

.field-option.selected:hover {
    background: rgba(0, 123, 255, 0.1);
}

.field-option input[type="checkbox"] {
    width: 16px;
    height: 16px;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    flex-shrink: 0;
}

.field-option input[type="checkbox"]:checked {
    background: #007bff;
    border-color: #007bff;
    position: relative;
}

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

.field-option span {
    flex: 1;
    font-size: 14px;
    color: #495057;
    font-weight: 500;
}

.field-option.selected span {
    color: #007bff;
    font-weight: 600;
}

/* Zoom Controls */
.zoom-controls {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.zoom-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.zoom-buttons .btn-sm {
    padding: 6px 10px;
    font-size: 14px;
    border-radius: 4px;
    border: 1px solid #dee2e6;
    background: #f8f9fa;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-buttons .btn-sm:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    transform: translateY(-1px);
}

.zoom-buttons .btn-sm.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.zoom-buttons .btn-sm.active:hover {
    background: #0056b3;
    border-color: #0056b3;
}

.zoom-info {
    flex: 1;
    text-align: right;
    min-width: 200px;
}

.zoom-info .text-muted {
    font-size: 12px;
    color: #6c757d !important;
    line-height: 1.4;
}

/* Chart container updates */
.chart-container {
    position: relative;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    min-height: 400px;
}

.chart-container canvas {
    max-height: 500px;
    cursor: grab;
    transition: cursor 0.1s ease;
}

.chart-container canvas:active {
    cursor: grabbing;
}

.chart-container canvas.zoom-select-mode {
    cursor: crosshair;
}

.chart-container canvas.zoom-select-mode:active {
    cursor: crosshair;
}

/* Better visual feedback for pan mode */
.chart-container canvas.pan-mode {
    cursor: grab;
}

.chart-container canvas.pan-mode:active {
    cursor: grabbing;
}

/* Mobile Touch Controls Enhancement */
.chart-container canvas {
    touch-action: manipulation; /* Improve touch responsiveness */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.chart-container canvas.touch-active {
    touch-action: none; /* Prevent default touch behaviors when interacting */
}

/* Enhanced Theme Toggle - Now in Navigation */
.tabs-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid var(--border-light);
    background: var(--bg-secondary);
    transition: all 0.3s ease;
}

.tab-collapse-toggle button {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab-collapse-toggle button:hover {
    background: var(--bg-quaternary);
    transform: translateY(-1px);
}

.theme-toggle-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.tabs-header .theme-toggle-container {
    position: static;
    background: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    backdrop-filter: none;
}

/* Only apply hover effects to standalone theme toggle containers (not in tabs-header) */
.theme-toggle-container:not(.tabs-header .theme-toggle-container):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px var(--shadow-color);
    border-color: var(--accent-color);
}

.theme-toggle {
    background: var(--gradient-accent);
    border: none;
    font-size: 16px;
    cursor: pointer;
    padding: 6px;
    border-radius: 50%;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
    position: relative;
    overflow: hidden;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 212, 255, 0.3);
}

.theme-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.2), transparent);
    transform: scale(0);
    transition: transform 0.3s ease;
}

.theme-toggle:hover::before {
    transform: scale(1);
}

.theme-toggle:hover {
    transform: rotate(180deg) scale(1.1);
    box-shadow: var(--glow-accent);
}

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

/* Enhanced Tooltips */
.enhanced-tooltip {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color) !important;
    color: var(--text-primary) !important;
    border-radius: 12px !important;
    padding: 16px !important;
    box-shadow: 0 8px 32px var(--shadow-color) !important;
    backdrop-filter: blur(15px) !important;
    max-width: 350px !important;
    position: relative !important;
}

.enhanced-tooltip::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    border-radius: 12px;
    opacity: 0.1;
    pointer-events: none;
}

.tooltip-header {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.tooltip-content {
    font-size: 12px;
    line-height: 1.4;
}

.tooltip-axis-group {
    margin-bottom: 8px;
}

.tooltip-axis-group:last-child {
    margin-bottom: 0;
}

.tooltip-axis-title {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.tooltip-data-item {
    display: flex;
    align-items: center;
    margin-bottom: 2px;
}

.tooltip-color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    margin-right: 8px;
    flex-shrink: 0;
}

.tooltip-label {
    flex-grow: 1;
    color: var(--text-primary);
}

.tooltip-value {
    font-weight: 500;
    color: var(--accent-color);
}

/* Enhanced Legend */
.custom-legend {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    box-shadow: 0 4px 20px var(--shadow-light);
    backdrop-filter: blur(10px);
    max-height: 140px;
    overflow-y: auto;
    position: relative;
}

.custom-legend::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    border-radius: 12px;
    opacity: 0.05;
    pointer-events: none;
}

.legend-group {
    margin-bottom: 12px;
}

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

.legend-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border-color);
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    padding: 6px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border-light);
    position: relative;
    overflow: hidden;
}

.legend-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, var(--accent-light), transparent);
    transition: left 0.5s ease;
}

.legend-item:hover::before {
    left: 100%;
}

.legend-item:hover {
    background: var(--bg-quaternary);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px var(--shadow-light);
    border-color: var(--accent-color);
}

.legend-item.hidden {
    opacity: 0.4;
    background: var(--bg-secondary);
    text-decoration: line-through;
}

.legend-item.hidden:hover {
    opacity: 0.7;
}

.legend-color {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    margin-right: 6px;
    flex-shrink: 0;
}

/* Responsive fixes for exploration */
@media (max-width: 1024px) {
    
    .custom-legend {
        max-height: 80px;
        padding: 8px;
    }
    
    .legend-items {
        gap: 6px;
    }
    
    .legend-item {
        font-size: 11px;
        padding: 3px 6px;
    }
}

@media (max-width: 768px) {
    .exploration-container .controls-panel {
        gap: 10px;
        padding: 15px;
        grid-template-columns: 1fr;
    }
    
    .exploration-container .control-group {
        min-width: unset;
        flex: 1 1 auto;
        width: 100%;
    }
    
    /* Mobile adjustments for search suggestions */
    .exploration-suggestions {
        right: -20px; /* Less extension on mobile */
        min-width: calc(100vw - 60px); /* Almost full width on mobile */
        max-width: calc(100vw - 40px);
        left: -10px;
    }
    
    .exploration-container .chart-container {
        padding: 10px;
        min-height: 250px;
    }
    
    .multi-select-dropdown {
        max-height: 150px;
        font-size: 14px;
    }
    
    .zoom-controls {
        padding: 10px;
        flex-direction: column;
        gap: 8px;
    }
    
    .zoom-buttons {
        flex-wrap: wrap;
        justify-content: center;
        gap: 8px;
    }
    
    .zoom-buttons .btn {
        min-width: 40px;
        min-height: 40px; /* Better touch targets */
        font-size: 16px;
    }
    
    .zoom-info {
        text-align: center;
        min-width: unset;
    }
    
    .zoom-info .text-muted {
        font-size: 11px;
        line-height: 1.3;
    }
    
    .custom-legend {
        max-height: 60px;
        padding: 6px;
        margin-bottom: 10px;
    }
    
    .legend-items {
        gap: 4px;
    }
    
    .legend-item {
        font-size: 10px;
        padding: 2px 4px;
    }
    
    /* Mobile adjustments for navigation theme toggle */
    .tabs-header {
        flex-direction: column;
        gap: 10px;
        padding: 8px 10px;
    }
    
    .tabs-header .theme-toggle-container {
        align-self: center;
    }
    
    .theme-toggle {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
}

@media (max-width: 480px) {
    .exploration-container {
        padding: 10px;
    }
    
    .exploration-container .controls-panel {
        padding: 10px;
        gap: 8px;
    }
    
    .exploration-container .chart-container {
        padding: 5px;
        min-height: 200px;
    }
    
    .zoom-buttons .btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 14px;
    }
    
    .multi-select-field {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .field-option {
        font-size: 13px;
        padding: 8px 10px;
    }
}


/* ========================================
   Market Sentiment Styles
   ======================================== */

.market-sentiment-container {
  padding: 20px;
}

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

.sentiment-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 600;
}

.header-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.date-filter,
.custom-date-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.btn-refresh {
  padding: 8px 16px;
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.3s;
}

.btn-refresh:hover {
  background-color: #2563eb;
}

/* Overall Verdict Card */
.overall-verdict-card {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 30px;
  margin-bottom: 30px;
  color: white;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.verdict-loading,
.no-data-message {
  text-align: center;
  padding: 20px;
  font-size: 16px;
}

.verdict-main {
  display: flex;
  gap: 30px;
  align-items: center;
  margin-bottom: 20px;
}

.verdict-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 30px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  min-width: 150px;
}

.verdict-badge.buy {
  background: rgba(34, 197, 94, 0.3);
  border: 2px solid rgba(34, 197, 94, 0.8);
}

.verdict-badge.sell {
  background: rgba(239, 68, 68, 0.3);
  border: 2px solid rgba(239, 68, 68, 0.8);
}

.verdict-badge.neutral {
  background: rgba(156, 163, 175, 0.3);
  border: 2px solid rgba(156, 163, 175, 0.8);
}

.verdict-signal {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 5px;
}

.verdict-strength {
  font-size: 14px;
  opacity: 0.9;
}

.verdict-details {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.verdict-details .label {
  display: block;
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 5px;
}

.verdict-details .value {
  font-size: 20px;
  font-weight: 600;
}

.score-description {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.4;
  font-weight: 400;
}

.verdict-breakdown {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 15px;
  padding-top: 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.breakdown-item {
  text-align: center;
}

.breakdown-label {
  display: block;
  font-size: 12px;
  opacity: 0.8;
  margin-bottom: 5px;
}

.breakdown-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
}

.breakdown-value.positive {
  color: #86efac;
}

.breakdown-value.negative {
  color: #fca5a5;
}

/* Charts Row */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 20px;
  margin-bottom: 30px;
}

.chart-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.chart-card h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  font-weight: 600;
}

.chart-card-full {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
  grid-column: 1 / -1;
}

.chart-card-full h3 {
  margin: 0 0 10px 0;
  font-size: 18px;
  font-weight: 600;
}

.chart-card-full .chart-help {
  margin-bottom: 15px;
  padding: 10px;
  background: #f0f9ff;
  border-left: 4px solid #3b82f6;
  border-radius: 4px;
  font-size: 13px;
  color: #1e40af;
}

.chart-card-full canvas {
  height: 400px !important;
}

/* Comprehensive Chart Styling */
.comprehensive-chart-card {
  background: linear-gradient(180deg, #ffffff 0%, #fafbfc 100%);
  border: 1px solid #e5e7eb;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  padding: 24px;
}

.comprehensive-chart-card h3 {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-weight: 600;
  color: #1f2937;
  font-size: 16px;
  letter-spacing: -0.01em;
  margin-bottom: 12px;
}

.comprehensive-chart-card .chart-help {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-left: 3px solid #0ea5e9;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.5;
  color: #0369a1;
  padding: 10px 14px;
  margin-bottom: 16px;
}

.comprehensive-chart-card .chart-help strong {
  color: #0c4a6e;
}

.comprehensive-chart-card .chart-container {
  position: relative;
  height: 400px;
  background: #ffffff;
  border-radius: 12px;
  padding: 16px;
  border: 1px solid #f3f4f6;
}

.comprehensive-chart-card canvas {
  height: 100% !important;
}

.signal-stats {
  margin-top: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9fafb;
  border-radius: 6px;
}

.stat-label {
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
}

.stat-label.buy {
  background: rgba(34, 197, 94, 0.2);
  color: #15803d;
}

.stat-label.sell {
  background: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

.stat-label.neutral {
  background: rgba(156, 163, 175, 0.2);
  color: #4b5563;
}

.stat-value {
  font-weight: 600;
}

.stat-confidence {
  font-size: 12px;
  opacity: 0.7;
}

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

.metric-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s, box-shadow 0.3s;
}

.metric-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.metric-icon {
  font-size: 32px;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.futures-icon {
  background: rgba(59, 130, 246, 0.1);
}

.options-icon {
  background: rgba(168, 85, 247, 0.1);
}

.pcr-icon {
  background: rgba(234, 179, 8, 0.1);
}

.volume-icon {
  background: rgba(34, 197, 94, 0.1);
}

.metric-content h4 {
  margin: 0 0 5px 0;
  font-size: 14px;
  color: #6b7280;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 5px;
}

.metric-value.bullish {
  color: #22c55e;
}

.metric-value.bearish {
  color: #ef4444;
}

.metric-value.neutral {
  color: #9ca3af;
}

.metric-score,
.metric-subtext {
  font-size: 12px;
  color: #6b7280;
}

/* Breakdown Section */
.breakdown-section {
  background: white;
  border-radius: 12px;
  padding: 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  overflow: hidden;
}

.breakdown-tabs {
  display: flex;
  border-bottom: 2px solid #f3f4f6;
  background: #f9fafb;
}

.breakdown-tab {
  flex: 1;
  padding: 15px 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #6b7280;
  transition: all 0.3s;
  border-bottom: 3px solid transparent;
}

.breakdown-tab:hover {
  background: #f3f4f6;
  color: #111827;
}

.breakdown-tab.active {
  color: #3b82f6;
  border-bottom-color: #3b82f6;
  background: white;
}

.breakdown-content {
  padding: 20px;
}

.breakdown-tab-content {
  display: none;
}

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

/* History Table Pagination Controls */
.history-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border-radius: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.history-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #374151;
}

.history-info #historyTotalCount {
  font-weight: 600;
  color: #1f2937;
}

.history-range {
  color: #6b7280;
  font-size: 12px;
}

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

.pagination-btn {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #374151;
  transition: all 0.2s ease;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
}

.pagination-btn:hover:not(:disabled) {
  background: #f3f4f6;
  border-color: #d1d5db;
}

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

.pagination-info {
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-size: 13px;
  color: #6b7280;
  padding: 0 8px;
}

.pagination-info span {
  font-weight: 600;
  color: #374151;
}

.page-size-select {
  padding: 6px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  background: #ffffff;
  font-family: 'Poppins', 'Segoe UI', sans-serif;
  font-size: 12px;
  color: #374151;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.page-size-select:hover {
  border-color: #d1d5db;
}

.page-size-select:focus {
  border-color: #3b82f6;
}

@media screen and (max-width: 768px) {
  .history-controls {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }

  .history-pagination {
    width: 100%;
    justify-content: space-between;
  }

  .pagination-btn {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .pagination-info {
    font-size: 11px;
  }

  .page-size-select {
    font-size: 11px;
    padding: 4px 8px;
  }
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.data-table thead {
  background: #f9fafb;
}

.data-table th {
  padding: 12px;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 2px solid #e5e7eb;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
}

.data-table tbody tr:hover {
  background: #f9fafb;
}

.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.badge.buy {
  background: rgba(34, 197, 94, 0.2);
  color: #15803d;
}

.badge.sell {
  background: rgba(239, 68, 68, 0.2);
  color: #b91c1c;
}

.badge.neutral {
  background: rgba(156, 163, 175, 0.2);
  color: #4b5563;
}

.badge.strong {
  background: rgba(59, 130, 246, 0.2);
  color: #1e40af;
}

.badge.moderate {
  background: rgba(234, 179, 8, 0.2);
  color: #a16207;
}

.badge.weak {
  background: rgba(156, 163, 175, 0.2);
  color: #6b7280;
}

.positive {
  color: #22c55e;
  font-weight: 600;
}

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

/* Responsive Design */
@media (max-width: 1024px) {
  .charts-row {
    grid-template-columns: 1fr;
  }

  .verdict-main {
    flex-direction: column;
  }

  .verdict-details {
    grid-template-columns: 1fr;
  }

  .verdict-breakdown {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .breakdown-tabs {
    flex-direction: column;
  }

  .sentiment-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }

  .header-controls {
    width: 100%;
    flex-wrap: wrap;
  }
}

/* Error Message */
.error-message {
  text-align: center;
  padding: 40px 20px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.error-message i {
  font-size: 48px;
  color: #ef4444;
  margin-bottom: 15px;
}

.error-message p {
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 20px;
}

.error-message button {
  padding: 10px 20px;
  background: #3b82f6;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.error-message button:hover {
  background: #2563eb;
}


/* Help text styles for market sentiment */
.metric-help {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    line-height: 1.3;
    font-style: italic;
}

.verdict-explanation {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.verdict-explanation strong {
    font-weight: 600;
}

.table-help {
    background-color: var(--bg-tertiary);
    padding: 10px 15px;
    border-left: 4px solid var(--accent-color);
    margin-bottom: 10px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

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

[data-theme="dark"] .verdict-explanation {
    background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%);
}

[data-theme="dark"] .table-help {
    background-color: var(--bg-tertiary);
    border-left-color: var(--accent-color);
}

/* ========================================
   MARKET PREDICTIONS STYLES
   ======================================== */

.market-predictions-container {
    padding: 20px;
}

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

.predictions-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

/* Main Prediction Card */
.prediction-main-card {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid var(--border-color);
}

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

.prediction-badge {
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    min-width: 180px;
}

.prediction-badge.buy {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
}

.prediction-badge.sell {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.prediction-badge.neutral {
    background: linear-gradient(135deg, #94a3b8 0%, #64748b 100%);
    color: white;
}

.prediction-direction {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
}

.prediction-timeframe {
    font-size: 12px;
    opacity: 0.9;
}

.prediction-confidence-box {
    text-align: right;
}

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

.confidence-value {
    font-size: 32px;
    font-weight: 700;
}

.confidence-high {
    color: #22c55e;
}

.confidence-medium {
    color: #f59e0b;
}

.confidence-low {
    color: #ef4444;
}

.prediction-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.detail-item {
    display: flex;
    justify-content: space-between;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: 6px;
}

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

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

.trend-strong {
    color: #22c55e;
}

.trend-moderate {
    color: #3b82f6;
}

.trend-weak {
    color: #94a3b8;
}

.recommendation-box {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid;
}

.recommendation-box.buy {
    background: rgba(34, 197, 94, 0.1);
    border-left-color: #22c55e;
}

.recommendation-box.sell {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.recommendation-box.neutral {
    background: rgba(148, 163, 184, 0.1);
    border-left-color: #94a3b8;
}

.recommendation-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.recommendation-text {
    font-size: 14px;
    color: var(--text-primary);
}

.prediction-reasoning {
    background: var(--bg-primary);
    padding: 16px;
    border-radius: 8px;
}

.reasoning-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.reasoning-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.reasoning-list li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    font-size: 13px;
    color: var(--text-primary);
}

.reasoning-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
}

/* Prediction Metrics Grid */
.prediction-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

/* Pattern Matches Section */
.pattern-matches-section {
    margin-bottom: 24px;
}

.pattern-matches-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

/* Divergence Alerts */
.divergence-alerts-section {
    margin-bottom: 24px;
}

.divergence-alerts-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 12px;
}

.alerts-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.no-alerts {
    padding: 16px;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 8px;
}

.alert-item {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: 8px;
    border-left: 4px solid;
}

.alert-item.high {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: #ef4444;
}

.alert-item.medium {
    background: rgba(245, 158, 11, 0.1);
    border-left-color: #f59e0b;
}

.alert-item.low {
    background: rgba(34, 197, 94, 0.1);
    border-left-color: #22c55e;
}

.alert-icon {
    font-size: 24px;
}

.alert-content {
    flex: 1;
}

.alert-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.alert-description {
    font-size: 13px;
    color: var(--text-secondary);
}

/* Evolution & Accuracy Stats */
.evolution-stats,
.accuracy-stats {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 6px;
    display: flex;
    justify-content: space-around;
}

.stat-item {
    text-align: center;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
    display: block;
    margin-bottom: 4px;
}

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

.stat-value.positive {
    color: #22c55e;
}

.stat-value.negative {
    color: #ef4444;
}

.stat-value.neutral {
    color: #94a3b8;
}

/* Dark theme overrides */
[data-theme="dark"] .prediction-main-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

[data-theme="dark"] .prediction-reasoning {
    background: #0f172a;
}

[data-theme="dark"] .detail-item {
    background: #0f172a;
}

[data-theme="dark"] .evolution-stats,
[data-theme="dark"] .accuracy-stats {
    background: #0f172a;
}
