:root {
    --bg-body: #f3f4f6;
    --bg-card: #ffffff;
    --text-main: #111827;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --accent-color: #3b82f6;
    --success-color: #10b981;
    --closed-color: #9ca3af;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

[data-theme="dark"] {
    --bg-body: #0f172a; /* Slate 900 */
    --bg-card: #1e293b; /* Slate 800 */
    --text-main: #f8fafc; /* Slate 50 */
    --text-muted: #94a3b8; /* Slate 400 */
    --border-color: #334155; /* Slate 700 */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1200px; /* Increased from 800px */
    background: transparent;
}

/* Header */
.header {
    margin-bottom: 3rem; /* Increased spacing below header */
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
}

.header-left {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
}

.settings-bar {
    display: none; /* Removed from header */
}

.select-wrapper {
    position: relative;
}

.timezone-select {
    appearance: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.4rem 2rem 0.4rem 0.75rem;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
}

.timezone-select:hover {
    border-color: var(--text-muted);
}

.timezone-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

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

.btn-icon, .btn-text {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover, .btn-text:hover {
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn-text {
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    min-width: 40px;
}

/* Icons are handled by JS now */

h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.025em;
    line-height: 1;
}

.header-right {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.volume-card, .time-group {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.volume-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1;
    margin-top: 0.25rem;
}

.volume-value.low { color: var(--text-muted); }
.volume-value.medium { color: var(--accent-color); }
.volume-value.high { color: var(--success-color); }
.volume-value.very-high { color: #ef4444; }

.time-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.05em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.clock {
    font-size: 2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
    color: var(--text-main);
}

.date {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Schedule Layout */
.schedule-container {
    background: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: visible; /* Changed from hidden to allow tooltip */
    position: relative;
    --sidebar-width: 280px;
    --row-height: 80px;
}

.timeline-header {
    display: flex;
    height: 60px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-body);
    border-radius: 12px 12px 0 0; /* Clip top corners */
}

.header-spacer {
    width: var(--sidebar-width);
    flex-shrink: 0;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 1.5rem;
}

.timeline-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    overflow: hidden;
}

.timezone-select {
    appearance: none;
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.3rem 1.5rem 0.3rem 0.5rem;
    border-radius: 6px;
    font-family: var(--font-family);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.25rem center;
    background-repeat: no-repeat;
    background-size: 1.2em 1.2em;
    min-width: 0;
    flex: 1 1 auto;
    max-width: 120px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timezone-offset {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.select-wrapper {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 120px;
}

.timezone-display {
    display: none;
}

.timeline-axis-container {
    flex-grow: 1;
    position: relative;
    display: flex;
    align-items: center;
    margin: 0;
    padding: 0;
    overflow: visible;
}

.axis-label {
    position: absolute;
    transform: translateX(-50%);
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    top: 24px; /* Push numbers down */
    white-space: nowrap;
}

.axis-icon {
    position: absolute;
    top: -20px; /* Move icon UP out of the timeline flow */
    font-size: 1rem;
    opacity: 0.8;
}

.axis-icon {
    font-size: 0.85rem;
    opacity: 0.7;
}

/* Rows */
.session-row {
    display: flex;
    height: var(--row-height);
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.session-info {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 0 1.5rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.flag-icon {
    font-size: 2rem;
    line-height: 1;
    width: 40px;
    text-align: center;
}

.flag-icon span {
    border-radius: 4px; /* Rounded corners for flags */
    display: inline-block; /* Ensure transform works if needed */
    overflow: hidden;
}

.session-details h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.25rem;
}

.session-time {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 0.1rem;
}

.session-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

/* DST Badges */
.dst-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    margin-left: 0.5rem;
    vertical-align: middle;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    position: relative;
    cursor: help;
}

.dst-badge.dst-active {
    background: rgba(234, 179, 8, 0.15);
    color: #ca8a04;
    border: 1px solid rgba(234, 179, 8, 0.3);
}

.dst-badge.dst-inactive {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Tooltip Styles */
.dst-badge .tooltip-content {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 12px;
    border-radius: 8px;
    width: max-content;
    min-width: 180px;
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.1), 
        0 4px 6px -2px rgba(0, 0, 0, 0.05),
        0 0 0 1px rgba(0, 0, 0, 0.05);
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
    z-index: 100;
    text-transform: none;
    text-align: left;
    margin-bottom: 8px;
    color: var(--text-main);
    border: 1px solid var(--border-color);
}

[data-theme="dark"] .dst-badge .tooltip-content {
    background: rgba(30, 41, 59, 0.95);
    box-shadow: 
        0 10px 15px -3px rgba(0, 0, 0, 0.3), 
        0 4px 6px -2px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.1);
}

.dst-badge:hover .tooltip-content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

/* Tooltip Arrow */
.dst-badge .tooltip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -6px;
    border-width: 6px;
    border-style: solid;
    border-color: var(--bg-card) transparent transparent transparent;
}

.dst-badge .tooltip-content::after {
    border-top-color: rgba(255, 255, 255, 0.95);
}
[data-theme="dark"] .dst-badge .tooltip-content::after {
    border-top-color: rgba(30, 41, 59, 0.95);
}

.tooltip-header {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 4px;
    display: block;
}

.tooltip-desc {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
    line-height: 1.3;
}

.tooltip-time {
    font-size: 0.7rem;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    color: var(--accent-color);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 6px;
    border-radius: 4px;
    display: block;
    text-align: center;
}

[data-theme="dark"] .dst-badge.dst-active {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
}

[data-theme="dark"] .dst-badge.dst-inactive {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.session-track {
    flex-grow: 1;
    position: relative;
    /* Grid lines for 24 hours */
    background-image: linear-gradient(to right, var(--border-color) 1px, transparent 1px);
    background-size: calc(100% / 24) 100%;
}

/* Bars */
.timeline-bar {
    position: absolute;
    height: 40px;
    top: 20px;
    border-radius: 4px;
    /* background-color set inline */
}

.bar-label {
    position: absolute;
    top: -18px;
    left: 0;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    pointer-events: none;
}

/* Market Status Dashboard */
.market-status-card {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    margin-bottom: 3rem; /* Increased spacing below market status */
    margin-top: 1rem; /* Added gap above */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.status-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.status-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

.status-value.low { color: var(--text-muted); }
.status-value.medium { color: var(--accent-color); }
.status-value.high { color: var(--success-color); }
.status-value.very-high { color: #ef4444; }

.status-value.highlight {
    color: var(--accent-color);
}

/* Volume Row */
.volume-row {
    display: flex;
    height: 100px; /* Reduced height */
    background: var(--bg-card);
    border-radius: 0 0 12px 12px; /* Clip bottom corners */
}

.volume-info {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 0 1.5rem;
    border-right: 1px solid var(--border-color);
    display: flex;
    align-items: center;
}

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

.volume-label {
    font-size: 0.875rem;
    color: var(--text-main);
}

.volume-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.volume-pill.low { background: #f3f4f6; color: var(--text-muted); }
.volume-pill.medium { background: #dbeafe; color: #1e40af; }
.volume-pill.high { background: #dcfce7; color: #166534; }
.volume-pill.very-high { background: #fee2e2; color: #991b1b; }

/* Dark theme adjustments */
[data-theme="dark"] .volume-pill.low { background: #334155; color: #94a3b8; }
[data-theme="dark"] .volume-pill.medium { background: #1e3a8a; color: #bfdbfe; }
[data-theme="dark"] .volume-pill.high { background: #14532d; color: #bbf7d0; }
[data-theme="dark"] .volume-pill.very-high { background: #7f1d1d; color: #fecaca; }

.volume-track {
    flex-grow: 1;
    position: relative;
    /* Gridlines removed */
}

.volume-svg {
    width: 100%;
    height: 100%;
    display: block;
    overflow: visible;
}

.volume-svg path {
    transition: d 0.8s cubic-bezier(0.25, 1, 0.5, 1); /* Smooth morphing */
}

.volume-svg stop {
    transition: stop-color 0.5s ease;
}

/* Cursor Overlay */
.cursor-overlay {
    position: absolute;
    top: 0;
    bottom: 0;
    left: var(--sidebar-width);
    right: 0;
    pointer-events: auto; /* Allow clicking anywhere */
    cursor: col-resize;
    overflow: visible; /* Allow tooltip to spill out */
    z-index: 50; /* Ensure it's above everything */
}

.cursor-line {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: #8b5cf6;
    z-index: 20;
    transition: left 0.05s linear;
    pointer-events: none;
}

.cursor-handle {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 12px;
    height: 12px;
    background: #8b5cf6;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--bg-card);
}

.cursor-handle.top { top: -6px; }
.cursor-handle.bottom { bottom: -6px; }

.cursor-time-tooltip {
    position: absolute;
    top: -60px; /* Moved higher */
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    color: var(--text-main);
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: 1px solid var(--border-color);
    pointer-events: none;
    opacity: 0; /* Hidden by default */
    transition: opacity 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    z-index: 100; /* Very high z-index */
}

.cursor-time-tooltip::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    transform: translateX(-50%) rotate(45deg);
}

.tooltip-time {
    font-size: 0.9rem;
    font-weight: 700;
}

.tooltip-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Only show when scrubbing */
.cursor-overlay.scrubbing .cursor-time-tooltip {
    opacity: 1;
}

/* Hide old elements */
.sessions-grid, .timeline-container {
    display: none;
}

.current-time-marker {
    position: absolute;
    top: 0;
    width: 2px;
    background-color: #ef4444;
    z-index: 10;
    pointer-events: none;
    transition: left 0.1s linear; /* Smooth movement */
}

.current-time-marker.scrubbing {
    background-color: var(--accent-color);
    width: 2px;
    box-shadow: 0 0 8px var(--accent-color);
}

.current-time-marker::after {
    content: 'NOW';
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.6rem;
    background: #ef4444;
    color: white;
    padding: 2px 4px;
    border-radius: 2px;
    white-space: nowrap;
}

.current-time-marker.scrubbing::after {
    content: attr(data-time);
    background: var(--accent-color);
}
