/* Bloomberg Terminal Theme - Refined Modern */
@font-face {
    font-family: 'Bloomberg Prop Unicode';
    src: local('Bloomberg Prop Unicode'), local('Roboto Mono'), monospace;
}

:root {
    --bmt-bg: #050505;
    --bmt-panel: #111111;
    --bmt-text: #E0E0E0;
    --bmt-text-sec: #888888;
    --bmt-accent: #FF9F00;
    --bmt-accent-glow: rgba(255, 159, 0, 0.15);
    --bmt-green: #00E676;
    --bmt-red: #FF1744;
    --bmt-border: #333333;
}

.bmt-terminal-container {
    background-color: var(--bmt-bg);
    color: var(--bmt-text);
    font-family: 'Bloomberg Prop Unicode', 'Roboto Mono', monospace;
    font-size: 12px;
    padding: 15px;
    border: 1px solid var(--bmt-border);
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
}

/* Live Status */
.bmt-live-status {
    color: var(--bmt-accent);
    font-weight: bold;
    margin-bottom: 15px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: 0 0 5px var(--bmt-accent-glow);
}

.bmt-blink-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: var(--bmt-accent);
    border-radius: 50%;
    margin-right: 8px;
    animation: bl inker 1.5s linear infinite;
    box-shadow: 0 0 8px var(--bmt-accent);
}

@keyframes blinker {
    50% {
        opacity: 0.3;
    }
}

/* Info Icon & Tooltip */
.bmt-info-icon {
    display: inline-block;
    margin-left: 4px;
    color: var(--bmt-accent);
    cursor: help;
    font-size: 10px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.bmt-info-icon:hover {
    opacity: 1;
}

.bmt-info-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid var(--bmt-accent);
    border-radius: 4px;
    padding: 15px;
    min-width: 320px;
    max-width: 400px;
    z-index: 2000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
    font-size: 11px;
    line-height: 1.5;
}

.bmt-index-item:hover .bmt-info-tooltip {
    display: block;
}

.bmt-info-tooltip strong {
    display: block;
    color: var(--bmt-accent);
    font-size: 12px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--bmt-border);
    padding-bottom: 6px;
}

.bmt-info-tooltip p {
    margin: 6px 0;
    color: var(--bmt-text);
}

.bmt-info-tooltip ul {
    margin: 8px 0;
    padding-left: 20px;
    color: var(--bmt-text);
}

.bmt-info-tooltip li {
    margin: 4px 0;
    color: var(--bmt-text-sec);
}

/* Table Wrapper */
.bmt-table-wrapper {
    overflow-x: auto;
    width: 100%;
    max-height: 600px;
    min-height: 400px;
    /* Fix: Ensure room for tooltips when filtered to few rows */
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--bmt-border) var(--bmt-bg);
}

.bmt-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.bmt-table-wrapper::-webkit-scrollbar-track {
    background: var(--bmt-bg);
}

.bmt-table-wrapper::-webkit-scrollbar-thumb {
    background-color: var(--bmt-border);
    border-radius: 4px;
    border: 2px solid var(--bmt-bg);
}

/* Table Styles */
.bmt-terminal-table {
    width: 100%;
    border-collapse: collapse;
    white-space: nowrap;
}

.bmt-terminal-table th,
.bmt-terminal-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bmt-border);
    text-align: left;
}

/* Sticky Header */
.bmt-terminal-table th {
    background-color: var(--bmt-bg);
    color: var(--bmt-accent);
    font-weight: bold;
    text-transform: uppercase;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 2px solid var(--bmt-accent);
    font-size: 11px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* Sortable Headers */
th[data-sort] {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s, text-shadow 0.2s;
}

th[data-sort]:hover {
    color: #FFF;
    text-shadow: 0 0 8px var(--bmt-accent-glow);
}

/* Right-align price column headers */
/* Right-align price column headers (Old Price, New Price, Chg%) */
.bmt-terminal-table th:nth-child(7),
.bmt-terminal-table th:nth-child(8),
.bmt-terminal-table th:nth-child(9) {
    text-align: right;
}

/* Center-align actions header */
/* Center-align actions header */
.bmt-terminal-table th:nth-child(10) {
    text-align: center;
}

/* Contact Column */
.bmt-col-contact {
    font-family: 'Roboto Mono', monospace;
    color: var(--bmt-accent);
    font-weight: bold;
    letter-spacing: 0.5px;
}

/* Vendor Column */
.bmt-col-vendor {
    font-weight: bold;
    color: var(--bmt-text);
    position: relative;
}

.bmt-vendor-name {
    cursor: default;
    display: inline-block;
    position: relative;
    transition: color 0.2s;
}

.bmt-vendor-name.has-contacts {
    cursor: pointer;
    border-bottom: 1px dotted var(--bmt-accent);
}

.bmt-vendor-name.has-contacts:hover {
    color: var(--bmt-accent);
    text-shadow: 0 0 8px var(--bmt-accent-glow);
}

.contact-indicator {
    font-size: 10px;
}

.bmt-vendor-name.has-contacts::after {
    content: '';
    position: absolute;
    top: 100%;
    left: -10px;
    right: -10px;
    height: 10px;
    z-index: 999;
}

/* Vendor Tooltip - Attached to vendor name span */
.bmt-vendor-tooltip {
    display: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    background: rgba(15, 15, 15, 0.98);
    backdrop-filter: blur(8px);
    border: 1px solid var(--bmt-accent);
    border-radius: 4px;
    padding: 12px;
    min-width: 200px;
    max-width: 250px;
    z-index: 1000;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.9);
    white-space: normal;
}

