/* RIGHT PANEL: TIMELINE */
.timeline-container {
    flex: 1;
    position: relative;
    overflow-y: auto;
    overflow-x: auto;
    background: #0f172a; /* Same as body */
    height: 100%; /* Force height constraint */
    max-height: 100%;
    cursor: crosshair;
}

/* ROTATE DEVICE PROMPT */
#rotate-prompt {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--bg-dark);
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 20px;
}

#rotate-prompt h2 { color: var(--primary); margin-bottom: 10px; }
#rotate-prompt p { color: var(--text-muted); max-width: 300px; line-height: 1.5; }
.rotate-icon { 
    font-size: 4rem; 
    margin-bottom: 20px; 
    animation: rotatePhone 2s infinite ease-in-out; 
}

@keyframes rotatePhone {
    0% { transform: rotate(0deg); }
    40% { transform: rotate(-90deg); }
    100% { transform: rotate(-90deg); }
}

@media screen and (max-width: 768px) and (orientation: portrait) {
    #rotate-prompt {
        display: flex;
    }
}
.ruler {
    height: var(--ruler-h);
    background: rgba(0,0,0,0.8);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 90;
}

.track-lanes {
    position: relative;
    width: 3000px; /* will be dynamic */
    min-height: calc(100% - var(--ruler-h)); /* Ensure grid reaches bottom */
}

.track-lane {
    height: var(--track-h);
    position: relative;
    /* Professional DAW Grid Lines */
    background-image: 
        linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px), /* Measure Line (Strong) */
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px); /* Beat Line (Faint) */
    background-size: var(--grid-measure, 200px) 100%, var(--grid-beat, 50px) 100%;
    transition: background-color 0.2s;
}

.track-lane:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.02); /* Alternating row colors */
}

.track-lane.drag-over {
    background-color: rgba(139, 92, 246, 0.1);
}

.region {
    position: absolute;
    top: 10px;
    height: calc(var(--track-h) - 20px);
    background: linear-gradient(180deg, var(--primary), var(--primary-hover));
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.2);
    box-shadow: 0 4px 10px rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
    overflow: hidden;
    cursor: grab;
    transition: box-shadow 0.2s, opacity 0.2s, border 0.2s;
}

.region:active {
    cursor: grabbing;
}

.region.selected {
    border: 2px solid #fff;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8);
    z-index: 50;
}

.region-delete {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 20px;
    height: 20px;
    background: rgba(239, 68, 68, 0.9);
    color: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 14px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    z-index: 10;
}

.region:hover .region-delete, .region.selected .region-delete {
    opacity: 1;
}

.region-delete:hover {
    background: #dc2626;
    transform: scale(1.1);
}

.region-handle {
    position: absolute;
    top: 0;
    width: 10px;
    height: 100%;
    cursor: ew-resize;
    z-index: 20;
    background: rgba(255, 255, 255, 0);
    transition: background 0.2s;
}

.region-handle:hover {
    background: rgba(255, 255, 255, 0.3);
}

.region-handle.left { left: 0; }
.region-handle.right { right: 0; }

.region.muted {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    box-shadow: none;
}

.playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    background: var(--accent);
    z-index: 95;
    pointer-events: none;
    box-shadow: 0 0 10px var(--accent);
}

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { 100% { transform: rotate(360deg); } }


