/* Dark Elegant Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: #0b0f19;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* Firefox Support */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) #0b0f19;
}

/* Global Reset & Colors */
:root {
    --bg-main: #0B0F19;
    --bg-card: rgba(22, 30, 49, 0.7);
    --bg-header: #111625;
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f3f4f6;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    
    --color-ce: #00e676; /* Bullish green */
    --color-ce-bg: rgba(0, 230, 118, 0.05);
    --color-ce-hover: rgba(0, 230, 118, 0.1);
    
    --color-pe: #ff1744; /* Bearish red */
    --color-pe-bg: rgba(255, 23, 68, 0.05);
    --color-pe-hover: rgba(255, 23, 68, 0.1);
    
    --color-accent: #3b82f6; /* Accent blue */
    --color-accent-bg: rgba(59, 130, 246, 0.15);
    --color-warning: #f59e0b;
    
    --font-family: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-family);
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    height: 100vh;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header Navbar */
.header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--border-color);
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10;
}

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

.brand-icon {
    font-size: 24px;
    color: var(--color-ce);
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.2;
}

.logo-text span {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

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

.control-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.control-item label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.styled-select {
    background-color: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 12px;
    border-radius: 4px;
    font-weight: 500;
    outline: none;
    cursor: pointer;
    transition: all 0.2s;
}

.styled-select option,
.form-control option {
    background-color: #1a1f2e;
    color: #f3f4f6;
}

.styled-select optgroup {
    background-color: #111625;
    color: #f59e0b;
    font-style: normal;
    font-weight: 700;
    font-size: 11px;
    letter-spacing: 0.5px;
}

.styled-select:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

/* Custom Dropdown Styling */
.custom-dropdown {
    position: relative;
    width: 200px;
    z-index: 100;
}

.custom-dropdown-btn {
    width: 100%;
    background: rgba(22, 30, 49, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 7px 12px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 13px;
    text-align: left;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    font-family: var(--font-family);
}

.custom-dropdown-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.custom-dropdown-btn:focus {
    outline: none;
    border-color: var(--color-accent);
}

.custom-dropdown-btn .dropdown-arrow {
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.2s ease;
}

.custom-dropdown.open .custom-dropdown-btn .dropdown-arrow {
    transform: rotate(180deg);
    color: var(--color-accent);
}

.custom-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 100%;
    max-height: 350px;
    background: rgba(17, 22, 37, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transform: translateY(-8px);
    pointer-events: none;
    transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1), transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 6px 0;
}

.custom-dropdown.open .custom-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.custom-dropdown-group-title {
    padding: 8px 14px 4px;
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-warning);
    font-weight: 700;
    letter-spacing: 0.8px;
}

.custom-dropdown-item {
    padding: 8px 14px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s ease;
}

.custom-dropdown-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #ffffff;
    padding-left: 18px;
}

.custom-dropdown-item.selected {
    background: var(--color-accent-bg);
    color: var(--text-primary);
    font-weight: 600;
    border-left: 3px solid var(--color-accent);
}

.custom-dropdown-item .selected-indicator {
    display: none;
}

.custom-dropdown-item.selected .selected-indicator {
    display: inline-block;
    color: var(--color-accent);
    font-size: 11px;
}


/* Badges */
.status-indicators {
    display: flex;
    gap: 10px;
}

.badge {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    letter-spacing: 0.5px;
}

