/**
 * Phoenix Charts - CSS Styles
 * Matching TradingView's visual design
 */

/* ============================================================================
   PHOENIX CHART CONTAINER
   ============================================================================ */

.phoenix-chart-module {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ============================================================================
   TOOLBAR STYLES
   ============================================================================ */

.phoenix-toolbar {
    display: flex;
    align-items: center;
    height: 38px;
    padding: 0 8px;
    gap: 4px;
    user-select: none;
}

.phoenix-toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.phoenix-toolbar-btn:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.1));
}

.phoenix-toolbar-btn:active {
    transform: scale(0.98);
}

.phoenix-toolbar-separator {
    width: 1px;
    height: 20px;
    margin: 0 4px;
}

/* ============================================================================
   DRAWING TOOLBAR
   ============================================================================ */

.phoenix-drawing-toolbar {
    display: flex;
    flex-direction: column;
    width: 44px;
}

.phoenix-tool-category {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 32px;
    cursor: pointer;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.phoenix-tool-category:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.1));
}

.phoenix-tool-category.active {
    color: var(--phoenix-active-color, #2962ff);
    background-color: rgba(41, 98, 255, 0.1);
}

.phoenix-tool-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 32px;
    cursor: pointer;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.phoenix-tool-btn:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.1));
}

.phoenix-tool-btn.active {
    color: var(--phoenix-active-color, #2962ff);
}

/* ============================================================================
   DROPDOWN MENUS
   ============================================================================ */

.phoenix-symbol-dropdown,
.phoenix-timeframe-menu,
.phoenix-tool-submenu {
    position: absolute;
    background: var(--phoenix-dropdown-bg, #1a1f2e);
    border: 1px solid var(--phoenix-border-color, #2a2e39);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    overflow: hidden;
    animation: phoenixFadeIn 0.15s ease;
}

@keyframes phoenixFadeIn {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.phoenix-symbol-search {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--phoenix-border-color, #2a2e39);
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

.phoenix-symbol-search:focus {
    border-color: var(--phoenix-active-color, #2962ff);
}

.phoenix-symbol-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.phoenix-symbol-item:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.05));
}

.phoenix-tf-section {
    padding: 4px 12px;
    font-size: 11px;
    text-transform: uppercase;
    opacity: 0.6;
}

.phoenix-tf-item {
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s ease;
}

.phoenix-tf-item:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.05));
}

.phoenix-submenu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s ease;
}

.phoenix-submenu-item:hover {
    background-color: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.05));
}

/* ============================================================================
   OHLC DISPLAY
   ============================================================================ */

.phoenix-chart-ohlc-wrapper {
    position: absolute;
    top: 0;
    left: 8px;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    pointer-events: auto;
}

.phoenix-chart-ohlc {
    font-size: 12px;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 12px;
    pointer-events: auto;
}

.phoenix-chart-ohlc span {
    white-space: nowrap;
}

/* ============================================================================
   ONE-CLICK TRADING PANEL
   ============================================================================ */

.phoenix-one-click-panel {
    display: flex;
    align-items: stretch;
    gap: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 11px;
    border-radius: 4px;
    overflow: hidden;
    user-select: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    width: fit-content;
}

.phoenix-ocp-sell,
.phoenix-ocp-buy {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3px 10px;
    border: none;
    color: #ffffff;
    cursor: pointer;
    font-weight: 600;
    min-width: 55px;
    transition: background 0.15s ease;
    font-family: inherit;
    line-height: 1.3;
}

.phoenix-ocp-sell {
    background: #ef4444;
    border-radius: 4px 0 0 4px;
}

.phoenix-ocp-sell:hover {
    background: #dc2626;
}

.phoenix-ocp-buy {
    background: #10b981;
    border-radius: 0 4px 4px 0;
}

.phoenix-ocp-buy:hover {
    background: #0d9668;
}

