/* timelapse.css: timelapse controls, player, tooltip, and datepicker styling. */

/* Timelapse action buttons row and helper text. */
.timelapse-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.timelapse-hint {
    margin-top: 10px;
}

/* Inline info tooltip next to timelapse hint text. */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: 2px;
}

.info-tooltip-icon {
    width: 14px;
    height: 14px;
    fill: currentColor;
    opacity: 0.8;
    cursor: help;
    position: relative;
    top: 3px;
}

.info-tooltip-box {
    position: absolute;
    left: 0;
    top: 18px;
    z-index: 50;
    display: none;
    min-width: 300px;
    max-width: 440px;
    padding: 12px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.95);
    color: #000;
    font-size: 10pt;
    line-height: 1.4;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.info-tooltip-box ul {
    margin: 0;
    padding-left: 0;
    list-style: disc;
}

.info-tooltip-box strong {
    font-weight: bold;
}

.info-tooltip-box li {
    margin: 0 0 6px 16px;
}

.info-tooltip-box li:last-child {
    margin-bottom: 0;
}

.info-tooltip:hover .info-tooltip-box {
    display: block;
}

/* Hide non-JSON overlays while a timelapse is active. */
.timelapse-active .overlay-zoom,
.timelapse-active .overlay-view {
    display: none !important;
}

/* Toggle overlay info bubbles and zoom hotspots. */
.infobubbles-hidden .overlay-info,
.infobubbles-hidden .overlay-zoom,
.infobubbles-hidden .overlay-view {
    display: none !important;
}

/* Disabled visual state for timelapse controls. */
.timelapse-controls.is-disabled .timelapse-btn,
.timelapse-controls.is-disabled .timelapse-date,
.timelapse-controls.is-disabled .timelapse-special {
    background-color: #d9d9d9;
    border-color: #b3b3b3;
    color: #666;
    pointer-events: none;
}

.timelapse-controls.is-disabled .timelapse-btn .btn-icon,
.timelapse-controls.is-disabled .timelapse-date .btn-icon {
    fill: #666;
}

.timelapse-player.is-disabled .timelapse-player-btn,
.timelapse-player.is-disabled .timelapse-scrub {
    background-color: #f0f0f0;
    border-color: #c9c9c9;
    color: #666;
    pointer-events: none;
}

.timelapse-player.is-disabled .timelapse-scrub::-webkit-slider-runnable-track {
    background: #d9d9d9;
    border-color: #8a8a8a;
}

.timelapse-player.is-disabled .timelapse-scrub::-moz-range-track {
    background: #d9d9d9;
    border-color: #8a8a8a;
}

.timelapse-player.is-disabled .timelapse-scrub::-webkit-slider-thumb {
    background-color: #8a8a8a;
    border-color: #8a8a8a;
}

.timelapse-player.is-disabled .timelapse-scrub::-moz-range-thumb {
    background-color: #8a8a8a;
    border-color: #8a8a8a;
}

.timelapse-player.is-disabled .btn-icon {
    fill: #666;
}

/* Shared inline icon styling inside timelapse buttons. */
.btn-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
    fill: currentColor;
    flex-shrink: 0;
}

/* Utility class to toggle icons. */
.is-hidden {
    display: none;
}

/* Timelapse player control bar. */
.timelapse-player {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
}

/* Base button styling for timelapse controls and player. */
.timelapse-btn,
.timelapse-date,
.timelapse-special,
.timelapse-player-btn {
    border-radius: 5px;
    font-weight: bold;
    cursor: pointer;
}

.timelapse-btn,
.timelapse-date,
.timelapse-special,
.timelapse-player-btn {
    display: inline-flex;
    align-items: center;
}

/* Timelapse player buttons. */
.timelapse-player-btn {
    padding: 8px 12px;
    font-size: 11pt;
    border: 2px solid var(--color-current, #004191);
    background-color: #fff;
    color: var(--color-current, #004191);
}

#timelapse-play {
    width: 100px;
    justify-content: center;
}


.timelapse-player-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.timelapse-scrub-wrap {
    position: relative;
    flex: 1 1 200px;
    min-width: 200px;
}

.timelapse-preload-bar {
    display: none;
}

.timelapse-scrub {
    position: relative;
    z-index: 1;
    width: 100%;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
}

/* Scrub bar track styling. */
.timelapse-scrub::-webkit-slider-runnable-track {
    height: 8px;
    background: linear-gradient(
        to right,
        #fff var(--preload-pct, 0%),
        #000 var(--preload-pct, 0%)
    );
    border-radius: 4px;
    border: 1px solid #000;
    box-sizing: border-box;
}

.timelapse-scrub::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #000;
    border: 2px solid #000;
    margin-top: -4px;
}

.timelapse-scrub::-moz-range-track {
    height: 8px;
    background: linear-gradient(
        to right,
        #fff var(--preload-pct, 0%),
        #000 var(--preload-pct, 0%)
    );
    border-radius: 4px;
    border: 1px solid #000;
    box-sizing: border-box;
}

