/* Timeline-specific styles */
#timeline-controls .btn {
    font-size: 14px;
}

#timeline-controls .fps-control {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 12px;
}

#timeline-controls .fps-control label {
    font-size: 11px;
    color: var(--text-muted);
}

#timeline-controls .onion-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: 12px;
}

#timeline-controls .onion-controls label {
    font-size: 11px;
    color: var(--text-muted);
}

#timeline-controls .onion-controls select {
    font-size: 11px;
    padding: 2px 4px;
}

/* ─── Numeric Stepper ─────────────────────────────────────────────────────── */

.num-stepper {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm, 4px);
    overflow: hidden;
    height: 24px;
}

/* +/− trigger buttons */
.num-stepper .stepper-btn {
    min-width: 22px;
    padding: 0 4px;
    background: var(--bg-control, rgba(255,255,255,0.06));
    border: none;
    border-radius: 0;
    color: var(--text-secondary, #ccc);
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.1s, color 0.1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    flex-shrink: 0;
}

.num-stepper .stepper-btn:hover:not(:disabled) {
    background: var(--bg-hover, rgba(255,255,255,0.13));
    color: var(--text-primary, #fff);
}

.num-stepper .stepper-btn:active:not(:disabled) {
    background: var(--accent-dim, rgba(99,102,241,0.25));
}

.num-stepper .stepper-btn:disabled {
    opacity: 0.28;
    cursor: not-allowed;
}

/* The text input — no native spinners, fixed width so 1–3 digit values always fit */
.num-stepper input[type="number"] {
    width: 38px;           /* fits "60" and "120" without overflow */
    border: none;
    border-left:  1px solid var(--border);
    border-right: 1px solid var(--border);
    border-radius: 0;
    background: transparent;
    color: var(--text-primary, #fff);
    text-align: center;
    font-size: 11px;
    padding: 0;
    min-width: 0;
    /* Remove the browser's native up/down spinner buttons */
    -moz-appearance: textfield;
}

.num-stepper input[type="number"]::-webkit-inner-spin-button,
.num-stepper input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

.num-stepper input[type="number"]:focus {
    outline: none;
    background: var(--bg-input-focus, rgba(255,255,255,0.06));
}

.num-stepper input[type="number"]:disabled {
    opacity: 0.35;
}

/* Whole-group disabled */
.num-stepper.is-disabled {
    opacity: 0.38;
    pointer-events: none;
}

/* Mobile: generous touch targets */
@media (max-width: 768px) {
    .num-stepper {
        height: 34px;
    }

    .num-stepper .stepper-btn {
        min-width: 34px;
        font-size: 17px;
    }

    .num-stepper input[type="number"] {
        width: 44px;
        font-size: 13px;
    }
}

.frame-thumb .frame-actions {
    position: absolute;
    top: 2px;
    right: 2px;
    display: none;
    gap: 2px;
}
.frame-thumb:hover .frame-actions { display: flex; }

.frame-thumb .frame-actions button {
    width: 18px; height: 18px;
    border: none;
    background: rgba(0,0,0,0.6);
    color: var(--text-primary);
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Drag indicator */
.frame-thumb.drag-over {
    border-color: var(--success);
    border-style: dashed;
}

/* Hidden frame */
.frame-thumb.hidden-frame {
    opacity: 0.4;
}
.frame-thumb.hidden-frame .frame-label {
    text-decoration: line-through;
}

/* Tween frame */
.frame-thumb.tween-frame {
    border-style: dashed;
    border-color: var(--info);
}

/* Transition connector between frames */
.frame-connector {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    transition: color var(--transition-fast);
}
.frame-connector:hover {
    color: var(--text-primary);
}
.frame-connector.active {
    color: var(--info);
}
.frame-connector .tween-icon {
    font-size: 18px;
    font-weight: 700;
}
.frame-connector .no-tween-icon {
    opacity: 0.3;
}

/* Duration badge (top-right of frame thumb) */
.frame-duration-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,0.7);
    color: var(--text-secondary);
    font-size: 9px;
    padding: 1px 4px;
    border-radius: 3px;
    cursor: pointer;
    z-index: 2;
    line-height: 1.3;
}
.frame-duration-badge:hover {
    background: var(--accent);
    color: #fff;
}

/* Frame popover */
.frame-popover .toggle-switch {
    width: 28px;
    height: 14px;
    flex-shrink: 0;
}
.frame-popover input[type="number"],
.frame-popover select {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 2px 4px;
}

/* Transition connector (+) button */
.connector-plus {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-panel-hover);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    line-height: 1;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
}
.frame-connector:hover .connector-plus {
    background: var(--accent);
    color: #fff;
}
.transition-indicator {
    font-size: 10px;
    font-weight: 700;
    color: var(--info);
    background: rgba(92, 157, 237, 0.15);
    padding: 2px 4px;
    border-radius: 3px;
    cursor: pointer;
}

/* Transition Gallery */
.transition-gallery {
    position: fixed;
    z-index: 10000;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 12px;
    width: 340px;
    max-height: 420px;
    overflow-y: auto;
}
.tg-header {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.tg-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}
.tg-item {
    padding: 6px 4px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    text-align: center;
    font-size: 10px;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}
.tg-item:hover {
    border-color: var(--accent);
    background: var(--accent-dim);
}
.tg-item.active {
    background: var(--accent-dim);
    border-color: var(--accent);
    color: var(--text-primary);
}
.tg-item svg {
    display: block;
}
.tg-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    font-size: 11px;
}
.tg-footer input[type="number"] {
    width: 60px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 2px 4px;
    font-size: 11px;
}
