/**
 * Quick Chart - Full-screen chart modal styles
 * TradingView-inspired dark theme
 */

/* Modal overlay */
.quick-chart-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.quick-chart-modal.active {
    display: flex;
}

/* Main container - 95% viewport */
.quick-chart-container {
    width: 95vw;
    height: 95vh;
    max-width: 1920px;
    background: #131722;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

/* Header bar */
.quick-chart-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: #1e222d;
    border-bottom: 1px solid #2a2e39;
    gap: 16px;
    flex-shrink: 0;
}

/* Ticker symbol */
.quick-chart-ticker {
    font-size: 24px;
    font-weight: 700;
    color: #d1d4dc;
    letter-spacing: 0.5px;
    min-width: 100px;
}

/* Controls container */
.quick-chart-controls {
    display: flex;
    gap: 8px;
}

/* Dropdown selects */
.quick-chart-select {
    background: #2a2e39;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s, background-color 0.2s;
}

.quick-chart-select:hover {
    border-color: #4a4e59;
    background: #363a45;
}

.quick-chart-select:focus {
    border-color: #2196f3;
}

/* Toggle buttons */
.quick-chart-toggles {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

.quick-chart-toggle {
    background: #2a2e39;
    color: #787b86;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-chart-toggle:hover {
    background: #363a45;
    color: #d1d4dc;
}

.quick-chart-toggle.active {
    background: #2196f3;
    color: white;
    border-color: #2196f3;
}

/* Help button */
.quick-chart-help {
    background: #2a2e39;
    border: 1px solid #4a4e59;
    color: #d1d4dc;  /* Brighter text for better visibility */
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 14px;
    font-weight: 700;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.quick-chart-help:hover {
    background: #363a45;
    color: #ffffff;
    border-color: #6b7280;
}

/* Close button */
.quick-chart-close {
    background: none;
    border: none;
    color: #787b86;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 8px;
}

.quick-chart-close:hover {
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
}

/* Chart body - uses flexbox for main chart + oscillator stacking */
.quick-chart-body {
    flex: 1;
    position: relative;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* Main chart wrapper - takes remaining space above oscillator */
.quick-chart-main-wrapper {
    flex: 1;
    position: relative;
    min-height: 0;
    overflow: visible;
    /* V430: Reserve space at bottom for time axis labels */
    padding-bottom: 50px;
}

/* Loading overlay */
.quick-chart-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #131722;
    color: #787b86;
    gap: 16px;
    z-index: 10;
}

/* Spinner animation */
.quick-chart-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #2a2e39;
    border-top-color: #2196f3;
    border-radius: 50%;
    animation: quick-chart-spin 1s linear infinite;
}

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

/* Responsive adjustments */
@media (max-width: 768px) {
    .quick-chart-container {
        width: 100vw;
        height: 100vh;
        border-radius: 0;
    }

    .quick-chart-header {
        flex-wrap: wrap;
        padding: 8px 12px;
    }

    .quick-chart-ticker {
        font-size: 20px;
        min-width: 80px;
    }

    .quick-chart-select {
        padding: 5px 8px;
        font-size: 13px;
    }

    .quick-chart-toggle {
        padding: 5px 10px;
        font-size: 12px;
    }
}

/* Dark scrollbar for chart tooltip if any */
.quick-chart-body ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.quick-chart-body ::-webkit-scrollbar-track {
    background: #1e222d;
}

.quick-chart-body ::-webkit-scrollbar-thumb {
    background: #363a45;
    border-radius: 4px;
}

.quick-chart-body ::-webkit-scrollbar-thumb:hover {
    background: #4a4e59;
}

/* Trade marker tooltips (if implemented) */
.quick-chart-tooltip {
    position: absolute;
    background: #2a2e39;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 13px;
    color: #d1d4dc;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    pointer-events: none;
    z-index: 100;
    white-space: nowrap;
}

.quick-chart-tooltip .value {
    font-weight: 600;
    color: #26a69a;
}

.quick-chart-tooltip .darkpool {
    color: #ff9800;
}

.quick-chart-tooltip .lit {
    color: #2196f3;
}

/* Hide TradingView branding/logo - ONLY target the specific watermark link
 * IMPORTANT: Do NOT use broad table selectors that could hide the time axis
 */
.quick-chart-body a[href*="tradingview"],
.quick-chart-body [class*="apply-overflow-tooltip"] a {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Target the TV watermark link container - ONLY target href="tradingview" links */
.quick-chart-body div[style*="position: absolute"] a[href*="tradingview"] {
    display: none !important;
}

/* V430: Force the TV Lightweight Charts container to show time axis */
/* The chart creates a table structure - ensure the bottom row (time axis) is visible */
.quick-chart-main-wrapper > div {
    /* The LC container div */
    overflow: visible !important;
}

.quick-chart-main-wrapper table {
    /* The main chart table */
    overflow: visible !important;
}

/* Target the time axis row specifically - it's the last row */
.quick-chart-main-wrapper tr:last-child {
    height: 30px !important;
    min-height: 30px !important;
}

.quick-chart-main-wrapper tr:last-child td {
    height: 30px !important;
    min-height: 30px !important;
    vertical-align: top !important;
}

/* Ensure the tv-lightweight-charts container doesn't clip */
.tv-lightweight-charts {
    overflow: visible !important;
}

/* Force all canvases to be visible */
.quick-chart-main-wrapper canvas {
    visibility: visible !important;
    opacity: 1 !important;
}

/* ========================================
   Settings Slideout Panel
   ======================================== */
.quick-chart-settings-panel {
    position: absolute;
    top: 0;
    right: -320px;
    width: 300px;
    height: 100%;
    background: #1e222d;
    border-left: 1px solid #2a2e39;
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
}

.quick-chart-settings-panel.open {
    right: 0;
}

.quick-chart-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border-bottom: 1px solid #2a2e39;
}

.quick-chart-settings-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #d1d4dc;
}

