/* Sequence Stack (Right Edge) */
#sequencer-panel {
    position: relative;
    display: flex;
    flex-direction: row;
    /* Change to row to accommodate stack */
    flex-wrap: wrap;
    /* Allow wrapping for header */
    align-content: flex-start;
}

#sequencer-panel h2 {
    width: 100%;
    /* Header takes full width */
}

#sequencer-grid {
    flex: 1;
    /* Grid takes remaining space */
    min-width: 0;
    /* Prevent overflow */
}

.sequence-stack {
    width: 60px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 10px 0 10px 10px;
    border-left: 1px solid rgba(0, 0, 0, 0.1);
    margin-left: 10px;
}

.sequence-card {
    width: 40px;
    height: 40px;
    background-color: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: bold;
    color: #777;
    transition: all 0.2s;
    position: relative;
    border: 2px solid transparent;
}

.sequence-card:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: translateX(-2px);
}

.sequence-card.active {
    background-color: var(--primary-color);
    color: white;
    box-shadow: 0 4px 8px rgba(211, 84, 0, 0.3);
}

.sequence-card.playing {
    border-color: var(--secondary-color);
}

.sequence-card.add-btn {
    background-color: transparent;
    border: 2px dashed #ccc;
    color: #ccc;
    font-size: 1.5rem;
}

.sequence-card.add-btn:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background-color: transparent;
}

.seq-delete-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 16px;
    height: 16px;
    background: var(--danger-color);
    color: white;
    border-radius: 50%;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.sequence-card:hover .seq-delete-btn {
    opacity: 1;
}

/* Timeline (Bottom) */
.timeline-container {
    width: 100%;
    height: 80px;
    /* Increased height for mini-grid */
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    display: flex;
    align-items: center;
    padding: 5px;
    gap: 5px;
    overflow-x: auto;
}

.timeline-block {
    height: 100%;
    min-width: 100px;
    /* Wider for grid */
    background: #eee;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    flex: 1;
    border: 2px solid transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px;
}

.timeline-block.active {
    background: #ddd;
    /* Slightly darker when active, grid provides color */
    border: 2px solid var(--primary-color);
}

.timeline-block.playing {
    border-color: var(--secondary-color);
    box-shadow: 0 0 5px var(--secondary-color);
}

/* Timeline Overlay Wrapper */
.timeline-wrapper {
    position: relative;
    width: 100%;
    margin-top: 20px;
}

/* Horizontal Timeline overrides */
.timeline-container {
    /* Remove top margin as wrapper handles it */
    margin-top: 0;
}


/* Vertical Timeline (New) */
.timeline-container-vertical {
    display: flex;
    flex-direction: column;
    width: 120px;
    height: 400px;
    background: rgba(0, 0, 0, 0.05);
    /* Optional: Keep partial bg? */
    border-radius: 8px;
    gap: 10px;
    padding: 5px;
    overflow-y: auto;

    /* Overlay Positioning */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* Re-use and overriding for blocks in vertical mode */
.vertical-block {
    width: 100%;
    /* Override min-width if needed */
    min-width: unset;
    height: 80px;
    /* Fixed height */
    margin-bottom: 5px;
}

/* Mini Grid inside Timeline Block */
.mini-grid {
    display: flex;
    width: 100%;
    height: 100%;
    gap: 1px;
}

.mini-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    /* Top down to match sequencer rows */
    gap: 1px;
    background: rgba(0, 0, 0, 0.05);
}

.mini-note {
    flex: 1;
    width: 100%;
    border-radius: 1px;
    min-height: 4px;
    /* Ensure visible even if many notes */
}