.timelapse-scrub::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background-color: #000;
    border: 2px solid #000;
}

.timelapse-scrub-wrap.is-preloaded .timelapse-scrub::-webkit-slider-runnable-track,
.timelapse-scrub-wrap.is-preloaded .timelapse-scrub::-moz-range-track {
    background: #fff;
}

/* Disabled scrub styling needs to override track/gradient rules. */
.timelapse-player.is-disabled .timelapse-scrub::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        #ececec var(--preload-pct, 0%),
        #b8b8b8 var(--preload-pct, 0%)
    ) !important;
    border-color: #8a8a8a !important;
}

.timelapse-player.is-disabled .timelapse-scrub::-moz-range-track {
    background: linear-gradient(
        to right,
        #ececec var(--preload-pct, 0%),
        #b8b8b8 var(--preload-pct, 0%)
    ) !important;
    border-color: #8a8a8a !important;
}

.timelapse-player.is-disabled .timelapse-scrub::-webkit-slider-thumb {
    background-color: #8a8a8a !important;
    border-color: #8a8a8a !important;
}

.timelapse-player.is-disabled .timelapse-scrub::-moz-range-thumb {
    background-color: #8a8a8a !important;
    border-color: #8a8a8a !important;
}

/* Fallback for browsers relying on the disabled attribute. */
.timelapse-scrub:disabled::-webkit-slider-runnable-track {
    background: linear-gradient(
        to right,
        #ececec var(--preload-pct, 0%),
        #b8b8b8 var(--preload-pct, 0%)
    ) !important;
    border-color: #8a8a8a !important;
}

.timelapse-scrub:disabled::-moz-range-track {
    background: linear-gradient(
        to right,
        #ececec var(--preload-pct, 0%),
        #b8b8b8 var(--preload-pct, 0%)
    ) !important;
    border-color: #8a8a8a !important;
}

.timelapse-scrub:disabled::-webkit-slider-thumb {
    background-color: #8a8a8a !important;
    border-color: #8a8a8a !important;
}

.timelapse-scrub:disabled::-moz-range-thumb {
    background-color: #8a8a8a !important;
    border-color: #8a8a8a !important;
}

.timelapse-time {
    font-size: 10pt;
    white-space: nowrap;
}

/* Timelapse action buttons (daily/hourly/date/live). */
.timelapse-btn,
.timelapse-date,
.timelapse-special {
    padding: 10px 15px 10px 10px;
    font-size: 12pt;
    border: 2px solid var(--color-current, #004191);
    background-color: var(--color-current, #004191);
    color: white;
    text-decoration: none;
}

/* Active mode state for timelapse controls. */
.timelapse-btn.active-mode,
.timelapse-date.active-mode,
.timelapse-special.active-mode {
    border-color: var(--active-border-color, #000);
    box-shadow: none;
}

.timelapse-btn.active-mode:not(.timelapse-btn-gray) {
    background-color: var(--active-filled-bg, #000);
    color: var(--active-filled-text, #fff);
}

.timelapse-btn-gray.active-mode,
.timelapse-date.active-mode,
.timelapse-special.active-mode {
    color: var(--active-outline-text, #000);
    background-color: var(--active-outline-bg, #fff);
}

/* Outline variant for “Live view” and toggles. */
.timelapse-btn-gray {
    background-color: #fff;
    color: var(--color-current, #004191);
    border-color: var(--color-current, #004191);
}

/* Info toggle keeps a fixed label and changes only its visual state. */
.timelapse-btn-info {
    background-color: #d9d9d9;
    color: #666;
    border-color: #b3b3b3;
}

.timelapse-btn-info.is-info-visible {
    background-color: #fff;
    color: var(--color-current, #004191);
    border-color: var(--color-current, #004191);
}

/* Datepicker input styling. */
.timelapse-date {
    background-color: #fff;
    color: #000;
    min-width: 160px;
}

.timelapse-special {
    background-color: #fff;
    color: #000;
    min-width: 230px;
    padding-right: 34px;
}

.timelapse-special.is-placeholder {
    color: #666;
}

.timelapse-date:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.timelapse-special:focus {
    outline: none;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.2);
}

.timelapse-special:disabled {
    background-color: #d9d9d9;
    border-color: #b3b3b3;
    color: #666;
    cursor: not-allowed;
}

/* Highlight available dates based on current perspective. */
.ui-datepicker td.available-date a {
    background: var(--color-current, #004191);
    color: #fff;
    border: 1px solid var(--color-current, #004191);
}

.ui-datepicker td.available-date a:hover {
    background: var(--color-current, #004191);
    color: #fff;
}

/* Timelapse video element overlayed on the live image. */
.timelapse-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: auto;
    display: none;
    z-index: 2;
}
#timelapse-speed {
    width: 60px;
    justify-content: center;
}