.bmt-vendor-name.has-contacts:hover .bmt-vendor-tooltip {
    display: block;
}

.bmt-vendor-tooltip strong {
    display: block;
    color: var(--bmt-accent);
    margin-bottom: 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--bmt-border);
    padding-bottom: 8px;
    letter-spacing: 0.5px;
}

.tooltip-link {
    display: flex;
    align-items: center;
    color: var(--bmt-text);
    text-decoration: none;
    padding: 8px 10px;
    margin: 4px 0;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
    font-size: 12px;
    border: 1px solid transparent;
}

.tooltip-link:hover {
    background: rgba(255, 159, 0, 0.1);
    border-color: var(--bmt-accent);
    color: var(--bmt-accent);
    transform: translateX(3px);
}

/* Column Styles */
.bmt-col-id {
    color: var(--bmt-accent);
    font-weight: bold;
    font-family: monospace;
    letter-spacing: 0.5px;
}

.bmt-col-title {
    color: var(--bmt-text-sec);
    font-style: italic;
    font-size: 11px;
}

.bmt-col-price,
.bmt-col-old,
.bmt-col-chg {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.bmt-col-actions {
    text-align: center;
}

.bmt-curr {
    color: var(--bmt-text-sec);
    font-weight: normal;
    margin-right: 2px;
    font-size: 10px;
}

.price-val {
    color: var(--bmt-text);
    font-weight: bold;
}

/* Vendor Link in Estate Column */
.bmt-vendor-link {
    color: var(--bmt-accent);
    text-decoration: none;
    transition: all 0.2s ease;
    border-bottom: 1px dotted var(--bmt-accent);
}

.bmt-vendor-link:hover {
    color: #FFF;
    text-shadow: 0 0 8px var(--bmt-accent-glow);
    border-bottom-style: solid;
}

/* Colors */
.text-green {
    color: var(--bmt-green) !important;
}

.text-red {
    color: var(--bmt-red) !important;
}

/* Row Hover */
.bmt-row {
    transition: background-color 0.1s;
}

.bmt-row:hover {
    background-color: rgba(255, 159, 0, 0.05);
}

/* Toolbar */
.bmt-toolbar input,
.bmt-toolbar select {
    background: #000 !important;
    border: 1px solid var(--bmt-border) !important;
    color: var(--bmt-text) !important;
    font-family: monospace;
}

.bmt-toolbar input:focus,
.bmt-toolbar select:focus {
    border-color: var(--bmt-accent) !important;
    outline: none;
    box-shadow: 0 0 5px var(--bmt-accent-glow);
}

.bmt-toolbar input::placeholder {
    color: #555;
}

#bmt-sound-toggle {
    background: var(--bmt-accent) !important;
    color: #000 !important;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Buttons */
.bmt-edit-price {
    background: var(--bmt-accent) !important;
    color: #000 !important;
    font-weight: bold;
}

.bmt-delete-listing {
    background: #330000 !important;
    color: var(--bmt-red) !important;
    border: 1px solid var(--bmt-red) !important;
}

.bmt-delete-listing:hover {
    background: var(--bmt-red) !important;
    color: #FFF !important;
}

/* Animations */
@keyframes flashGreen {
    0% {
        background-color: rgba(0, 230, 118, 0.2);
    }

    100% {
        background-color: transparent;
    }
}

@keyframes flashRed {
    0% {
        background-color: rgba(255, 23, 68, 0.2);
    }

    100% {
        background-color: transparent;
    }
}

.flash-up {
    animation: flashGreen 1s ease-out;
}

.flash-down {
    animation: flashRed 1s ease-out;
}

@keyframes flashHighlight {

    0%,
    100% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(255, 159, 0, 0.2);
    }
}

