/**
 * Chart Module Styles
 * Styles for the modular chart component
 */

/* Chart Module Wrapper */
.chart-module-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    position: relative;
    background: #1A1A1A;
}

/* Toolbar Container - for chart type switcher and other tools */
.chart-module-toolbar {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: rgba(26, 26, 26, 0.95);
    border-bottom: 1px solid #333;
    min-height: 0;
    flex-shrink: 0;
}

/* Hide toolbar if empty */
.chart-module-toolbar:empty {
    display: none;
}

/* Main Chart Container */
.chart-module-main {
    flex: 1;
    min-height: 100px;
    position: relative;
}

/* Squeeze Panel */
.chart-module-squeeze {
    height: 120px;
    min-height: 60px;
    max-height: 50%;
    position: relative;
}

/* Resizer Handle */
.chart-module-resizer {
    height: 8px;
    background: #252525;
    cursor: row-resize;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-module-resizer::before {
    content: '';
    width: 40px;
    height: 3px;
    background: #444;
    border-radius: 2px;
}

.chart-module-resizer:hover {
    background: #333;
}

.chart-module-resizer:hover::before {
    background: #666;
}

/* Countdown Timer - positioned near price scale */
.chart-module-countdown {
    position: absolute;
    bottom: 28px;
    right: 90px;
    background: rgba(220, 53, 69, 0.95);
    color: white;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-family: 'Roboto Mono', monospace;
    font-weight: 600;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    letter-spacing: 0.5px;
}

/* Scroll to Latest Button */
.chart-module-scroll-btn {
    position: absolute;
    bottom: 80px;
    right: 100px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary, #2a2a2a);
    border: 1px solid var(--border, #3a3a3a);
    border-radius: 50%;
    color: var(--text-secondary, #888);
    cursor: pointer;
    transition: all 0.2s ease;
    opacity: 0;
    visibility: hidden;
    z-index: 50;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.chart-module-scroll-btn.visible {
    opacity: 1;
    visibility: visible;
}

.chart-module-scroll-btn:hover {
    background: var(--accent, #E4A700);
    border-color: var(--accent, #E4A700);
    color: var(--bg-primary, #121212);
    transform: scale(1.05);
}

.chart-module-scroll-btn svg {
    pointer-events: none;
}

/* Interval Buttons Container */
.chart-module-intervals {
    display: flex;
    gap: 4px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
}

/* Interval Button */
.chart-module-interval-btn {
    padding: 4px 10px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.chart-module-interval-btn:hover {
    background: #333;
    color: #fff;
    border-color: #444;
}

.chart-module-interval-btn.active {
    background: var(--primary-color, #2196F3);
    color: white;
    border-color: var(--primary-color, #2196F3);
}

/* Loading State */
.chart-module-wrapper.loading .chart-module-main::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #666;
    font-size: 14px;
}

/* Error State */
.chart-module-wrapper.error .chart-module-main::after {
    content: 'Error loading chart';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #ff5252;
    font-size: 14px;
}

/* ========================================================================
   Split Screen Layout
   ======================================================================== */

.split-screen-container {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
}

.split-screen-container.active {
    display: flex;
    gap: 2px;
}

/* Split Panel */
.split-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #1a1a1a;
    min-width: 0;
    position: relative;
    overflow: hidden;
}

/* Split Panel Header */
.split-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: #222;
    border-bottom: 1px solid #333;
    min-height: 40px;
}

.split-panel-title {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Split Panel Intervals */
.split-panel-intervals {
    display: flex;
    gap: 4px;
}

.split-interval-btn {
    padding: 4px 10px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #888;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

.split-interval-btn:hover {
    background: #333;
    color: #fff;
    border-color: #444;
}

.split-interval-btn.active {
    background: var(--primary-color, #2196F3);
    color: white;
    border-color: var(--primary-color, #2196F3);
}

/* Split Panel Content */
.split-panel-content {
    flex: 1;
    position: relative;
    overflow: hidden;
}

/* Chart Wrapper in Split Panel */
.split-chart-wrapper {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Split Divider */
.split-divider {
    width: 2px;
    background: #333;
    cursor: col-resize;
}

.split-divider:hover {
    background: #555;
}

/* ========================================================================
   Responsive Adjustments
   ======================================================================== */

@media (max-width: 1200px) {
    .split-panel-header {
        padding: 6px 8px;
        min-height: 36px;
    }

    .split-panel-title {
        font-size: 11px;
    }

    .split-interval-btn {
        padding: 3px 8px;
        font-size: 10px;
    }

    .chart-module-countdown {
        font-size: 10px;
        padding: 2px 6px;
        bottom: 26px;
    }

    .chart-module-scroll-btn {
        width: 32px;
        height: 32px;
        bottom: 70px;
        right: 90px;
    }

    .chart-module-scroll-btn svg {
        width: 16px;
        height: 16px;
    }
}

@media (max-width: 768px) {
    .split-screen-container.active {
        flex-direction: column;
    }

    .split-divider {
        width: 100%;
        height: 2px;
        cursor: row-resize;
    }

    .split-panel {
        min-height: 200px;
    }
}
