/* ═══════════════════════════════════════════════════════════
   TIMEFRAME — SINGLE SOURCE OF TRUTH
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   SELECTOR WRAP — contains fav chips + dropdown trigger
   ═══════════════════════════════════════════════════════════ */
.tf-selector-wrap {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN TRIGGER BUTTON — ▼ only, no text
   ═══════════════════════════════════════════════════════════ */
.tf-dd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: 6px;
    padding: 5px 6px;
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    line-height: 1;
    height: 28px;
    width: 24px;
    transition: background 0.12s ease, border-color 0.12s ease;
    flex-shrink: 0;
    color: var(--ui-fg);
}
.tf-dd-btn.dd-open {
    background: var(--ui-button);
    color: var(--ui-fg);
}

/* ═══════════════════════════════════════════════════════════
   FAVORITES BAR — quick-access favorite timeframes in toolbar
   ═══════════════════════════════════════════════════════════ */
.tf-fav-bar {
    display: flex;
    gap: 6px;
    align-items: center;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x;
}
.tf-fav-bar::-webkit-scrollbar { display: none; }
.tf-fav-btn {
    background: var(--ui-button);
    border: none;
    border-radius: 6px;
    color: var(--ui-fg);
    padding: 5px 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    line-height: 1;
    height: 28px;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.tf-fav-btn:hover {
    background: var(--ui-button-hover);
    color: var(--ui-fg);
}
.tf-fav-btn.tf-fav-active {
    background: var(--ui-primary, #2962ff);
    color: #fff;
}
.tf-fav-btn.tf-fav-active:hover {
    background: var(--ui-primary, #2962ff);
    opacity: 0.9;
}

/* ═══════════════════════════════════════════════════════════
   EDGE FADES — gradient overlays indicating more content
   ═══════════════════════════════════════════════════════════ */
.tf-selector-wrap::before,
.tf-selector-wrap::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    z-index: 1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.tf-selector-wrap::before {
    left: 0;
    background: linear-gradient(to right, var(--ui-panel, #1e222d), transparent);
}
.tf-selector-wrap::after {
    right: 0;
    background: linear-gradient(to left, var(--ui-panel, #1e222d), transparent);
}
.tf-selector-wrap.tf-fade-left::before { opacity: 1; }
.tf-selector-wrap.tf-fade-right::after { opacity: 1; }

/* ═══════════════════════════════════════════════════════════
   NAVIGATION CHEVRONS — scroll indicators for fav bar overflow
   ═══════════════════════════════════════════════════════════ */
.tf-nav-chev {
    display: none;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 16px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: var(--ui-muted, #787b86);
    font-size: 15px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    user-select: none;
    z-index: 2;
    transition: background 0.1s, color 0.1s;
}
.tf-nav-chev:hover {
    background: var(--toolbar-hover, var(--ui-hover));
    color: var(--ui-fg);
}
.tf-nav-chev.tf-chev-visible {
    display: inline-flex;
}

/* ═══════════════════════════════════════════════════════════
   PANE TIMEFRAME LABEL
   ═══════════════════════════════════════════════════════════ */
.pane-tf {
    font-size: 11px;
    color: var(--ui-muted);
}

/* ═══════════════════════════════════════════════════════════
   PANE CURRENT-TF BUTTON
   ═══════════════════════════════════════════════════════════ */
.pane-tf-cur {
    background: transparent;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--ui-fg);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    cursor: pointer;
    line-height: 16px;
    margin-left: 6px;
    transition: background 0.1s, border-color 0.1s;
    white-space: nowrap;
}
.pane-tf-cur:hover,
.pane-tf-cur.dd-open {
    background: var(--ui-button);
    border-color: var(--ui-panel-border);
    color: #2962ff;
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN CONTAINER
   ═══════════════════════════════════════════════════════════ */
.pane-tf-dd {
    position: fixed;
    z-index: 9999;
    background: var(--ui-panel, #1e222d);
    border: 1px solid var(--ui-panel-border, #2a2e39);
    border-radius: 5px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    min-width: 170px;
    max-height: 340px;
    overflow-y: auto;
    padding: 4px 0;
    font-family: -apple-system, BlinkMacSystemFont, "Trebuchet MS", sans-serif;
}

/* ═══════════════════════════════════════════════════════════
   DROPDOWN SECTION HEADERS
   ═══════════════════════════════════════════════════════════ */
.tf-dd-grp-hdr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px 5px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.7px;
    color: var(--ui-muted, #787b86);
    cursor: pointer;
    user-select: none;
}
.tf-dd-grp-hdr:hover { color: var(--ui-fg, #d1d4dc); }

/* ═══════════════════════════════════════════════════════════
   DROPDOWN ITEMS
   ═══════════════════════════════════════════════════════════ */
.tf-dd-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 12px;
    font-size: 12.5px;
    color: var(--ui-fg, #d1d4dc);
    cursor: pointer;
    transition: background 0.08s;
}
.tf-dd-item:hover { background: var(--ui-button, #2a2e39); }
.tf-dd-item.tf-active {
    background: #2962ff;
    color: #fff;
}
.tf-dd-item.tf-active:hover { background: #1e53e5; }

/* ═══════════════════════════════════════════════════════════
   FAVORITES STAR
   ═══════════════════════════════════════════════════════════ */
.tf-dd-star {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--ui-muted, #787b86);
    cursor: pointer;
    padding: 4px;
    margin: -4px 0;
    border-radius: 4px;
    transition: color 0.1s, background 0.1s;
    flex-shrink: 0;
    line-height: 1;
}
.tf-dd-star svg {
    display: block;
    width: 16px;
    height: 16px;
}
.tf-dd-star:hover { color: #f59e0b; background: rgba(245,158,11,0.1); }
.tf-dd-star:active { background: rgba(245,158,11,0.2); }
.tf-dd-star.tf-starred { color: #f59e0b; }
.tf-dd-item.tf-active .tf-dd-star              { color: rgba(255,255,255,0.7); }
.tf-dd-item.tf-active .tf-dd-star.tf-starred   { color: #fbbf24; }
.tf-dd-item.tf-active .tf-dd-star:hover        { background: rgba(255,255,255,0.15); }
.tf-dd-item.tf-active .tf-dd-star.tf-starred:hover { color: #fbbf24; background: rgba(251,191,36,0.12); }

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME OVERRIDES (handled dynamically via CSS tokens)
   ═══════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — TIMEFRAME SIZING
   ═══════════════════════════════════════════════════════════ */

/* Touch device */
@media (hover: none) and (pointer: coarse) {
    .tf-fav-btn {
        min-width: 44px;
        min-height: 44px;
    }
    .tf-dd-btn {
        min-width: 44px;
        min-height: 44px;
    }
}

/* Large desktop (>=1440px) */
@media (min-width: 1440px) {
    .tf-dd-btn {
        height: 34px;
        width: 26px;
    }
}

/* Standard desktop (1200-1439px) */
@media (min-width: 1200px) and (max-width: 1439px) {
    .tf-dd-btn {
        height: 32px;
        width: 24px;
    }
}

/* Laptop (1024-1199px) */
@media (min-width: 1024px) and (max-width: 1199px) {
    .tf-dd-btn {
        height: 30px;
        width: 22px;
        font-size: 9px;
    }
}

/* Tablet (768-1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
    .tf-dd-btn {
        height: 28px;
        width: 22px;
        font-size: 9px;
    }
}

/* Small tablet / large mobile (480-767px) */
@media (min-width: 480px) and (max-width: 767px) {
    .tf-selector-wrap {
        max-width: 60vw;
    }
    .tf-dd-btn {
        height: 28px;
        width: 22px;
    }
}

/* Small mobile (<480px) */
@media (max-width: 479px) {
    .tf-selector-wrap {
        max-width: 55vw;
    }
    .tf-dd-btn {
        height: 28px;
        width: 20px;
        font-size: 9px;
    }
}

/* Landscape mode */
@media (max-height: 500px) {
    .tf-dd-btn {
        height: 28px;
        width: 22px;
        font-size: 9px;
    }
}
