/* assets/css/timeline.css */

/* --- MAIN CONTAINER --- */
.timeline-container {
    /* Layout positioning */
    grid-column: 1 / -1; 
    grid-row: 2;         
    
    /* Flex Setup */
    display: flex;
    flex-direction: row; /* Explicitly set row */
    height: 300px; 
    width: 100%;
    
    /* Styling */
    background-color: #09090b; 
    border-top: 1px solid #222;
    color: #a1a1aa;
    overflow: hidden; /* Prevents outer scrollbars */
    box-sizing: border-box;
}

/* --- ZONE 1: TIMELINE SELECTOR (Far Left) --- */
.timeline-selector-panel {
    width: 200px;
    background-color: #0c0c0e;
    border-right: 1px solid #1f1f22;
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex-shrink: 0; /* Prevents shrinking */
    z-index: 10;
}

.panel-header {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #e4e4e7;
}

.timeline-list-item {
    background: #1f1f22;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    border: 1px solid transparent;
}

.timeline-list-item.active {
    background: #27272a;
    border: 1px solid #3f3f46;
}

/* --- ZONE 2: TRACK CONTROLS (Middle) --- */
.track-controls-panel {
    width: 280px; 
    display: flex;
    flex-direction: column;
    border-right: 1px solid #1f1f22;
    background-color: #09090b;
    flex-shrink: 0; /* Prevents shrinking */
    z-index: 10;
}

/* Top Toolbar inside Zone 2 */
.controls-toolbar {
    height: 48px; 
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 8px;
    border-bottom: 1px solid #1f1f22;
    box-sizing: border-box;
}