.quick-chart-settings-close {
    background: transparent;
    border: none;
    color: #787b86;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
}

.quick-chart-settings-close:hover {
    background: rgba(239, 83, 80, 0.2);
    color: #ef5350;
}

.quick-chart-settings-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.quick-chart-settings-section {
    margin-bottom: 24px;
}

.quick-chart-settings-section:last-child {
    margin-bottom: 0;
}

.quick-chart-settings-section-title {
    font-size: 11px;
    font-weight: 600;
    color: #787b86;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Radio button group for chart type */
.quick-chart-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quick-chart-radio-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: #2a2e39;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-chart-radio-option:hover {
    background: #363a45;
}

.quick-chart-radio-option.selected {
    background: rgba(33, 150, 243, 0.2);
    border: 1px solid #2196f3;
}

.quick-chart-radio-option input[type="radio"] {
    display: none;
}

.quick-chart-radio-indicator {
    width: 16px;
    height: 16px;
    border: 2px solid #4a4e59;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.quick-chart-radio-option.selected .quick-chart-radio-indicator {
    border-color: #2196f3;
}

.quick-chart-radio-indicator::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #2196f3;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s;
}

.quick-chart-radio-option.selected .quick-chart-radio-indicator::after {
    opacity: 1;
}

.quick-chart-radio-label {
    font-size: 13px;
    color: #d1d4dc;
}

/* Checkbox options */
.quick-chart-checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.quick-chart-checkbox-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-chart-checkbox-option:hover {
    background: #2a2e39;
}

.quick-chart-checkbox-option input[type="checkbox"] {
    display: none;
}

.quick-chart-checkbox-indicator {
    width: 18px;
    height: 18px;
    border: 2px solid #4a4e59;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.quick-chart-checkbox-option.checked .quick-chart-checkbox-indicator {
    background: #2196f3;
    border-color: #2196f3;
}

.quick-chart-checkbox-indicator svg {
    width: 12px;
    height: 12px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
    transition: opacity 0.2s;
}

.quick-chart-checkbox-option.checked .quick-chart-checkbox-indicator svg {
    opacity: 1;
}

.quick-chart-checkbox-label {
    font-size: 13px;
    color: #d1d4dc;
}

.quick-chart-checkbox-label.disabled {
    color: #4a4e59;
}

/* Dropdown selects in settings */
.quick-chart-settings-select-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.quick-chart-settings-select-label {
    font-size: 13px;
    color: #d1d4dc;
}

.quick-chart-settings-select {
    background: #2a2e39;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 13px;
    cursor: pointer;
    outline: none;
    min-width: 80px;
}

.quick-chart-settings-select:hover {
    border-color: #4a4e59;
}