.bmt-highlight-flash {
    animation: flashHighlight 1s ease-in-out 3;
    border: 1px solid var(--bmt-accent);
}

/* Mobile Optimization */
@media screen and (max-width: 1024px) {
    .bmt-terminal-container {
        padding: 10px;
        font-size: 11px;
    }

    .bmt-terminal-table th,
    .bmt-terminal-table td {
        padding: 8px 10px;
        font-size: 11px;
    }
}

@media screen and (max-width: 768px) {
    .bmt-terminal-container {
        padding: 8px;
        font-size: 10px;
    }

    .bmt-live-status {
        font-size: 10px;
    }

    .bmt-toolbar {
        flex-direction: column !important;
        gap: 8px !important;
    }

    .bmt-toolbar input,
    .bmt-toolbar select,
    .bmt-toolbar button {
        width: 100% !important;
        padding: 12px !important;
        font-size: 14px !important;
    }

    .bmt-terminal-table {
        font-size: 10px;
    }

    .bmt-terminal-table th,
    .bmt-terminal-table td {
        padding: 6px 8px;
    }

    .bmt-terminal-table th:nth-child(4),
    .bmt-terminal-table td.bmt-col-loc {
        display: none;
    }

    .bmt-terminal-table th:nth-child(6),
    .bmt-terminal-table td.bmt-col-title {
        display: none;
    }

    .bmt-vendor-tooltip {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        min-width: 260px;
        max-width: 90vw;
        border: 2px solid var(--bmt-accent);
    }

    .bmt-edit-price,
    .bmt-delete-listing {
        padding: 8px 12px !important;
        font-size: 13px !important;
        margin: 2px !important;
    }
}

@media screen and (max-width: 480px) {
    .bmt-terminal-container {
        padding: 5px;
        margin: 0 -5px;
        border-radius: 0;
    }

    .bmt-table-wrapper {
        margin: 0 -5px;
    }

    .bmt-terminal-table th,
    .bmt-terminal-table td {
        padding: 5px 6px;
        font-size: 9px;
    }

    /* Status was 9, now removed. Maybe hide Change or Old Price on very small? */
    .bmt-terminal-table th:nth-child(7),
    .bmt-terminal-table td.bmt-col-old {
        display: none;
    }

    .bmt-col-actions {
        min-width: 70px;
    }

    .bmt-delete-listing {
        font-size: 11px !important;
        padding: 6px 8px !important;
    }
}

@media screen and (max-width: 500px) and (orientation: landscape) {
    .bmt-table-wrapper {
        max-height: 300px;
    }

    .bmt-terminal-container {
        padding: 5px;
    }
}

/* Flash Badge - Compact Design */
.bfl-badge {
    display: inline-block;
    background: linear-gradient(135deg, #FFD700 0%, #FFA500 100%);
    color: #000;
    font-size: 8px;
    font-weight: bold;
    padding: 2px 5px;
    border-radius: 3px;
    margin-left: 4px;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(255, 165, 0, 0.3);
    animation: flashPulse 2s infinite;
    vertical-align: middle;
    white-space: nowrap;
}

@keyframes flashPulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* ================================================================
   FULLSCREEN MODE - Toolbar Auto-Hide (JS-controlled via timer)
   ================================================================ */

/* Fullscreen container base */
.bmt-terminal-container.bmt-fullscreen-mode {
    position: relative;
}

/* Toolbar transition for smooth hide/show */
.bmt-terminal-container.bmt-fullscreen-mode .bmt-toolbar {
    transition: max-height 0.4s ease, opacity 0.4s ease, padding 0.3s ease, margin 0.3s ease;
}

/* Hidden state - JS adds this class after 5s inactivity */
.bmt-terminal-container.bmt-fullscreen-mode.bmt-toolbar-hidden .bmt-toolbar {
    max-height: 0 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
    opacity: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* Maximize table height in fullscreen when toolbar hidden */
.bmt-terminal-container.bmt-fullscreen-mode .bmt-table-wrapper {
    max-height: calc(100vh - 120px);
    transition: max-height 0.3s ease;
}

.bmt-terminal-container.bmt-fullscreen-mode.bmt-toolbar-hidden .bmt-table-wrapper {
    max-height: calc(100vh - 60px);
}