.main-play-btn {
    width: 32px; height: 32px;
    background: #27272a;
    border: 1px solid #3f3f46;
    border-radius: 6px;
    color: #e4e4e7;
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.main-play-btn:hover { background: #3f3f46; }

.icon-action {
    background: transparent;
    border: none;
    color: #a1a1aa;
    cursor: pointer;
    padding: 4px 8px;
}
.icon-action:hover { color: #fff; }

.time-code-box {
    background: #000;
    border: 1px solid #27272a;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: 'Inter', monospace;
    font-size: 12px;
    color: #e4e4e7;
    min-width: 60px;
    text-align: center;
}

.time-code-box .blue { color: #0084ff; font-weight: bold; margin-right: 4px; }

/* Control Rows (Left Sidebar) */
.track-headers-list {
    flex: 1;
    overflow-y: auto; /* Changed to auto to allow vertical scroll if needed */
    padding-top: 10px;
}

.t-row {
    height: 40px; 
    display: flex; 
    align-items: center; 
    padding: 0 16px;
    font-size: 12px;
}

.label-row { color: #a1a1aa; gap: 8px; font-weight: 500; }

.input-row { justify-content: space-between; }
.input-row label { font-size: 11px; color: #52525b; width: 60px; }
.input-row.active label.blue { color: #0084ff; }

.inputs-group { display: flex; gap: 4px; }
.inputs-group input {
    /* width: 42px; */
    width: 100%;
    background: #18181b;
    border: 1px solid #27272a;
    border-radius: 6px;
    color: #e4e4e7;
    padding: 4px 0;
    text-align: left;
    font-size: 11px;
    outline: none;
    text-indent: 7px;
}

.inputs-group.blue-border input {
    border-color: #0084ff;
    background: rgba(0, 132, 255, 0.05);
}

.footer-action-area { padding: 12px 16px; border-top: 1px solid #1f1f22; }
.btn-add-animate {
    width: 100%; background: #27272a; border: none; color: #a1a1aa;
    padding: 8px; border-radius: 8px; cursor: pointer; font-size: 12px;
}
.btn-add-animate:hover { color: #fff; background: #3f3f46; }

/* --- ZONE 3: THE GRID PANEL (Right) --- */
.timeline-grid-panel {
    flex: 1; /* Takes remaining width */
    min-width: 0; /* CRITICAL FIX: Allows flex container to shrink correctly */
    display: flex;
    flex-direction: column;
    background: #09090b;
    position: relative;
    overflow-x: auto; /* Enables horizontal scrolling */
    overflow-y: hidden;
}

/* Inner Wrapper to hold Ruler and Tracks together */
.grid-scroll-content {
    min-width: 1000px; /* Forces the horizontal scroll width */
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

/* Ruler */
.ruler-bar {
    padding: 0; 
    height: 30px;
    /* border-bottom: 1px solid #1f1f22; */
    background: #09090b;
    position: relative;
    z-index: 20;
    overflow: hidden; 
    
    /* [FIX] Re-enable pointer events so you can click/drag */
    pointer-events: auto; 
    cursor: pointer; /* Shows hand cursor to indicate interactivity */
    
    user-select: none;
}

/* Ticks decoration */
/* Update this specific block */
/* Remove the old CSS-based ticks (::after) */
.ruler-bar::after {
    display: none;
}

/* [NEW] Dynamic JS-generated labels */
.ruler-label {
    position: absolute;
    top: 0;
    bottom: 0;
    font-size: 10px;
    color: #71717a;
    display: flex;
    align-items: center;
    padding-left: 6px; /* Small offset from line */
    border-left: 1px solid #27272a; /* The tick mark */
    pointer-events: none;
    white-space: nowrap;
}

/* [NEW] Millisecond Sub-ticks (Greenish to match context?) */
.ruler-label.sub-tick {
    height: 10px; /* Shorter tick */
    top: auto;
    bottom: 0;
    border-left: 1px solid #00e054; /* Highlight color */
    color: #00e054;
    font-size: 9px;
    opacity: 0.8;
}

/* Tracks Grid Area */
.tracks-area {
    flex: 1; /* Fills remaining height */
    position: relative;
    padding-top: 10px;
    width: 100%;
    /* Subgrid Background pattern */
    /* background-image: 
        linear-gradient(#1f1f22 1px, transparent 1px), 
        linear-gradient(90deg, #121214 1px, transparent 1px);
    background-size: 100% 40px, 100px 100%; */
}

/* Lanes */
.grid-lane {
    height: 40px; 
    position: relative;
    width: 100%;
    /* border-bottom: 1px solid #121214; Optional, background grid handles this now */
}

/* Keyframes / Clips */
.clip {
    position: absolute;
    top: 8px; 
    height: 24px;
    border-radius: 4px;
    z-index: 20;
    cursor: pointer;
    transition: transform 0.1s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.clip:hover { transform: scaleY(1.1); z-index: 30; }

.pill-gray { 
    background: #3f3f46; 
    border: 1px solid #52525b; 
    top: -2px;
}

.pill-dark { 
    background: #18181b; 
    border: 1px solid #27272a; 
    top: -2px;
}

.pill-delay { 
    background: #3f3f46; 
    border: 1px solid #52525b; 
    top: -2px;
}

/* --- PLAYHEAD --- */
.playhead-wrapper {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 32%; 
    z-index: 100;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: left 0.1s linear; /* Smooth movement */
}

/* [NEW] Remove transition INSTANTLY when dragging for 1:1 mouse tracking */
.playhead-wrapper.is-dragging {
    transition: none !important;
    cursor: grabbing;
}

.playhead-tag {
    background: #00e699; 
    color: #000;
    font-weight: 700;
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    margin-bottom: 2px;
    box-shadow: 0 2px 10px rgba(0, 230, 153, 0.3);
    white-space: nowrap;
}

.playhead-line {
    width: 2px;
    flex: 1;
    background: #00e699;
    box-shadow: 0 0 8px rgba(0, 230, 153, 0.4);
}

/* Visual feedback for Selected Clips */
.clip.active-clip {
    border: 1px solid #00e699 !important; /* Pro Green Border */
    box-shadow: 0 0 8px rgba(0, 230, 153, 0.2);
    z-index: 50; /* Bring to front */
}

/* --- UTILITY: PREVENT SELECTION --- */
.timeline-container, 
.timeline-container * {
    user-select: none; /* Standard */
    -webkit-user-select: none; /* Safari/Chrome */
    -moz-user-select: none; /* Firefox */
}

/* Ensure the cursor stays consistent when dragging */
body.is-dragging-timeline {
    cursor: grabbing !important;
}

/* --- CUSTOM SCROLLBAR (Dark Theme) --- */
.timeline-grid-panel::-webkit-scrollbar {
    height: 10px; /* Horizontal height */
    width: 10px;  /* Vertical width (if needed) */
    background: #09090b;
}

.timeline-grid-panel::-webkit-scrollbar-track {
    background: #09090b;
    border-top: 1px solid #1f1f22; /* Subtle separator line */
}

.timeline-grid-panel::-webkit-scrollbar-thumb {
    background-color: #27272a; /* Thumb color */
    border-radius: 5px; /* Rounded pill shape */
    border: 2px solid #09090b; /* Creates a "padding" effect around the thumb */
}

.timeline-grid-panel::-webkit-scrollbar-thumb:hover {
    background-color: #3f3f46; /* Lighter on hover */
}

/* --- PILL VARIANTS (Muted Vibe) --- */
/* 1. Target (Muted Rose) */
.pill-target { background-color: #881337; border: 1px solid #be123c; }
/* 2. Find (Muted Indigo) */
.pill-find { background-color: #3730a3; border: 1px solid #4f46e5; }
/* 3. Click (Muted Blue) */
.pill-click { background-color: #075985; border: 1px solid #0ea5e9; }
/* 4. Keyboard (Muted Emerald) */
.pill-keyboard { background-color: #064e3b; border: 1px solid #10b981; }
/* 5. Delay (Muted Amber) */
.pill-delay { background-color: #78350f; border: 1px solid #d97706; }

/* Text inside pills */
.clip .clip-label {
    pointer-events: none; /* Let clicks pass through to the pill */
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
    line-height: 22px; /* Center vertically in 24px height */
}
/* --- DYNAMIC PROPERTY PANEL STYLES --- */

/* Empty State */
.empty-selection-msg {
    padding: 20px;
    text-align: center;
    color: #52525b;
    font-size: 12px;
    font-style: italic;
}

/* Image Grid (For Target/Find) */
.prop-image-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 8px 16px 16px;
}
.prop-img-box {
    width: 48px; height: 48px;
    border-radius: 6px;
    border: 1px solid #3f3f46;
    background: #000;
    overflow: hidden;
    cursor: pointer;
    position: relative;
}
.prop-img-box img {
    width: 100%; height: 100%;
    object-fit: cover;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.prop-img-box:hover img { opacity: 1; }
.prop-img-box.add-new {
    display: flex; align-items: center; justify-content: center;
    background: #18181b; color: #52525b;
}

/* Toggle Switch (For Left/Right Click & Random/Fixed) */
.prop-toggle-container {
    padding: 0 16px 16px;
}
.prop-toggle-pill {
    display: flex;
    background: #18181b;
    padding: 2px;
    border-radius: 6px;
    border: 1px solid #27272a;
}
.prop-toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    color: #71717a;
    font-size: 11px;
    cursor: pointer;
    padding: 6px;
    border-radius: 4px;
    text-align: center;
    font-weight: 500;
}
.prop-toggle-btn.active {
    background: #27272a;
    color: #e4e4e7;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* Text Area (For Keyboard) */
.prop-textarea {
    width: 100%;
    background: #18181b;
    border: 1px solid #27272a;
    color: #e4e4e7;
    border-radius: 6px;
    padding: 8px;
    font-size: 12px;
    font-family: monospace;
    resize: none;
    outline: none;
    margin: 0 16px 16px;
    width: calc(100% - 32px); /* Account for margins */
}
.prop-textarea:focus { border-color: #0084ff; }

/* --- CUSTOM SCROLLBAR: LEFT PANEL (Vertical) --- */
.track-headers-list {
    overflow-y: auto; /* Enables vertical scrolling */
    overflow-x: hidden;
    /* Ensure it fills the available flex space so scrollbar appears when needed */
    height: 100%; 
}

/* Scrollbar Styling (Matches Timeline) */
.track-headers-list::-webkit-scrollbar {
    width: 10px;  /* Vertical width */
    background: #09090b;
}

.track-headers-list::-webkit-scrollbar-track {
    background: #09090b;
    border-left: 1px solid #1f1f22; /* Separator on the left side of scrollbar */
}

.track-headers-list::-webkit-scrollbar-thumb {
    background-color: #27272a; 
    border-radius: 5px; 
    border: 2px solid #09090b; /* Creates "padding" effect */
}

.track-headers-list::-webkit-scrollbar-thumb:hover {
    background-color: #3f3f46; 
}

/* --- PILL VISUALS: ICONS & DELETE --- */

/* Adjust label layout to hold icon + text + delete btn */
.clip .clip-content {
    display: flex;
    align-items: center;
    gap: 6px; /* Space between icon and text */
    height: 100%;
    padding: 0 6px;
    width: 100%;
    box-sizing: border-box;
}

.clip .clip-icon {
    font-size: 10px;
    opacity: 0.9;
}

/* The Label Text */
.clip .clip-label {
    flex: 1;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: normal;
    pointer-events: none;
}

/* The Delete 'X' Button */
/* The Delete 'X' Button */
.clip .clip-delete-btn {
    display: none; /* Hidden by default */
    font-size: 10px;
    color: #fff;
    background: rgba(0,0,0,0.3);
    width: 14px; height: 14px;
    border-radius: 50%;
    align-items: center; 
    justify-content: center;
    cursor: pointer;
    z-index: 10;
}
.clip .clip-delete-btn:hover {
    background: #ef4444; /* Red on hover */
}

/* [CHANGED] Show ONLY when clip is active (selected) */
/* Previously: .clip:hover .clip-delete-btn */
.clip.active-clip .clip-delete-btn {
    display: flex;
}

/* [NEW] Explicitly hide if currently resizing, even if active */
/* This prevents the X from getting in the way while dragging the handle */
.clip.is-resizing .clip-delete-btn {
    display: none !important;
}

/* --- PROPERTY PANEL COMPONENTS --- */

/* Save Button Footer */
.panel-save-container {
    padding: 16px;
    border-top: 1px solid #1f1f22;
    margin-top: auto; /* Push to bottom if using flex column */
}
.btn-save-prop {
    width: 100%;
    background: #00e699; /* Pro Green */
    color: #000;
    border: none;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}
.btn-save-prop:hover {
    background: #10b981;
}

/* Toggle Button (Yes/No) */
.btn-toggle-bool {
    background: #18181b;
    border: 1px solid #27272a;
    color: #71717a;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    width: 100%;
}
.btn-toggle-bool.active {
    background: rgba(0, 230, 153, 0.15);
    border-color: #00e699;
    color: #00e699;
}

/* Keyboard Preview Area */
.preview-container {
    padding: 0 16px 16px;
}
.btn-preview {
    background: #27272a;
    color: #e4e4e7;
    border: 1px solid #3f3f46;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    margin-bottom: 8px;
    display: flex; align-items: center; gap: 6px;
}
.btn-preview:hover { background: #3f3f46; }

.preview-output-box {
    background: #000;
    border: 1px solid #27272a;
    border-radius: 6px;
    padding: 8px;
    font-family: monospace;
    font-size: 12px;
    color: #00e699; /* Hacker green text */
    min-height: 40px;
    white-space: pre-wrap;
    word-break: break-all;
}
/* Blinking cursor for effect */
.preview-cursor {
    display: inline-block;
    width: 6px; height: 12px;
    background: #00e699;
    margin-left: 2px;
    animation: blink 1s infinite;
}
@keyframes blink { 50% { opacity: 0; } }

/* --- TOAST NOTIFICATION --- */
/* --- TOAST NOTIFICATIONS --- */
/* --- TOAST NOTIFICATIONS --- */
.timeline-toast {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    
    /* [CHANGED] Toned down Green (Deep Emerald) */
    background: #065f46; 
    
    /* [CHANGED] Text is now off-white with a slight tint, less harsh */
    color: #d1fae5; 
    
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500; /* Slightly lighter weight looks cleaner */
    letter-spacing: 0.3px;
    
    display: flex;
    align-items: center;
    gap: 10px;
    
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    /* Soft shadow to separate it from the dark UI */
    box-shadow: 0 4px 12px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.05);
}

/* Error State (Deep Red) */
.timeline-toast.error {
    background: #7f1d1d; /* Darker, richer red */
    color: #fecaca;      /* Soft red text */
}

/* Show State */
.timeline-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.timeline-toast i {
    font-size: 14px;
    opacity: 0.9; /* Slightly transparent icon */
}
/* Ruler stays fixed at top */
/* --- RULER UPDATES --- */

/* --- RULER UPDATES --- */

.ruler-bar {
    padding: 0; 
    height: 30px;
    /* border-bottom: 1px solid #1f1f22; */
    background: #09090b;
    position: relative;
    z-index: 20;
    overflow: hidden; 
    
    /* Keep this to allow clicking */
    pointer-events: auto; 
    
    /* [CHANGE] Set to default (arrow) instead of pointer (hand) */
    cursor: default; 
    
    user-select: none;
}

/* The Wrapper for a single tick (Tick + Text) */
.ruler-marker {
    width: 0px;
    position: absolute;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translateX(-50%);
    
    /* [IMPORTANT] Ignore clicks on the numbers so they hit the bar instead */
    pointer-events: none; 
}

/* [FIX] Ensure the very first marker (0s) isn't cut off on the left */
.ruler-marker.main[style*="left: 0px"],
.ruler-marker.main[style*="left: 0;"] {
    transform: translateX(0); /* Anchor left edge to 0 */
    align-items: flex-start;  /* Align text left */
}

/* The Line/Tick itself */
.ruler-marker .ruler-tick {
    width: 1px;
    background: #27272a;
}

/* The Text Label */
.ruler-marker .ruler-text {
    font-size: 10px;
    color: #71717a;
    margin-bottom: 2px;
    font-family: monospace;
}

/* --- VARIANTS --- */

/* 1. Main Seconds (0s, 1s...) */
.ruler-marker.main .ruler-tick {
    height: 12px;
    background: #3f3f46;
}
.ruler-marker.main .ruler-text {
    color: #a1a1aa;
    font-weight: 600;
}

/* 2. Micro Ticks (Milliseconds) */
.ruler-marker.micro .ruler-tick {
    height: 6px;
    background: #27272a;
}

/* 3. Delay Highlight (e.g. 4.5s) */
.ruler-marker.sub-label .ruler-tick {
    height: 12px;
    /* [CHANGE COLOR HERE] */
    background: #d97706; /* Matches the Delay Orange */
}
.ruler-marker.sub-label .ruler-text {
    /* [CHANGE COLOR HERE] */
    color: #d97706; 
    font-size: 9px;
    font-weight: 700;
}

/* TRACKS AREA: Split into Action Lane (Top) and Delay Lane (Bottom) */
.tracks-area {
    position: relative;
    height: 140px; /* Fixed height for the split view */
    min-width: 100%;
    /* Background Grid Lines */
    /* background-image: 
        linear-gradient(to right, #1f1f22 1px, transparent 1px),
        linear-gradient(to bottom, #1f1f22 1px, transparent 1px);
    background-size: 120px 100%, 100% 40px;  */
}

/* The divider line */
.track-separator {
    position: absolute;
    top: 65px;
    left: 0; right: 0;
    height: 1px;
    background: #27272a;
    border-bottom: 1px dashed #000;
    z-index: 0;
}

/* --- CLIPS (Smaller Size) --- */
.clip {
    position: absolute;
    height: 26px; /* Compact height */
    border-radius: 4px;
    z-index: 10;
    cursor: grab;
    user-select: none;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    
    /* [UPDATED] Added opacity and transform to transitions for the dissolve effect */
    transition: 
        left 0.2s cubic-bezier(0.2, 0, 0, 1), 
        top 0.2s ease, 
        width 0.2s ease,
        opacity 0.2s ease-out,      /* Smooth fade in */
        transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1); /* Slight pop effect */
}

.clip.is-dragging {
    cursor: grabbing;
    z-index: 100;
    transition: none; /* No transition while dragging manually */
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    opacity: 0.9;
    pointer-events: none; /* Let mouse events pass to detect drop zones */
}

/* Standard Width for Actions */
/* .clip:not(.pill-delay) {
    width: 100px !important; 
} */

/* Delay Pill */
.pill-delay {
    min-width: 40px;
    /* Striped pattern for delay */
    background-image: repeating-linear-gradient(
        45deg,
        rgba(0,0,0,0.1),
        rgba(0,0,0,0.1) 5px,
        transparent 5px,
        transparent 10px
    );
}

/* --- PLACEHOLDER (The Visualizer) --- */
.clip-placeholder {
    position: absolute;
    height: 26px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed #52525b;
    border-radius: 4px;
    z-index: 5;
    pointer-events: none;
    transition: left 0.2s cubic-bezier(0.2, 0, 0, 1); /* Snap smoothly */
}

/* --- ACTIVE STATE --- */
.clip.active-clip {
    border: 1px solid #fff !important;
    box-shadow: 0 0 0 1px #fff, 0 4px 12px rgba(0,0,0,0.5);
    z-index: 50;
}

/* --- RESIZE HANDLES & TOOLTIP --- */

/* Container handles - only visible on Delay clips */
.clip.pill-delay .resize-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 10px; /* Hit area */
    cursor: col-resize;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0; /* Hidden by default, visible on hover */
    transition: opacity 0.2s;
}

/* Visual bar inside the handle */
.clip.pill-delay .resize-handle::after {
    content: '';
    height: 14px;
    width: 4px;
    background-color: rgba(255, 255, 255, 0.4);
    border-radius: 2px;
}

.clip.pill-delay:hover .resize-handle,
.clip.pill-delay.is-resizing .resize-handle {
    opacity: 1;
}

.handle-left {
    left: 0;
    border-top-left-radius: 4px;
    border-bottom-left-radius: 4px;
}

.handle-right {
    right: 0;
    border-top-right-radius: 4px;
    border-bottom-right-radius: 4px;
}

/* Floating Tooltip */
.resize-tooltip {
    position: absolute;
    top: -28px;
    left: 50%;
    transform: translateX(-50%);
    background: #000;
    border: 1px solid #d97706; /* Match Delay color */
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    font-family: monospace;
    padding: 4px 8px;
    border-radius: 4px;
    white-space: nowrap;
    display: none;
    z-index: 100;
    pointer-events: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.5);
}

/* Show tooltip only during resizing */
.clip.is-resizing .resize-tooltip {
    display: block;
}

/* While resizing, force the cursor */
.clip.is-resizing {
    cursor: col-resize !important;
    z-index: 100; /* Bring to very front */
}

/* --- CLIP HOVER TOOLTIPS --- */
.clip-hover-info {
    position: absolute;
    bottom: 100%; /* Sits above the clip */
    left: 50%;
    transform: translateX(-50%);
    background: #09090b;
    border: 1px solid #3f3f46;
    color: #a1a1aa;
    padding: 4px 8px;
    font-size: 9px;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 100;
    margin-bottom: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Show on Hover */
.clip:hover .clip-hover-info {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

/* Text Highlight Color */
.clip-hover-info .val { 
    color: #00e699; 
    font-weight: 700; 
}

/* Warning State (No Images) */
.clip-hover-info.warn { 
    color: #f87171; 
    border-color: #7f1d1d;
}

/* Thumbnails Row */
.clip-hover-info.thumb-row { 
    padding: 3px; 
    gap: 3px; 
    background: #000;
}

.mini-thumb { 
    width: 16px; 
    height: 16px; 
    border-radius: 2px; 
    overflow: hidden; 
    background: #27272a; 
    border: 1px solid #3f3f46;
}

.mini-thumb img { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
}

/* --- TIMELINE SELECTOR PANEL (Simplified) --- */
.timeline-selector-panel {
    display: flex;
    flex-direction: column;
    background: #09090b;
    border-right: 1px solid #27272a;
    overflow-y: auto; 
    padding: 6px 0;
}

/* Header */
.timeline-selector-panel .panel-header {
    padding: 0 12px 6px 12px;
    margin-bottom: 2px;
    font-size: 10px; /* Smaller */
    font-weight: 700;
    color: #71717a;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header .fa-plus {
    cursor: pointer;
    font-size: 11px;
    transition: color 0.2s;
}
.panel-header .fa-plus:hover {
    color: #fff;
}

/* List Item Container */
.timeline-list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 12px; /* Tighter padding */
    color: #a1a1aa;
    cursor: pointer;
    font-size: 11px; /* Smaller Text */
    border-left: 2px solid transparent; 
    background: transparent;
    transition: all 0.1s ease;
    user-select: none;
    height: 28px; 
}

/* Hover State */
.timeline-list-item:hover {
    background: #18181b;
    color: #e4e4e7;
}

/* Active State - Yellow Accent */
.timeline-list-item.active {
    background: #27272a;
    color: #fff;
    margin: .5em 1em;
    border-left-color: #eab308;
}

/* Unsaved State - Subtle Dot */
.timeline-list-item.unsaved .tl-name::after {
    content: '';
    display: inline-block;
    width: 5px;
    height: 5px;
    background-color: #eab308;
    border-radius: 50%;
    margin-left: 6px;
    opacity: 0.8;
}

/* --- Left Content (Icon + Name) --- */
.timeline-info-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    overflow: hidden;
}

/* Timeline Name */
.tl-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    font-size: 11px; /* Explicitly smaller */
}

/* Renaming Input */
.timeline-name-input {
    background: #000;
    border: 1px solid #eab308;
    color: #fff;
    padding: 1px 4px;
    font-size: 11px;
    width: 100%;
    outline: none;
    border-radius: 2px;
}

/* --- Right Content (Count / Save) --- */
.timeline-info-right {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Action Count */
.badge-count {
    font-size: 9px;
    color: #52525b;
    font-weight: 500;
}

/* Save Button (Yellow - Old Design) */
.btn-timeline-save {
    background: #eab308;
    color: #000;
    border: none;
    padding: 1px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.btn-timeline-save:hover {
    background: #facc15;
}

/* Delete Icon */
.btn-timeline-del {
    opacity: 0;
    font-size: 10px;
    color: #71717a;
    cursor: pointer;
    transition: all 0.2s;
    padding: 2px;
}
.timeline-list-item:hover .btn-timeline-del {
    opacity: 1; 
}
.timeline-list-item:hover .btn-timeline-del:hover {
    color: #ef4444; 
}

/* Dragging Styles */
.timeline-list-item.dragging {
    opacity: 0.5;
    background: #000;
    border: 1px dashed #3f3f46;
}

/* --- Left Content (Name Only) --- */
.timeline-info-left {
    display: flex;
    align-items: center;
    /* [UPDATED] Removed gap since icon is gone */
    gap: 0; 
    flex: 1;
    overflow: hidden;
}

/* [REMOVED] Icon styles (.timeline-info-left i) are deleted */

/* Timeline Name */
.tl-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    font-size: 11px;
    padding-left: 2px; /* Slight padding for visual balance */
}

/* --- GHOST ADD BUTTON (+) --- */
/* --- GHOST ADD BUTTON (+) --- */
.ghost-add-btn {
    position: absolute;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    
    /* Default: Subtle dark style */
    background: #18181b; 
    border: 1px solid #3f3f46; 
    color: #71717a;
    
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    cursor: pointer;
    z-index: 50; 
    transition: all 0.15s ease;
    
    /* Hidden by default */
    opacity: 0;
    pointer-events: none;
    
    /* Centers the button exactly on the grid line/mouse */
    transform: translate(-50%, -50%); 
}

.ghost-add-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

/* Relaxed Hover Style (No strong glow) */
.ghost-add-btn:hover {
    background: #27272a; 
    border-color: #52525b; 
    color: #e4e4e7;
    transform: translate(-50%, -50%) scale(1.1);
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

/* --- QUICK ACTION MINI MENU --- */
.quick-action-menu {
    position: absolute;
    background: #09090b;
    border: 1px solid #27272a;
    border-radius: 8px;
    padding: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.6);
    z-index: 100;
    
    /* Default State: Hidden */
    opacity: 0;
    visibility: hidden;
    
    /* Default Direction: Downwards */
    transform: translateX(-50%) translateY(10px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    min-width: 120px;
}

.quick-action-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(10px);
}

/* Direction: Upwards (when close to bottom) */
.quick-action-menu.active.open-up {
    /* Flip up above the ghost button */
    /* -100% moves it up its own height, -35px accounts for button + gap */
    transform: translateX(-50%) translateY(-100%) translateY(-35px); 
}

.quick-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    color: #a1a1aa;
    font-size: 11px;
    transition: background 0.1s;
    white-space: nowrap;
}

.quick-menu-item:hover {
    background: #27272a;
    color: #fff;
}

/* Menu Icons Colors */
.quick-menu-item i { width: 16px; text-align: center; }
.quick-menu-item[data-type="TARGET"] i { color: #f472b6; }
.quick-menu-item[data-type="CLICK"] i { color: #3b82f6; }
.quick-menu-item[data-type="KEY"] i { color: #10b981; }
.quick-menu-item[data-type="DELAY"] i { color: #f59e0b; }

/* Icons in menu */
.quick-menu-item i {
    width: 16px;
    text-align: center;
}
.quick-menu-item:nth-child(1) i { color: #f472b6; } /* Target */
.quick-menu-item:nth-child(2) i { color: #3b82f6; } /* Click */
.quick-menu-item:nth-child(3) i { color: #10b981; } /* Key */
.quick-menu-item:nth-child(4) i { color: #f59e0b; } /* Delay */

/* --- Timeline Locked / Empty State --- */

/* The grid area container */
.tracks-area {
    position: relative; /* Ensure overlay sits inside */
    transition: opacity 0.3s ease;
}

/* When locked, dim the grid background, clips, and playhead */
.tracks-area.locked .grid-canvas,
.tracks-area.locked .dynamic-label,
.tracks-area.locked .clip,
.tracks-area.locked .playhead-wrapper { /* [NEW] Added playhead here */
    opacity: 0.15; /* Greyed out effect */
    pointer-events: none; /* Prevent clicks */
    filter: grayscale(100%);
}

/* The Overlay Container */
.timeline-lock-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
    z-index: 100;
}

/* Show when active */
.timeline-lock-overlay.active {
    display: flex;
}

/* Centered Message Box */
.lock-content {
    background: rgba(9, 9, 11, 0.85); /* Dark background */
    border: 1px solid #27272a;
    padding: 20px 30px;
    border-radius: 8px;
    text-align: center;
    backdrop-filter: blur(4px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    max-width: 300px;
}

.lock-content i {
    font-size: 24px;
    color: #52525b;
    margin-bottom: 12px;
}

.lock-content h3 {
    font-size: 14px;
    color: #fff;
    margin-bottom: 6px;
    font-weight: 600;
}

.lock-content p {
    font-size: 12px;
    color: #a1a1aa;
    line-height: 1.4;
    margin: 0;
}

/* Hide all clips by default on load */
.clip {
    display: none;
}