/* ==========================================================================
   Rundown Panel Styles (Event Timeline Control)
   Phase 10: Horizontal Timeline UI Upgrade
   ========================================================================== */

.rundown-panel {
    position: fixed;
    bottom: -400px;
    /* Hidden by default */
    left: 280px;
    /* Offset sidebar */
    right: 320px;
    /* Offset Inspector */
    height: 350px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
    z-index: 900;
    display: flex;
    flex-direction: column;
    transition: bottom 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.rundown-panel.active {
    bottom: 30px;
    /* Just above status bar */
}

/* ─── Header ─── */
.rp-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    border-radius: 12px 12px 0 0;
}

.rp-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    letter-spacing: 0.5px;
}

.rp-controls {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ─── Body & Transport ─── */
.rp-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.rp-transport {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
}

.rp-tbtn {
    background: var(--fill-tertiary);
    border: none;
    color: var(--text-primary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.rp-tbtn:hover {
    background: var(--fill-secondary);
    transform: scale(1.05);
}

.rp-tbtn.rp-play {
    width: auto;
    padding: 0 16px;
    border-radius: 16px;
    background: var(--accent);
    font-weight: 600;
}

.rp-tbtn.rp-play:hover {
    background: #006ce6;
}

.rp-timecode {
    margin-left: auto;
    font-family: monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--accent);
    letter-spacing: 1px;
    background: #000;
    padding: 4px 12px;
    border-radius: 4px;
    border: 1px solid #333;
}

/* ─── Horizontal Timeline Area ─── */
.rp-timeline-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-x: auto;
    overflow-y: hidden;
    position: relative;
    background: #111;
}

/* Ruler / Time Scale */
.rp-ruler {
    height: 24px;
    background: #1a1a1d;
    border-bottom: 1px solid #333;
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    position: relative;
}

.rp-ruler-tick {
    position: absolute;
    bottom: 0;
    border-left: 1px solid #555;
    height: 8px;
}

.rp-ruler-tick.major {
    height: 12px;
    border-left-color: #888;
}

.rp-ruler-label {
    position: absolute;
    top: 2px;
    font-size: 10px;
    color: #888;
    transform: translateX(-50%);
    font-family: monospace;
}

/* Tracks Container */
.rp-tracks {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
}

/* Playhead Indicator */
.rp-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--accent);
    z-index: 20;
    pointer-events: none;
    transform: translateX(-50%);
    /* Center the line on the exact time */
}

.rp-playhead::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid var(--accent);
}

/* Individual Track */
.rp-track {
    height: 48px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid #222;
    position: relative;
    display: flex;
    align-items: center;
}

/* Track Header (Left side fixed, optional if we implement a complex grid, 
   but for now we'll just float it or let items arrange absolutely) */

/* Timeline Cue Block */
.rp-cue-block {
    position: absolute;
    height: 36px;
    top: 6px;
    border-radius: 4px;
    padding: 4px 8px;
    color: #fff;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    transition: filter 0.2s, border-color 0.2s;
    user-select: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.rp-cue-block:hover {
    filter: brightness(1.2);
}

.rp-cue-block.active {
    border-color: #fff;
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

/* Colors by System Type */
.rp-cue-block.sys-master {
    background: linear-gradient(180deg, #444, #222);
    border-left: 4px solid #888;
}

.rp-cue-block.sys-video {
    background: linear-gradient(180deg, #1e4b30, #0a2615);
    border-left: 4px solid #32d74b;
}

.rp-cue-block.sys-lighting {
    background: linear-gradient(180deg, #4a1c6a, #2a0b40);
    border-left: 4px solid #bf5af2;
}

.rp-cue-block.sys-audio {
    background: linear-gradient(180deg, #704400, #3a2200);
    border-left: 4px solid #ff9f0a;
}

.rp-block-title {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.rp-block-meta {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.5);
}

/* ─── Add Form ─── */
.rp-add-form {
    padding: 12px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.rp-add-form input,
.rp-add-form select {
    background: var(--fill-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
}