/**
 * Depth of Market (DOM) Display Styles
 * Professional order book ladder display
 */

/* Main DOM Panel */
.dom-panel {
    display: flex;
    flex-direction: column;
    width: 180px;
    min-width: 160px;
    max-width: 200px;
    height: 100%;
    background: #131417;
    border-left: 1px solid #2b2d35;
    font-family: 'Roboto Mono', 'Consolas', monospace;
    font-size: 11px;
    color: #d1d4dc;
    overflow: hidden;
}

/* Header */
.dom-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    background: #1a1c22;
    border-bottom: 1px solid #2b2d35;
    min-height: 28px;
}

.dom-title {
    font-weight: 600;
    color: #8f929a;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dom-symbol {
    font-weight: 600;
    color: #d1d4dc;
    font-size: 11px;
}

.dom-header .dom-spread {
    margin-left: auto;
    font-size: 10px;
    color: #8f929a;
}

/* Table Wrapper */
.dom-table-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* Sides (Asks / Bids) */
.dom-side {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
}

.dom-side::-webkit-scrollbar {
    width: 4px;
}

.dom-side::-webkit-scrollbar-track {
    background: transparent;
}

.dom-side::-webkit-scrollbar-thumb {
    background: #3a3c45;
    border-radius: 2px;
}

.dom-side::-webkit-scrollbar-thumb:hover {
    background: #4a4c55;
}

/* Asks section - display in reverse (lowest at bottom) */
.dom-asks {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.dom-asks .dom-rows {
    display: flex;
    flex-direction: column;
}

/* Bids section - highest at top */
.dom-bids .dom-rows {
    display: flex;
    flex-direction: column;
}

/* Individual Row - Ultra compact for 75 levels */
.dom-row {
    display: flex;
    align-items: center;
    position: relative;
    padding: 0px 4px;
    height: 12px;
    cursor: pointer;
    transition: background 0.1s ease;
    font-size: 8px;
}

.dom-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Volume Bar (background) */
.dom-bar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    pointer-events: none;
    opacity: 0.3;
}

.dom-ask-bar {
    background: linear-gradient(to right, transparent, #ff1744);
}

.dom-bid-bar {
    background: linear-gradient(to right, transparent, #00e676);
}

/* Row Data Columns */
.dom-size,
.dom-price,
.dom-count {
    position: relative;
    z-index: 1;
}

.dom-size {
    flex: 1;
    text-align: left;
    color: #8f929a;
    font-size: 8px;
    padding-left: 1px;
}

.dom-price {
    flex: 1.2;
    text-align: center;
    font-weight: 500;
    font-size: 8px;
}

.dom-ask-row .dom-price {
    color: #ff1744;
}

.dom-bid-row .dom-price {
    color: #00e676;
}

.dom-count {
    flex: 0.5;
    text-align: right;
    color: #5f6269;
    font-size: 7px;
    padding-right: 1px;
}

/* Spread Bar (Middle) */
.dom-spread-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: #1e2229;
    border-top: 1px solid #2b2d35;
    border-bottom: 1px solid #2b2d35;
    min-height: 24px;
}

.dom-best-bid {
    color: #00e676;
    font-weight: 600;
    font-size: 11px;
}

.dom-best-ask {
    color: #ff1744;
    font-weight: 600;
    font-size: 11px;
}

.dom-spread-value {
    color: #8f929a;
    font-size: 10px;
}

/* Footer */
.dom-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: #1a1c22;
    border-top: 1px solid #2b2d35;
    min-height: 24px;
}

.dom-totals {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
}

.dom-bid-total {
    color: #00e676;
    font-weight: 500;
}

.dom-ask-total {
    color: #ff1744;
    font-weight: 500;
}

.dom-vs {
    color: #5f6269;
    font-size: 9px;
}

.dom-strong {
    font-weight: 700;
    text-shadow: 0 0 4px currentColor;
}

.dom-status {
    font-size: 9px;
    color: #5f6269;
}

/* Empty State */
.dom-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 10px;
    color: #5f6269;
    font-size: 10px;
    font-style: italic;
}

/* Container in Chart Module - visibility controlled by .visible class in styles.css */
/* When visible, these styles apply */
.dom-container.visible {
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

/* Hide DOM when chart module is too narrow */
@media (max-width: 600px) {
    .dom-panel {
        display: none;
    }
}

/* Compact mode for smaller screens */
@media (max-width: 800px) {
    .dom-panel {
        width: 140px;
        min-width: 140px;
    }

    .dom-row {
        height: 18px;
        padding: 1px 4px;
    }

    .dom-size,
    .dom-price {
        font-size: 10px;
    }

    .dom-count {
        display: none;
    }
}

/* Animation for updates */
@keyframes dom-flash-bid {
    0% { background-color: rgba(0, 230, 118, 0.3); }
    100% { background-color: transparent; }
}

@keyframes dom-flash-ask {
    0% { background-color: rgba(255, 23, 68, 0.3); }
    100% { background-color: transparent; }
}

.dom-bid-row.dom-updated {
    animation: dom-flash-bid 0.3s ease-out;
}

.dom-ask-row.dom-updated {
    animation: dom-flash-ask 0.3s ease-out;
}

/* Imbalance indicator */
.dom-imbalance-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(to right, #00e676, transparent, #ff1744);
    opacity: 0.5;
}

/* Toggle button for hiding/showing DOM */
.dom-toggle-btn {
    position: absolute;
    top: 50%;
    left: -12px;
    transform: translateY(-50%);
    width: 12px;
    height: 30px;
    background: #2b2d35;
    border: none;
    border-radius: 4px 0 0 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #8f929a;
    font-size: 10px;
    z-index: 10;
    transition: background 0.2s ease;
}

.dom-toggle-btn:hover {
    background: #3a3c45;
    color: #d1d4dc;
}

.dom-toggle-btn::before {
    content: '\25C0'; /* Left arrow */
}

.dom-panel.collapsed .dom-toggle-btn::before {
    content: '\25B6'; /* Right arrow */
}

.dom-panel.collapsed {
    width: 0;
    min-width: 0;
    border-left: none;
}

.dom-panel.collapsed > *:not(.dom-toggle-btn) {
    display: none;
}