.badge-mock {
    background-color: rgba(59, 130, 246, 0.15);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.badge-live {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
    animation: pulse 2s infinite;
}

.badge-connected {
    background-color: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-disconnected {
    background-color: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

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

/* KPI Cards */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    padding: 8px 24px;
}

.kpi-card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 10px 14px;
    backdrop-filter: blur(10px);
    transition: transform 0.2s, box-shadow 0.2s;
}

.kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.kpi-value {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 2px;
}

.kpi-change {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Color definitions for KPI icons/text */
.icon-spot { color: #f59e0b; }
.icon-pcr { color: var(--color-accent); }
.icon-ce { color: var(--color-ce); }
.icon-pe { color: var(--color-pe); }
.icon-trend { color: #8b5cf6; }

.text-ce { color: var(--color-ce); }
.text-pe { color: var(--color-pe); }
.text-accent { color: var(--color-accent); }
.text-positive { color: var(--color-ce); }
.text-negative { color: var(--color-pe); }

/* Main Chart Section */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0 24px 8px 24px;
    min-height: 0;
    overflow: hidden;
}

.chart-container-wrapper {
    flex: 1;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px 16px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.chart-legend {
    display: flex;
    gap: 14px;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.03);
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legend-value {
    color: #ffffff;
    font-weight: 600;
}

.chart-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.chart-pane {
    flex: 4;
    width: 100%;
    min-height: 280px;
}

.chart-pane-oi {
    flex: 1.8;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 4px;
    min-height: 150px;
}

.chart-pane-indicator {
    flex: 1.3;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 4px;
    min-height: 110px;
    position: relative;
}

#cvd-chart {
    flex: 2.2;
    min-height: 180px;
}

.indicator-pane-label {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    z-index: 5;
    pointer-events: none;
    text-transform: uppercase;
}

/* Tabs & F&O Details Section */
.details-section {
    padding: 0 24px 12px 24px;
    display: flex;
    flex-direction: column;
    height: 200px;
    flex-shrink: 0;
}

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

.tabs-buttons-group {
    display: flex;
    gap: 8px;
}

.collapse-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    outline: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.collapse-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.collapse-btn i {
    transition: transform 0.2s;
}

.details-section.collapsed .collapse-btn i {
    transform: rotate(180deg);
}

.details-section.collapsed {
    height: 38px !important;
}

.details-section.collapsed .tab-content-container {
    display: none !important;
}

.tab-btn {
    background: none;
    border: none;
    outline: none;
    color: var(--text-secondary);
    padding: 6px 12px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

.tab-btn.active {
    color: var(--color-accent);
    border-bottom-color: var(--color-accent);
}

.tab-content-container {
    flex: 1;
    overflow: hidden;
}

.tab-content {
    display: none;
    height: 100%;
}

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

/* Option Chain Table */
.table-wrapper {
    height: 100%;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.option-chain-table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    font-size: 12px;
}

.option-chain-table th {
    position: sticky;
    top: 0;
    background-color: var(--bg-header);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 6px 8px;
    border-bottom: 1px solid var(--border-color);
    z-index: 2;
}

.option-chain-table td {
    padding: 5px 8px;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.03);
    font-family: 'Courier New', Courier, monospace;
    font-weight: 500;
}

.table-super-header th {
    text-align: center;
    font-size: 13px;
    letter-spacing: 1px;
}

.ce-super-header {
    background-color: rgba(0, 230, 118, 0.08) !important;
    color: var(--color-ce) !important;
}

.pe-super-header {
    background-color: rgba(255, 23, 68, 0.08) !important;
    color: var(--color-pe) !important;
}

.strike-super-header {
    background-color: #111625 !important;
    color: #f59e0b !important;
}

.option-chain-table tr:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.option-chain-table tr.atm-strike {
    background-color: rgba(245, 158, 11, 0.08);
}

.option-chain-table tr.atm-strike td {
    border-top: 1.5px solid var(--color-warning);
    border-bottom: 1.5px solid var(--color-warning);
    font-weight: 700;
}

.strike-col {
    text-align: center !important;
    font-weight: 700 !important;
    background-color: rgba(255, 255, 255, 0.02);
    color: #f59e0b;
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.ce-in-the-money {
    background-color: rgba(0, 230, 118, 0.02);
}

.pe-in-the-money {
    background-color: rgba(255, 23, 68, 0.02);
}

.high-oi {
    font-weight: 700 !important;
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.04);
}

.no-data {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Distribution Chart Bars */
.distribution-chart-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 16px;
}

.dist-chart-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
    font-weight: 600;
}

.legend {
    display: flex;
    gap: 16px;
    font-size: 12px;
}

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

.legend-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.ce-box { background-color: var(--color-ce); }
.pe-box { background-color: var(--color-pe); }

.oi-dist-bars-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow-y: auto;
}

.dist-row {
    display: grid;
    grid-template-columns: 100px 1fr 60px 1fr 100px;
    align-items: center;
    gap: 8px;
    font-size: 11px;
}

.dist-strike {
    text-align: center;
    font-weight: 600;
    color: var(--color-warning);
}

.dist-bar-ce-container, .dist-bar-pe-container {
    height: 14px;
    background-color: rgba(255, 255, 255, 0.03);
    border-radius: 2px;
    overflow: hidden;
    display: flex;
}

.dist-bar-ce-container {
    justify-content: flex-end;
}

.dist-bar-ce {
    background-color: var(--color-ce);
    height: 100%;
    border-radius: 2px 0 0 2px;
}

.dist-bar-pe {
    background-color: var(--color-pe);
    height: 100%;
    border-radius: 0 2px 2px 0;
}

.dist-val-ce {
    text-align: right;
    color: var(--color-ce);
}

.dist-val-pe {
    text-align: left;
    color: var(--color-pe);
}

/* Multi Strike Tracker */
.multi-strike-wrapper {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    height: 100%;
}

.multi-strike-controls {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
    overflow-y: auto;
}

.multi-strike-controls h4 {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    text-transform: uppercase;
}

.checkbox-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.checkbox-item {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 11px;
}

.checkbox-item input {
    cursor: pointer;
}

.multi-strike-chart-container {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px;
}

.small-chart {
    width: 100%;
    height: 100%;
}

/* Footer styling */
.footer {
    background-color: var(--bg-header);
    border-top: 1px solid var(--border-color);
    padding: 8px;
    text-align: center;
    font-size: 10px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    outline: none;
    font-size: 12px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

.btn-secondary {
    background-color: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.timeframe-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 4px 10px;
    font-size: 11px;
    border-radius: 4px;
    font-weight: 500;
    cursor: pointer;
    margin-left: 4px;
}

.timeframe-btn.active {
    background-color: var(--color-accent-bg);
    color: var(--color-accent);
    border-color: var(--color-accent);
}

/* Indicator Controls Dropdown */
.indicator-controls {
    position: relative;
    display: flex;
    align-items: center;
    margin-right: 12px;
}

.indicator-dropdown {
    position: relative;
}

.indicator-toggle-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-family: var(--font-family);
}

.indicator-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.indicator-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: #1a1d27;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 10px 14px;
    min-width: 220px;
    max-height: 400px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.indicator-dropdown-menu.open {
    display: block;
}

.indicator-section-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.indicator-sub-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--color-accent);
    margin: 6px 0 4px 0;
    padding-left: 2px;
    letter-spacing: 0.5px;
}

