/* ═══════════════════════════════════════════════════
   chart-drawings.css — Popup & Drawing Tools v2
   ═══════════════════════════════════════════════════ */

/* ─── Popup Modal ─────────────────────────────────── */
.chart-popup-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.chart-popup-modal.visible {
    opacity: 1;
    visibility: visible;
}

.popup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.popup-container {
    position: relative;
    width: 95vw;
    height: 92vh;
    max-width: 1600px;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chart-popup-modal.visible .popup-container {
    transform: scale(1);
}

/* ─── Popup Header ────────────────────────────────── */
.popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.95);
    flex-shrink: 0;
}

.popup-title {
    display: flex;
    align-items: center;
    gap: 16px;
}

.popup-symbol {
    font-weight: 900;
    font-size: 18px;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
}

.popup-tf-group {
    display: flex;
    gap: 2px;
}

.popup-tf-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    transition: all 0.15s;
}

.popup-tf-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.popup-tf-btn.active {
    background: #6366f1;
    color: #fff;
    border-color: #6366f1;
}

/* ─── Indicators Button in Popup ──────────────────── */
.popup-ind-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #94a3b8;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.15s;
}

.popup-ind-btn:hover {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
    border-color: rgba(139, 92, 246, 0.3);
}

.popup-ind-btn span {
    font-family: 'JetBrains Mono', monospace;
}

/* ─── Indicator Modal Items ───────────────────────── */
.popup-ind-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 4px;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 13px;
    color: #cbd5e1;
    transition: background 0.15s;
}

.popup-ind-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.popup-ind-item input {
    cursor: pointer;
    accent-color: #6366f1;
}

.popup-ind-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* ─── Close Button ────────────────────────────────── */
.popup-close-btn {
    background: none;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    transition: all 0.15s;
    display: flex;
    align-items: center;
}

.popup-close-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ─── Popup Body ──────────────────────────────────── */
.popup-body {
    flex: 1;
    display: flex;
    min-height: 0;
}

/* ─── Drawing Toolbar (left side) ─────────────────── */
.popup-toolbar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 6px;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.6);
    flex-shrink: 0;
    width: 56px;
    align-items: center;
}

.draw-tool-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid transparent;
    color: #64748b;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.15s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    width: 44px;
}

.draw-tool-btn span {
    font-size: 9px;
    font-weight: 600;
}

.draw-tool-btn:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #cbd5e1;
    border-color: rgba(255, 255, 255, 0.08);
}

.draw-tool-btn.active {
    background: rgba(99, 102, 241, 0.15);
    color: #818cf8;
    border-color: rgba(99, 102, 241, 0.4);
}

.draw-tool-danger:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.08);
}

.draw-separator {
    width: 32px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    margin: 4px 0;
}

/* ─── Popup Chart Area ────────────────────────────── */
.popup-chart-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}

.popup-chart-container {
    flex: 1;
    position: relative;
    min-height: 0;
}

.popup-chart-container>div {
    position: absolute !important;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
}

.popup-drawing-status {
    position: absolute;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(99, 102, 241, 0.9);
    color: white;
    padding: 6px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
    z-index: 10;
}

.popup-drawing-status.visible {
    opacity: 1;
}

/* ─── Drawings List (right side) ──────────────────── */
.popup-drawings-list {
    width: 200px;
    border-left: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(15, 23, 42, 0.6);
    overflow-y: auto;
    padding: 6px;
    flex-shrink: 0;
}

.no-drawings {
    color: #475569;
    font-size: 11px;
    text-align: center;
    padding: 20px 8px;
}

.drawing-item {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 6px;
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 11px;
    cursor: pointer;
}

.drawing-item:hover {
    background: rgba(255, 255, 255, 0.06);
}

.drawing-triggered {
    opacity: 0.5;
}

.drawing-triggered .drawing-type::after {
    content: " ✓";
    color: #6b7280;
}

.drawing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.drawing-type {
    color: #94a3b8;
    font-weight: 600;
    white-space: nowrap;
}

.drawing-price {
    color: #64748b;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.drawing-remove {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 0 2px;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
    transition: color 0.15s;

}

.drawing-remove:hover {
    color: #ef4444;
}

/* ─── Expand Button on Chart Cards ────────────────── */
.expand-btn {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 2px;
    transition: color 0.15s, transform 0.15s;
    display: flex;
    align-items: center;
}

.expand-btn:hover {
    color: #fff;
    transform: scale(1.15);
}

/* ─── Drawing canvas overlay ──────────────────────── */
.drawing-overlay-canvas {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 4;
}

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

    .popup-drawings-list {
        display: none;
    }

    .popup-toolbar {
        width: 44px;
        padding: 4px 2px;
    }

    .draw-tool-btn {
        width: 36px;
        padding: 4px;
    }

    .draw-tool-btn span {
        font-size: 7px;
    }
}