:root {
    --primary-color: #007bff;
    --primary-hover: #0056b3;
    --bg-light: #f5f5f5;
    --sidebar-bg: #ffffff;
    --border-color: #e0e0e0;
    --text-main: #333333;
    --text-muted: #666666;
    --call-green: #10b981;
    --put-red: #ef4444;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-light);
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-container {
    display: flex;
    flex: 1;
    height: 100%;
    overflow: hidden;
}

/* Sidebar Styles */
.sidebar {
    width: 300px;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
}

.sidebar h2 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: var(--text-main);


    padding-bottom: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider-toggle {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 34px;
}

.slider-toggle:before {
    position: absolute;
    content: "";
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked+.slider-toggle {
    background-color: var(--primary-color);
}

input:checked+.slider-toggle:before {
    transform: translateX(14px);
}

.live-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 5px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.control-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    cursor: pointer;
}

.scrollable-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid #eee;
    padding: 5px;
    border-radius: 4px;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none;  /* IE and Edge */
}

.scrollable-list::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.main-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari and Opera */
}

.btn-group {
    display: flex;
    gap: 5px;
    margin-bottom: 5px;
}

.btn {
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 3px;
    transition: background 0.2s;
}

.btn:hover {
    background: #e0e0e0;
}

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

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

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

/* Main Content Styles */
.main-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.chart-container {
    background: white;
    padding: 20px 20px 15px 20px;
    margin-bottom: 25px; 
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
    min-height: 580px; 
}

.chart-header {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #444;
    border-left: 4px solid var(--primary-color);
    padding-left: 10px;
}

/* Loading Overlay */
#loading {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 20px;
    color: var(--text-muted);
    z-index: 1000;
}

#loading.waiting {
    background: #fff3cd; /* Warm Warning Yellow */
    color: #856404;
    bottom: auto;
    height: 40px;
    font-size: 14px;
    border-bottom: 2px solid #ffeeba;
    box-shadow: 0 2px 10px rgba(133, 100, 4, 0.2);
    pointer-events: none; /* Allow interaction with the elements underneath */
}

/* ── Symbol Selector ─────────────────────────────────────────────────────── */
.symbol-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.exch-btn {
    flex: 1;
    padding: 8px 0;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: #f8f8f8;
    border: none;
    color: var(--text-muted);
    transition: background 0.2s, color 0.2s;
}

.exch-btn:first-child {
    border-right: 1px solid var(--border-color);
}

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

.exch-btn:hover:not(.active) {
    background: #e8e8e8;
}

.symbol-dropdown-wrap {
    position: relative;
}

.symbol-select {
    width: 100%;
    padding: 9px 10px;
    font-size: 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    appearance: auto;
}

.symbol-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.15);
}

/* Keyboard shortcut flash message */
.shortcut-hint {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--primary-color);
    font-style: italic;
    opacity: 0;
    transition: opacity 0.3s;
    min-height: 14px;
}

.shortcut-hint.visible {
    opacity: 1;
}

/* ── Responsive Mobile Styles ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
        overflow-y: auto;
        height: auto;
    }

    .sidebar {
        width: 100%;
        box-sizing: border-box;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
        padding: 15px;
        gap: 15px;
        height: auto;
        overflow-y: visible;
    }

    .main-content {
        padding: 10px;
        height: auto;
        overflow-y: visible;
    }

    .chart-container {
        padding: 10px;
        min-height: 350px;
    }

    .sidebar h2 {
        font-size: 16px;
    }

    /* Small hack for Plotly legends on narrow screens */
    .legend {
        font-size: 10px !important;
    }
}
/* -- Skeleton Loading & Pulse Animations ---------------------------------- */
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton-chart {
    width: 100%;
    height: 480px;
    background: #f0f0f0;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 4px;
    margin-top: 10px;
}

@keyframes pulse {
    0% { opacity: 0.4; }
    50% { opacity: 0.8; }
    100% { opacity: 0.4; }
}

.pulse-text {
    animation: pulse 1.5s infinite ease-in-out;
    background-color: #e3f2fd;
    border-radius: 4px;
    display: inline-block;
}

.skeleton-sidebar {
    height: 20px;
    margin: 8px 0;
    width: 100%;
    background: #f0f0f0;
    background: linear-gradient(90deg, #f0f0f0 25%, #f8f8f8 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite linear;
    border-radius: 3px;
}

/* ── Pulsing Error States ── */
@keyframes error-pulse {
    0% { background-color: #ff5252; box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7); }
    70% { background-color: #ff1744; box-shadow: 0 0 0 10px rgba(255, 82, 82, 0); }
    100% { background-color: #ff5252; box-shadow: 0 0 0 0 rgba(255, 82, 82, 0); }
}

.btn-error-pulse {
    animation: error-pulse 1.5s infinite !important;
    color: white !important;
    border: none !important;
    font-weight: bold !important;
}

.market-holiday-notice {
    background: #fff3e0;
    color: #e65100;
    padding: 10px;
    border-radius: 4px;
    border-left: 4px solid #ff9800;
    margin-bottom: 10px;
    font-size: 13px;
}

