/* Stealth Browse - Wayback Look Power Up (fixed chrome timeline bar) */

.wayback-look-toggle-container:not([hidden]):not(.appearance-hidden) {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
    margin: 0;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative;
}

#wayback-look-toggle-container[hidden],
#wayback-look-toggle-container.appearance-hidden,
.top-bar #wayback-look-toggle-container[hidden],
.top-bar #wayback-look-toggle-container.appearance-hidden {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

#wayback-look-toggle-btn img,
.top-bar #wayback-look-toggle-btn img {
    width: 12px !important;
    height: 12px !important;
    max-width: 12px !important;
    max-height: 12px !important;
    display: block !important;
    object-fit: contain !important;
}

#wayback-look-toggle-btn.is-open {
    color: #c4b5fd;
    background: rgba(90, 13, 214, 0.22);
}

.wayback-timeline-bar {
    --wayback-timeline-h: 0px;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    z-index: 100005;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    min-height: 72px;
    padding: 6px 10px 8px;
    color: var(--ui-text, #f2f2f6);
    background: var(--chrome-surface, #111111);
    border: 0;
    border-bottom: 1px solid var(--ui-border, rgba(255, 255, 255, 0.12));
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    -webkit-app-region: no-drag;
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Open Sans', sans-serif;
}

.wayback-timeline-bar[hidden],
.wayback-timeline-bar.appearance-hidden {
    display: none !important;
}

.wayback-timeline-bar-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    min-width: 0;
}

.wayback-timeline-bar-top {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.wayback-timeline-bar-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    display: block;
    object-fit: contain;
    filter: brightness(0) saturate(100%) invert(72%) sepia(42%) saturate(650%) hue-rotate(220deg) brightness(1.05);
}

.wayback-timeline-summary {
    flex: 1 1 auto;
    min-width: 0;
    font-size: 12px;
    line-height: 1.35;
    color: var(--ui-text, rgba(242, 242, 246, 0.85));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wayback-timeline-summary strong {
    color: var(--ui-text, #f5f3ff);
    font-weight: 700;
}

.wayback-timeline-summary-link {
    border: none;
    background: none;
    padding: 0;
    margin: 0;
    color: #c4b5fd;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.wayback-timeline-summary-link:hover {
    color: #ddd6fe;
}

.wayback-timeline-bar-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.wayback-timeline-action-btn,
.wayback-timeline-close-btn {
    border: 1px solid var(--ui-border, rgba(255, 255, 255, 0.14));
    background: var(--ui-bg, rgba(45, 45, 45, 0.92));
    color: var(--ui-text, inherit);
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    line-height: 1.2;
}

.wayback-timeline-action-btn:hover,
.wayback-timeline-close-btn:hover {
    background: var(--ui-bg-hover, rgba(60, 60, 60, 0.95));
}

.wayback-timeline-close-btn {
    width: 24px;
    height: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wayback-timeline-scrub {
    position: relative;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border: 1px solid var(--ui-border, rgba(255, 255, 255, 0.12));
    border-radius: var(--stealth-cut, 12px 2px 2px 2px);
    background: rgba(255, 255, 255, 0.05);
    outline: none;
    cursor: ew-resize;
    touch-action: none;
    user-select: none;
}

.wayback-timeline-scrub:focus-visible {
    box-shadow: 0 0 0 2px rgba(90, 13, 214, 0.45);
}

.wayback-timeline-scrub.is-scrubbing {
    cursor: grabbing;
}

.wayback-timeline-scrub::-webkit-scrollbar {
    height: 5px;
}

.wayback-timeline-scrub::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
}

.wayback-timeline-track {
    display: flex;
    align-items: stretch;
    min-width: 100%;
    height: 54px;
}

.wayback-timeline-year {
    position: relative;
    flex: 1 0 48px;
    min-width: 48px;
    max-width: 84px;
    height: 100%;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    background: transparent;
    color: rgba(242, 242, 246, 0.55);
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    box-sizing: border-box;
}

.wayback-timeline-year:last-child {
    border-right: none;
}

.wayback-timeline-year.has-captures {
    color: rgba(242, 242, 246, 0.78);
}

.wayback-timeline-year.is-active {
    color: #e9d5ff;
}

.wayback-timeline-year.is-active .wayback-timeline-bars {
    background: rgba(90, 13, 214, 0.3);
    box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.35);
}

.wayback-timeline-bars {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1px;
    padding: 6px 3px 2px;
    min-height: 0;
}

.wayback-timeline-bar-seg {
    flex: 1 1 0;
    min-width: 2px;
    max-width: 6px;
    height: 0;
    align-self: flex-end;
    background: transparent;
    border: none;
    border-radius: 1px 1px 0 0;
    padding: 0;
    margin: 0;
    pointer-events: none;
}

.wayback-timeline-bar-seg.has-captures {
    background: rgba(242, 242, 246, 0.92);
    pointer-events: auto;
    cursor: pointer;
}

.wayback-timeline-bar-seg.has-captures:hover,
.wayback-timeline-bar-seg.has-captures.is-selected {
    background: #c4b5fd;
    box-shadow: 0 0 0 1px rgba(196, 181, 253, 0.65);
}

.wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures {
    background: #f5f3ff;
}

.wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures.is-selected,
.wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures:hover {
    background: #ddd6fe;
}

.wayback-timeline-label {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 18px;
    font-size: 10px;
    font-weight: 600;
    color: inherit;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.18);
}

.wayback-timeline-year.is-active .wayback-timeline-label {
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
    color: #f5f3ff;
    border-top-color: rgba(196, 181, 253, 0.35);
}

.wayback-timeline-selected {
    min-height: 14px;
    font-size: 11px;
    color: rgba(242, 242, 246, 0.65);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wayback-timeline-times {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-top: 2px;
    min-height: 28px;
}

.wayback-timeline-times[hidden] {
    display: none !important;
}

.wayback-timeline-times::-webkit-scrollbar {
    height: 5px;
}

.wayback-timeline-times::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
}

.wayback-timeline-times-empty {
    font-size: 11px;
    color: rgba(242, 242, 246, 0.5);
    padding: 4px 2px;
}

.wayback-timeline-time-chip {
    flex: 0 0 auto;
    border: 1px solid rgba(90, 13, 214, 0.35);
    background: rgba(90, 13, 214, 0.16);
    color: #c4b5fd;
    border-radius: var(--stealth-cut-sm, 8px 2px 2px 2px);
    padding: 4px 8px;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
}

.wayback-timeline-time-chip:hover {
    background: rgba(90, 13, 214, 0.28);
}

.wayback-timeline-time-chip.is-active {
    background: linear-gradient(135deg, #5a0dd6, #4900c2);
    border-color: rgba(90, 13, 214, 0.6);
    color: #f5f3ff;
}

/* Bottom dock: timeline lives alone at the top of the UI */
body.bottom-layout-body .wayback-timeline-bar:not([hidden]),
html.bottom-layout-html body.bottom-layout-body .wayback-timeline-bar:not([hidden]),
body.bottom-layout-body > #wayback-timeline-bar:not([hidden]) {
    top: 0 !important;
    bottom: auto !important;
}

body.bottom-layout-body.wayback-timeline-visible .web-content,
html.bottom-layout-html.wayback-timeline-visible .browser-container.bottom-layout .web-content,
.browser-container.bottom-layout.wayback-timeline-visible .web-content {
    top: var(--wayback-timeline-h, 96px) !important;
}

body.bottom-layout-body.wayback-timeline-visible .browser-sidebar,
html.bottom-layout-html.wayback-timeline-visible .browser-sidebar {
    top: var(--wayback-timeline-h, 96px) !important;
}

/* Top dock: under title / URL / status / bookmarks stack (JS sets exact top) */
body:not(.bottom-layout-body) .wayback-timeline-bar:not([hidden]) {
    top: 90px;
    bottom: auto;
}

body:not(.bottom-layout-body).security-bar-hidden .wayback-timeline-bar:not([hidden]) {
    top: 68px;
}

body:not(.bottom-layout-body).bookmarks-bar-visible .wayback-timeline-bar:not([hidden]) {
    top: 124px;
}

body:not(.bottom-layout-body).security-bar-hidden.bookmarks-bar-visible .wayback-timeline-bar:not([hidden]) {
    top: 102px;
}

body:not(.bottom-layout-body).wayback-timeline-visible .web-content {
    top: calc(90px + var(--wayback-timeline-h, 96px)) !important;
    height: calc(100% - 90px - var(--wayback-timeline-h, 96px)) !important;
}

body:not(.bottom-layout-body).security-bar-hidden.wayback-timeline-visible .web-content {
    top: calc(68px + var(--wayback-timeline-h, 96px)) !important;
    height: calc(100% - 68px - var(--wayback-timeline-h, 96px)) !important;
}

body:not(.bottom-layout-body).bookmarks-bar-visible.wayback-timeline-visible .web-content {
    top: calc(124px + var(--wayback-timeline-h, 96px)) !important;
    height: calc(100% - 124px - var(--wayback-timeline-h, 96px)) !important;
}

body:not(.bottom-layout-body).security-bar-hidden.bookmarks-bar-visible.wayback-timeline-visible .web-content {
    top: calc(102px + var(--wayback-timeline-h, 96px)) !important;
    height: calc(100% - 102px - var(--wayback-timeline-h, 96px)) !important;
}

body:not(.bottom-layout-body).wayback-timeline-visible .browser-sidebar {
    top: calc(90px + var(--wayback-timeline-h, 96px));
}

body:not(.bottom-layout-body).security-bar-hidden.wayback-timeline-visible .browser-sidebar {
    top: calc(68px + var(--wayback-timeline-h, 96px));
}

body:not(.bottom-layout-body).bookmarks-bar-visible.wayback-timeline-visible .browser-sidebar {
    top: calc(124px + var(--wayback-timeline-h, 96px));
}

body:not(.bottom-layout-body).security-bar-hidden.bookmarks-bar-visible.wayback-timeline-visible .browser-sidebar {
    top: calc(102px + var(--wayback-timeline-h, 96px));
}

[data-theme="light"] .wayback-timeline-bar {
    color: #1f2937;
}

[data-theme="light"] .wayback-timeline-bar-icon {
    filter: none;
}

[data-theme="light"] .wayback-timeline-summary,
[data-theme="light"] .wayback-timeline-selected,
[data-theme="light"] .wayback-timeline-times-empty {
    color: rgba(31, 41, 55, 0.75);
}

[data-theme="light"] .wayback-timeline-summary strong {
    color: #111827;
}

[data-theme="light"] .wayback-timeline-summary-link {
    color: #5a0dd6;
}

[data-theme="light"] .wayback-timeline-summary-link:hover {
    color: #4900c2;
}

[data-theme="light"] .wayback-timeline-scrub {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .wayback-timeline-year {
    color: rgba(31, 41, 55, 0.55);
    border-right-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .wayback-timeline-year.has-captures {
    color: rgba(31, 41, 55, 0.78);
}

[data-theme="light"] .wayback-timeline-year.is-active {
    color: #4900c2;
}

[data-theme="light"] .wayback-timeline-year.is-active .wayback-timeline-bars {
    background: rgba(90, 13, 214, 0.16);
}

[data-theme="light"] .wayback-timeline-bar-seg.has-captures {
    background: #111827;
}

[data-theme="light"] .wayback-timeline-bar-seg.has-captures:hover,
[data-theme="light"] .wayback-timeline-bar-seg.has-captures.is-selected,
[data-theme="light"] .wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures.is-selected,
[data-theme="light"] .wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures:hover {
    background: #5a0dd6;
}

[data-theme="light"] .wayback-timeline-year.is-active .wayback-timeline-bar-seg.has-captures {
    background: #1f2937;
}

[data-theme="light"] .wayback-timeline-label {
    background: rgba(0, 0, 0, 0.05);
    border-top-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .wayback-timeline-action-btn,
[data-theme="light"] .wayback-timeline-close-btn {
    color: #1f2937;
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

body.vertical-tabs .wayback-timeline-bar:not([hidden]) {
    left: 200px;
    width: calc(100% - 200px);
}