/* Coming soon tag */
.quick-chart-coming-soon {
    font-size: 10px;
    color: #787b86;
    background: #2a2e39;
    padding: 2px 6px;
    border-radius: 3px;
    margin-left: 8px;
}

/* Gear button in header */
.quick-chart-gear {
    background: #2a2e39;
    border: 1px solid #4a4e59;
    color: #d1d4dc;  /* Brighter icon for visibility */
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.quick-chart-gear:hover {
    background: #363a45;
    color: #ffffff;
    border-color: #6b7280;
}

.quick-chart-gear.active {
    background: #2196f3;
    border-color: #2196f3;
    color: white;
}

.quick-chart-gear svg {
    stroke: currentColor;
    fill: none;
    width: 18px;
    height: 18px;
}

.quick-chart-gear svg circle,
.quick-chart-gear svg path {
    stroke: currentColor;
    stroke-width: 2;
}

/* ========================================
   Timeframe Pills
   ======================================== */
.quick-chart-timeframe-pills {
    display: flex;
    gap: 4px;
    margin-left: 8px;
}

.quick-chart-tf-pill {
    background: transparent;
    border: none;
    color: #787b86;
    padding: 4px 10px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
}

.quick-chart-tf-pill:hover {
    background: #2a2e39;
    color: #d1d4dc;
}

.quick-chart-tf-pill.active {
    background: #2196f3;
    color: white;
}

/* ========================================
   Overlays Dropdown
   ======================================== */
.quick-chart-overlays-dropdown {
    position: relative;
}

.quick-chart-overlays-btn {
    background: #2a2e39;
    color: #d1d4dc;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.quick-chart-overlays-btn:hover {
    background: #363a45;
    border-color: #4a4e59;
}

.quick-chart-overlays-btn svg {
    width: 12px;
    height: 12px;
    transition: transform 0.2s;
}

.quick-chart-overlays-dropdown.open .quick-chart-overlays-btn svg {
    transform: rotate(180deg);
}

.quick-chart-overlays-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: #1e222d;
    border: 1px solid #2a2e39;
    border-radius: 6px;
    padding: 8px 0;
    min-width: 200px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    display: none;
}

.quick-chart-overlays-dropdown.open .quick-chart-overlays-menu {
    display: block;
}

.quick-chart-overlay-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    cursor: pointer;
    transition: background 0.2s;
}

.quick-chart-overlay-item:hover {
    background: #2a2e39;
}

.quick-chart-overlay-checkbox {
    width: 16px;
    height: 16px;
    border: 2px solid #4a4e59;
    border-radius: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.quick-chart-overlay-item.checked .quick-chart-overlay-checkbox {
    background: #2196f3;
    border-color: #2196f3;
}

.quick-chart-overlay-checkbox svg {
    width: 10px;
    height: 10px;
    stroke: white;
    stroke-width: 3;
    opacity: 0;
}

.quick-chart-overlay-item.checked .quick-chart-overlay-checkbox svg {
    opacity: 1;
}

.quick-chart-overlay-label {
    font-size: 13px;
    color: #d1d4dc;
}

/* ========================================
   Moving Averages Chip Selector
   ======================================== */
.quick-chart-ma-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.quick-chart-ma-label {
    font-size: 12px;
    font-weight: 600;
    color: #787b86;
    min-width: 32px;
}

.quick-chart-ma-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.quick-chart-ma-chip {
    background: #2a2e39;
    color: #787b86;
    border: 1px solid #363a45;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 36px;
    text-align: center;
}

.quick-chart-ma-chip:hover {
    background: #363a45;
    color: #d1d4dc;
    border-color: #4a4e59;
}

.quick-chart-ma-chip.active {
    color: white;
    border-color: transparent;
    /* Background color set dynamically based on MA period */
}

/* ========================================
   RMA Oscillator Pane
   ======================================== */
.quick-chart-oscillator {
    flex-shrink: 0;
    height: 120px;
    background: #131722;
    border-top: 1px solid #2a2e39;
    display: none;  /* Hidden by default, shown when oscillator enabled */
    /* V432: Reduce gap by pulling up (main wrapper has 50px padding-bottom for labels) */
    margin-top: -25px;
}

.quick-chart-oscillator.visible {
    display: block;
}

.quick-chart-oscillator-label {
    position: absolute;
    top: 4px;
    left: 8px;
    font-size: 10px;
    font-weight: 600;
    color: #787b86;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    z-index: 10;
    pointer-events: none;
}