.indicator-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 3px 0;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.15s;
}

.indicator-checkbox:hover {
    color: #ffffff;
}

.indicator-checkbox input[type="checkbox"] {
    accent-color: var(--color-accent);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

.indicator-color-dot {
    width: 14px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
    flex-shrink: 0;
}

/* Modal Popup Window */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: var(--bg-header);
    margin: 10% auto;
    padding: 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    width: 500px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

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

.modal-header h2 {
    font-size: 16px;
    font-weight: 600;
}

.close-btn {
    color: var(--text-secondary);
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

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

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

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

.form-control {
    background-color: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    outline: none;
    font-size: 12px;
    width: 100%;
}

select.form-control {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 32px;
    cursor: pointer;
}

.form-control:focus {
    border-color: var(--color-accent);
}

.section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--color-warning);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 4px;
    margin-top: 10px;
}

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

.live-settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Mobile Responsive Overrides (Screen width <= 768px) */
@media screen and (max-width: 768px) {
    /* Let the page scroll naturally instead of locking to 100vh */
    body {
        height: auto;
        overflow-y: auto;
    }
    
    .app-container {
        height: auto;
        min-height: 100vh;
    }
    
    /* Stack header contents vertically */
    .header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px 16px;
    }
    
    .controls-group {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .control-item {
        width: 100%;
    }
    
    .styled-select {
        width: 100%;
    }
    
    .status-indicators {
        width: 100%;
        justify-content: flex-start;
        margin-top: 4px;
    }
    
    /* KPI Grid: Change from 5 columns to 2 columns, letting sentiment card span full width */
    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding: 8px 16px;
    }
    
    #card-trend {
        grid-column: span 2;
    }
    
    /* Main Content container: remove hidden overflow, set natural padding */
    .main-content {
        padding: 0 16px 8px 16px;
        height: auto;
        min-height: 600px;
        overflow: visible;
        flex: none;
    }
    
    /* Chart wrapper: let it resize automatically to fit dynamic content height */
    .chart-container-wrapper {
        height: auto;
        flex: none;
        overflow: hidden;
        padding: 10px 10px 12px 10px;
    }
    
    /* Header bar layout on mobile */
    .chart-header-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .timeframe-selector {
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 4px;
        width: 100%;
        display: flex;
        justify-content: flex-start;
    }
    
    .chart-legend {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        white-space: normal;
        overflow-x: visible;
        padding: 6px 8px;
        gap: 6px 10px;
        font-size: 10px;
    }
    
    /* Set fixed minimum heights for charts so they are visible and usable */
    .chart-pane {
        height: 300px;
        flex: none;
    }
    
    .chart-pane-oi {
        height: 140px;
        flex: none;
    }

    .chart-pane-indicator {
        height: 100px;
        flex: none;
    }

    #cvd-chart {
        height: 160px;
        flex: none;
    }
    
    /* Details tab section: let it stack below the charts naturally */
    .details-section {
        height: 350px;
        flex-shrink: 0;
        padding: 0 16px 20px 16px;
    }
    
    .tabs-header {
        overflow-x: auto;
        white-space: nowrap;
        display: flex;
    }
    
    .tab-btn {
        flex-shrink: 0;
    }
}