.phoenix-ocp-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.phoenix-ocp-price {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.phoenix-ocp-qty {
    display: flex;
    align-items: center;
    background: var(--phoenix-dropdown-bg, #1a1f2e);
    min-width: 50px;
}

.phoenix-ocp-qty-minus,
.phoenix-ocp-qty-plus {
    width: 18px;
    height: 100%;
    background: transparent;
    border: none;
    color: var(--phoenix-text-color, #787b86);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: background 0.1s;
    font-family: inherit;
}

.phoenix-ocp-qty-minus:hover,
.phoenix-ocp-qty-plus:hover {
    background: var(--phoenix-hover-bg, rgba(255, 255, 255, 0.08));
}

.phoenix-ocp-qty-input {
    width: 28px;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--phoenix-text-primary, #d1d4dc);
    font-size: 11px;
    font-weight: 600;
    outline: none;
    padding: 0;
    font-family: inherit;
    -moz-appearance: textfield;
}

.phoenix-ocp-qty-input::-webkit-outer-spin-button,
.phoenix-ocp-qty-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ============================================================================
   CANVAS LAYERS
   ============================================================================ */

.phoenix-chart-canvas-container {
    position: relative;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    touch-action: none;
}

.phoenix-chart-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    touch-action: none;
}

.phoenix-chart-main {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    touch-action: none;
}

.phoenix-chart-ui {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    cursor: crosshair;
    touch-action: none;
}

/* ============================================================================
   SCROLLBARS (for dropdowns)
   ============================================================================ */

.phoenix-symbol-list::-webkit-scrollbar,
.phoenix-tool-submenu::-webkit-scrollbar {
    width: 6px;
}

.phoenix-symbol-list::-webkit-scrollbar-track,
.phoenix-tool-submenu::-webkit-scrollbar-track {
    background: transparent;
}

.phoenix-symbol-list::-webkit-scrollbar-thumb,
.phoenix-tool-submenu::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.phoenix-symbol-list::-webkit-scrollbar-thumb:hover,
.phoenix-tool-submenu::-webkit-scrollbar-thumb:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* ============================================================================
   EMOJI/ICON PICKER STYLES
   ============================================================================ */

.emoji-category-tabs::-webkit-scrollbar {
    height: 4px;
}

.emoji-category-tabs::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-category-tabs::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
}

.emoji-category-tabs::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.emoji-grid-container::-webkit-scrollbar {
    width: 6px;
}

.emoji-grid-container::-webkit-scrollbar-track {
    background: transparent;
}

.emoji-grid-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.emoji-grid-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.emoji-grid-item,
.icon-grid-item {
    transition: transform 0.15s ease, background-color 0.15s ease;
}

.emoji-grid-item:hover,
.icon-grid-item:hover {
    transform: scale(1.15);
    background-color: rgba(255, 255, 255, 0.15);
}

.emoji-category-tab {
    transition: background-color 0.15s ease, color 0.15s ease;
}

.emoji-mode-btn {
    transition: background-color 0.15s ease, color 0.15s ease;
}

/* ============================================================================
   DARK THEME VARIABLES
   ============================================================================ */

.dark-theme .phoenix-chart-module,
[data-theme="dark"] .phoenix-chart-module {
    --phoenix-bg: #0f1419;
    --phoenix-hover-bg: rgba(255, 255, 255, 0.08);
    --phoenix-border-color: #2a2e39;
    --phoenix-text-color: #787b86;
    --phoenix-text-primary: #d1d4dc;
    --phoenix-active-color: #2962ff;
    --phoenix-dropdown-bg: #1a1f2e;
    --phoenix-up-color: #10b981;
    --phoenix-down-color: #ef4444;
}

/* ============================================================================
   LIGHT THEME VARIABLES
   ============================================================================ */

.light-theme .phoenix-chart-module,
[data-theme="light"] .phoenix-chart-module {
    --phoenix-bg: #ffffff;
    --phoenix-hover-bg: rgba(0, 0, 0, 0.05);
    --phoenix-border-color: #e0e3eb;
    --phoenix-text-color: #787b86;
    --phoenix-text-primary: #131722;
    --phoenix-active-color: #2962ff;
    --phoenix-dropdown-bg: #ffffff;
    --phoenix-up-color: #10b981;
    --phoenix-down-color: #ef4444;
}

/* ============================================================================
   TOOLTIP
   ============================================================================ */

.phoenix-tooltip {
    position: absolute;
    padding: 6px 10px;
    background: rgba(0, 0, 0, 0.85);
    color: #ffffff;
    font-size: 12px;
    border-radius: 4px;
    pointer-events: none;
    white-space: nowrap;
    z-index: 9999;
    animation: phoenixFadeIn 0.1s ease;
}

.phoenix-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(0, 0, 0, 0.85);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .phoenix-toolbar {
        height: 42px;
        padding: 0 4px;
    }

    .phoenix-drawing-toolbar {
        width: 40px;
    }

    .phoenix-tool-category,
    .phoenix-tool-btn {
        height: 36px;
    }

    .phoenix-chart-ohlc {
        font-size: 11px;
        gap: 8px;
    }

    .phoenix-one-click-panel {
        font-size: 10px;
    }

    .phoenix-ocp-sell,
    .phoenix-ocp-buy {
        min-width: 45px;
        padding: 2px 6px;
    }
}

/* ============================================================================
   PRINT STYLES
   ============================================================================ */

@media print {

    .phoenix-toolbar,
    .phoenix-drawing-toolbar,
    .phoenix-chart-ohlc-wrapper,
    .phoenix-ohlc-settings-menu {
        display: none !important;
    }
}