/* Stats Layout Container */
.stats-layout-container {
    display: flex;
    gap: 16px;
    height: 100%;
    align-items: stretch;
}

.price-range-card {
    flex-shrink: 0;
    width: 280px;
    background: rgba(255, 255, 255, 0.015);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-sizing: border-box;
}

.price-range-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.price-range-bar-wrapper {
    position: relative;
    width: 100%;
    height: 6px;
    margin-bottom: 10px;
}

.price-range-bar-gradient {
    width: 100%;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(to right, #ff4d4d 0%, #ffaf40 35%, #ffec3d 65%, #2ed573 100%);
}

.price-range-pin {
    position: absolute;
    top: -5px;
    width: 4px;
    height: 16px;
    background-color: #e5e7eb;
    border: 1px solid #9ca3af;
    border-radius: 2px;
    transform: translateX(-50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    z-index: 10;
    transition: left 0.15s ease-out;
}

.price-range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    font-family: 'Courier New', Courier, monospace;
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .stats-layout-container {
        flex-direction: column;
        height: auto;
    }
    .price-range-card {
        width: 100%;
        margin-bottom: 12px;
    }
}

/* Fix stats curve table header vertical overlap by disabling stickiness & style it sleek */
#stats-history-table th {
    position: static !important;
}

#stats-history-table {
    border-collapse: collapse;
    width: 100%;
}

#stats-history-table th {
    font-family: var(--font-family) !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px !important;
    text-transform: uppercase !important;
    padding: 6px 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
    background-color: rgba(255, 255, 255, 0.02) !important;
}

#stats-history-table td {
    font-family: var(--font-family) !important;
    font-variant-numeric: tabular-nums !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    padding: 5px 10px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
    vertical-align: middle !important;
    color: var(--text-primary) !important;
}

#stats-history-table tr:hover {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

#stats-history-table .ce-super-header {
    background-color: rgba(16, 185, 129, 0.06) !important;
    color: #10B981 !important;
    font-weight: 700 !important;
}

#stats-history-table .pe-super-header {
    background-color: rgba(239, 68, 68, 0.06) !important;
    color: #EF4444 !important;
    font-weight: 700 !important;
}

/* PIN Modal Specifics */
.pin-modal-content {
    width: 320px !important;
    background: rgba(17, 24, 39, 0.85) !important;
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6) !important;
    padding: 30px 24px !important;
    margin: 12% auto !important;
    text-align: center;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.pin-header {
    margin-bottom: 20px;
}

.pin-lock-icon {
    font-size: 36px;
    color: var(--color-pe) !important; /* Sleek red indicator */
    margin-bottom: 12px;
    filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));
    animation: pin-pulse 2s infinite;
}

@keyframes pin-pulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.4));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 0 14px rgba(239, 68, 68, 0.7));
    }
}

.pin-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary) !important;
    margin-bottom: 6px;
    margin-top: 0;
}

.pin-header p {
    font-size: 11px;
    color: var(--text-secondary) !important;
    line-height: 1.4;
    padding: 0 10px;
    margin: 0;
}

.pin-dots-container {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
    justify-content: center;
}

.pin-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.pin-dot.filled {
    background-color: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    box-shadow: 0 0 8px var(--color-accent);
    transform: scale(1.2);
}

.pin-dot.error {
    background-color: var(--color-pe) !important;
    border-color: var(--color-pe) !important;
    box-shadow: 0 0 8px var(--color-pe);
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    width: 100%;
    max-width: 240px;
    margin-bottom: 24px;
}

.pin-key {
    background: rgba(255, 255, 255, 0.03) !important;
    border: 1px solid rgba(255, 255, 255, 0.05) !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;
    font-size: 18px !important;
    font-weight: 500 !important;
    color: var(--text-primary) !important;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    padding: 0 !important;
}

.pin-key:hover {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
    transform: scale(1.05);
}

.pin-key:active {
    background: var(--color-accent) !important;
    border-color: var(--color-accent) !important;
    color: #000 !important;
    transform: scale(0.95);
}

.pin-key.btn-clear, .pin-key.btn-backspace {
    font-size: 15px !important;
    color: var(--text-secondary) !important;
}

.pin-key.btn-clear:hover, .pin-key.btn-backspace:hover {
    color: var(--text-primary) !important;
}

.pin-actions {
    width: 100%;
    max-width: 240px;
}

/* Error Shake Animation */
.error-shake {
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

