/* STYLES FOR STAGE SYNC CLOUD OPERATOR & EDITOR */

:root {
    --bg-dark: #09090b;
    --bg-card: rgba(24, 24, 27, 0.75);
    --bg-input: rgba(39, 39, 42, 0.5);
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(139, 92, 246, 0.15);
    
    --primary: #a855f7;
    --primary-glow: rgba(168, 85, 247, 0.4);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6, 182, 212, 0.4);
    --green: #22c55e;
    --red: #ef4444;
    --yellow: #f59e0b;
    
    --text-main: #f4f4f5;
    --text-muted: #a1a1aa;
    --font-primary: 'Inter', sans-serif;
    --font-accent: 'Outfit', sans-serif;
    --font-mono: 'Space Grotesk', sans-serif;
    
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    --transition-speed: 0.25s;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: rgba(168, 85, 247, 0.3) transparent;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(168, 85, 247, 0.3);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-primary);
    overflow: hidden;
    height: 100vh;
    width: 100vw;
    background-image: 
        radial-gradient(at 10% 20%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
        radial-gradient(at 90% 80%, rgba(6, 182, 212, 0.1) 0px, transparent 50%);
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* NAVBAR */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background-color: rgba(9, 9, 11, 0.85);
    backdrop-filter: blur(12px);
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.3rem;
    font-family: var(--font-accent);
    font-weight: 800;
    letter-spacing: 1px;
}

.glow-purple {
    color: var(--primary);
    text-shadow: 0 0 10px var(--primary-glow);
}

.accent-text {
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
}

.active-song-info {
    font-family: var(--font-accent);
    font-size: 0.95rem;
    background: rgba(168, 85, 247, 0.08);
    border: 1px solid rgba(168, 85, 247, 0.2);
    padding: 0.4rem 1.2rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.05);
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--green);
    box-shadow: 0 0 8px var(--green);
}

/* MAIN WORKSPACE */
.workspace {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.5rem;
    padding: 1.5rem;
    height: calc(100vh - 70px);
    flex-grow: 1;
}

/* CARDS COMMON */
.card {
    background-color: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(12px) saturate(180%);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: border-color var(--transition-speed);
}

.card:hover {
    border-color: var(--border-glow);
}

.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h3 {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-main);
}

/* LEFT SIDEBAR: FILE MANAGER */
.sidebar {
    height: 100%;
}

.search-box {
    margin: 1rem 1.25rem 0.5rem;
    position: relative;
}

.search-box i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.search-box input {
    width: 100%;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: var(--primary);
}

.upload-zone {
    margin: 0.5rem 1.25rem;
    padding: 1.25rem 1rem;
    border: 2px dashed rgba(168, 85, 247, 0.3);
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    background: rgba(168, 85, 247, 0.02);
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
}

.upload-zone:hover {
    background: rgba(168, 85, 247, 0.05);
    border-color: var(--primary);
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.05);
}

.upload-zone i {
    font-size: 1.8rem;
    color: var(--primary);
    margin-bottom: 0.2rem;
}

.upload-zone p {
    font-size: 0.8rem;
}

.upload-zone span {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.projects-list-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0; /* FIX: obliga al contenedor a encogerse y activar scroll */
    padding: 0.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.project-card {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: transparent;
    transition: background 0.2s;
}

.project-card:hover {
    background: rgba(255, 255, 255, 0.04);
    transform: translateY(-2px);
    border-color: rgba(168, 85, 247, 0.2);
}

.project-card.active {
    background: rgba(168, 85, 247, 0.05);
    border-color: rgba(168, 85, 247, 0.3);
}

.project-card.active::before {
    background: var(--primary);
}

.project-meta-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.3rem;
}

.project-title {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 170px;
}

.project-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
}

.badge-key {
    background: rgba(6, 182, 212, 0.15);
    color: var(--cyan);
    border: 1px solid rgba(6, 182, 212, 0.25);
}

.project-meta-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.project-delete-btn {
    opacity: 0;
    background: transparent;
    border: none;
    color: var(--red);
    cursor: pointer;
    padding: 0.2rem;
    transition: opacity 0.2s, transform 0.2s;
}

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

.project-delete-btn:hover {
    transform: scale(1.15);
}

/* CENTER PANEL: MIXER & TRANSPORT */
.main-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    height: 100%;
}

.transport-bar {
    padding: 1.25rem;
    display: flex;
    flex-direction: row; /* Sobrescribir flex-direction: column heredado de .card */
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
}

.controls-left {
    display: flex;
    gap: 0.75rem;
}

.transport-btn {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.25s;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.transport-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.transport-btn:hover:not(:disabled) {
    transform: scale(1.1);
}

.play-btn {
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

.play-btn:hover:not(:disabled) {
    box-shadow: 0 0 25px var(--primary);
}

.pause-btn:hover:not(:disabled) {
    background: var(--cyan);
    color: #000;
}

.stop-btn:hover:not(:disabled) {
    background: var(--red);
}

.time-display {
    text-align: center;
}

.digital-clock {
    font-family: var(--font-mono);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-glow);
    letter-spacing: 1px;
}

.beats-counter {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-top: 0.1rem;
}

.pulse-text {
    font-weight: 700;
    color: var(--primary);
}

.metronome-control {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.metronome-visual-indicator {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.1s, box-shadow 0.1s;
}

.metronome-visual-indicator.accent {
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
}

.metronome-visual-indicator.beat {
    background: var(--cyan);
    box-shadow: 0 0 15px var(--cyan);
}

.master-mixer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    width: 130px;
}

.master-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--text-muted);
}

.mini-visualizer {
    width: 100%;
    height: 18px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

/* MIXER CARD & SLIDERS */
.mixer-card {
    flex-grow: 1;
}

.stems-mixer-grid {
    padding: 1.5rem;
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    flex-grow: 1;
    min-height: 0; /* FIX: asegura que no desborde verticalmente */
    align-items: center;
    justify-content: flex-start;
}

.empty-mixer-message {
    width: 100%;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font-accent);
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
    padding: 3rem;
}

.empty-mixer-message i {
    font-size: 3rem;
    opacity: 0.3;
}

/* MIXER STRIP (CHANNEL STRIP) */
.mixer-strip {
    width: 85px;
    min-width: 85px;
    height: 300px;
    background: rgba(20, 20, 25, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.6rem 0.4rem;
    gap: 0.4rem;
    position: relative;
    transition: all 0.2s ease;
    backdrop-filter: blur(5px);
}

.mixer-strip:hover {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(168, 85, 247, 0.25);
}

.strip-name {
    font-size: 0.68rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    color: #f3f4f6;
    font-family: var(--font-accent);
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.strip-fader-container {
    height: 140px;
    width: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Cross-browser rotated vertical slider */
.strip-fader-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 120px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-90deg);
    margin: 0;
}

/* Slider Thumb styling */
.strip-fader-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 20px;
    border-radius: 3px;
    background: var(--cyan);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background 0.1s, transform 0.1s;
}

.strip-fader-container input[type="range"]::-webkit-slider-thumb:hover {
    background: #22d3ee;
    transform: scale(1.05) translate(-50%, -50%);
}

.strip-fader-container input[type="range"]::-webkit-slider-thumb:active {
    background: var(--primary);
    box-shadow: 0 0 10px rgba(168, 85, 247, 0.8);
}

.strip-fader-container input[type="range"]::-moz-range-thumb {
    width: 12px;
    height: 20px;
    border-radius: 3px;
    background: var(--cyan);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.strip-buttons {
    display: flex;
    gap: 0.25rem;
    width: 100%;
    margin-top: auto;
}

.strip-btn {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 800;
    padding: 0.25rem 0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.strip-btn:hover {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.05);
}

.strip-btn.mute.active {
    background: rgba(239, 68, 68, 0.2);
    color: var(--red);
    border-color: var(--red);
    box-shadow: 0 0 5px rgba(239, 68, 68, 0.2);
}

.strip-btn.solo.active {
    background: rgba(245, 158, 11, 0.2);
    color: var(--yellow);
    border-color: var(--yellow);
    box-shadow: 0 0 5px rgba(245, 158, 11, 0.2);
}

/* Interactive Channel routing badge */
.strip-routing-badge {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--cyan);
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s ease;
    width: 100%;
    text-align: center;
}

.strip-routing-badge:hover {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--cyan);
    box-shadow: 0 0 5px rgba(6, 182, 212, 0.3);
}

.strip-routing-badge.ch2 {
    color: var(--primary);
    background: rgba(168, 85, 247, 0.1);
    border-color: rgba(168, 85, 247, 0.2);
}

.strip-routing-badge.ch2:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--primary);
    box-shadow: 0 0 5px rgba(168, 85, 247, 0.3);
}

.strip-delete {
    background: transparent;
    border: none;
    color: rgba(239, 68, 68, 0.4);
    cursor: pointer;
    font-size: 0.65rem;
    transition: color 0.15s ease;
    margin-top: 0.1rem;
}

.strip-delete:hover {
    color: var(--red);
}

/* RIGHT PANEL: TABS & EDITOR */
.editor-panel {
    height: 100%;
    min-height: 0; /* FIX: evita desbordamiento en el layout de rejilla */
}

.editor-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem 0;
    gap: 0.25rem;
    overflow-x: auto;
}

.tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0.5rem 0.85rem;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    transition: all 0.2s;
    font-family: var(--font-accent);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
    color: var(--primary);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-bottom: 1px solid transparent;
    box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.1);
}

.accent-tab {
    color: var(--cyan);
}
.accent-tab.active {
    color: var(--cyan);
}

.editor-content-container {
    flex-grow: 1;
    overflow-y: auto;
    min-height: 0; /* FIX: obliga al contenido del editor a encogerse y activar scroll */
    padding: 1.25rem;
    background: rgba(0,0,0,0.05);
}

.tab-pane {
    display: none;
}

.tab-pane.active {
    display: block;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.tab-action-bar h4 {
    font-family: var(--font-accent);
    font-size: 0.95rem;
    font-weight: 600;
}

/* TABLES FOR EDITING */
.lyrics-editor-table-container,
.cues-editor-table-container {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-card);
    /* Removido overflow: hidden para que funcione position: sticky de th */
}

.editor-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.editor-table th,
.editor-table td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
}

.editor-table th {
    background: #141416; /* Color sólido para que no transparente la letra al hacer scroll */
    font-family: var(--font-accent);
    font-weight: 600;
    color: var(--text-muted);
    position: sticky;
    top: 0;
    z-index: 10;
    box-shadow: inset 0 -1px 0 var(--border-color);
}

.editor-table tr:last-child td {
    border-bottom: none;
}

.editor-table input[type="text"],
.editor-table input[type="number"],
.editor-table select {
    width: 100%;
    padding: 0.35rem 0.5rem;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    outline: none;
    font-size: 0.8rem;
}

.editor-table input:focus,
.editor-table select:focus {
    border-color: var(--primary);
}

.table-row-delete-btn {
    background: transparent;
    border: none;
    color: rgba(239, 68, 68, 0.5);
    cursor: pointer;
    transition: color 0.2s;
}

.table-row-delete-btn:hover {
    color: var(--red);
}

/* SECTIONS LIST & DRAG */
.sections-drag-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.section-drag-item {
    display: grid;
    grid-template-columns: auto 1fr 1fr 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    cursor: grab;
    transition: transform 0.2s, border-color 0.2s;
}

.section-drag-item:active {
    cursor: grabbing;
}

.section-drag-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    border-color: var(--primary);
}

.drag-handle {
    color: var(--text-muted);
    cursor: grab;
}

.section-drag-item input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-main);
    padding: 0.3rem 0.5rem;
    font-size: 0.8rem;
    outline: none;
}

.section-color-indicator {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* METADATA EDITOR */
.meta-editor-form {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* STAGE VIEW MIRROR (STAGE DISPLAY) */
.mirror-viewport {
    background: #000;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    aspect-ratio: 16/10;
    overflow: hidden;
    position: relative;
}

.stage-display-container {
    width: 100%;
    height: 100%;
    background: #000;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1.25rem;
    font-family: var(--font-primary);
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stage-section-badge {
    background: var(--primary);
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.75rem;
    font-family: var(--font-accent);
}

.stage-tempo-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.stage-canvas-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    padding: 1.5rem 0;
}

.stage-chords-line {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--yellow);
    letter-spacing: 2px;
    min-height: 1.8rem;
}

.stage-lyrics-line {
    font-size: 1.45rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.3;
    min-height: 2rem;
}

.stage-next-lyrics-line {
    font-size: 0.95rem;
    color: #52525b;
    font-weight: 500;
    min-height: 1.3rem;
}

.stage-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding-top: 0.5rem;
}

.stage-cue-alert {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--cyan);
    text-transform: uppercase;
}

.stage-bar-visualizer {
    display: flex;
    gap: 0.25rem;
}

.stage-bar-block {
    width: 14px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.stage-bar-block.active {
    background: var(--cyan);
    box-shadow: 0 0 8px var(--cyan);
}

/* SAVE ACTIONS IN FOOTER OF EDITOR */
.editor-actions {
    display: flex;
    gap: 0.75rem;
    padding: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.editor-actions .btn {
    flex: 1;
}

/* BTN GENERALS */
.btn {
    font-family: var(--font-accent);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
    background: #b55fe6;
    box-shadow: 0 6px 18px var(--primary-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.btn-small {
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 6px;
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* MODALS */
.modal {
    display: none;
    position: fixed;
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 500;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    width: 500px;
    max-width: 90%;
    animation: scaleIn 0.25s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
    font-family: var(--font-accent);
    font-size: 1.15rem;
    font-weight: 700;
}

.close-icon {
    font-size: 1.2rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}

.close-icon:hover {
    color: var(--red);
}

form {
    padding: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 1.25rem;
}

.form-group label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
}

.form-group input,
.form-group select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    padding: 0.55rem 0.75rem;
    font-size: 0.85rem;
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus {
    border-color: var(--primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 0.75rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* TOASTS */
#toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    font-size: 0.85rem;
    border-left: 4px solid var(--primary);
    transform: translateX(120%);
    transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
}

.toast.success { border-left-color: var(--green); }
.toast.error { border-left-color: var(--red); }
.toast.info { border-left-color: var(--cyan); }

/* KEYFRAMES */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.loading-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    padding: 3rem 0;
}

/* ==========================================
   RESPONSIVIDAD Y CONTROLES ADAPTATIVOS
   ========================================== */

@media (max-width: 1400px) {
    body {
        overflow-y: auto;
        height: auto;
    }
    
    .workspace {
        grid-template-columns: 280px 1fr;
        grid-template-rows: auto;
        height: auto;
        overflow: visible;
        gap: 1rem;
        padding: 1rem;
    }
    
    .editor-panel {
        grid-column: span 2;
        height: auto;
        max-height: none;
    }
    
    .sidebar, .main-panel {
        height: auto;
        max-height: none;
    }
    
    .stems-mixer-grid {
        height: auto;
        min-height: 380px;
    }
}

@media (max-width: 992px) {
    .workspace {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        grid-column: span 1;
    }
    
    .editor-panel {
        grid-column: span 1;
    }
    
    .transport-bar {
        flex-direction: column;
        gap: 1.25rem;
        align-items: stretch;
        text-align: center;
    }
    
    .digital-clock {
        font-size: 1.5rem;
    }
    
    .controls-left, .metronome-control, .master-mixer {
        justify-content: center;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        align-items: stretch;
        text-align: center;
    }
    
    .nav-brand {
        justify-content: center;
    }
    
    .active-song-info {
        justify-content: center;
    }
    
    .nav-actions {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }
    
    .nav-actions .btn {
        width: 100%;
    }
}

/* ===================================================
   WORD CANVAS VIRTUAL SHEET & BLOCKS (DESKTOP PORT)
   =================================================== */

.sheet-document-container {
    width: 100%;
    height: 100%;
    overflow-y: auto;
    background: #000;
    padding: 1.5rem 1.5rem 1.5rem 5.5rem; /* Margen amplio a la izquierda para las etiquetas de compás Bxx.x */
    position: relative;
    border-radius: 12px;
}

.word-virtual-sheet {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-bottom: 8rem; /* Espacio extra abajo para permitir hacer scroll centrado al final */
}

.sheet-paragraph-block {
    display: flex;
    flex-direction: column;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    position: relative;
    transition: all 0.25s ease;
    min-height: 110px;
    gap: 0.4rem;
    width: 100%;
    box-sizing: border-box;
}

.sheet-paragraph-block:hover {
    background: rgba(255, 255, 255, 0.025);
    border-color: rgba(6, 182, 212, 0.25);
}

.sheet-paragraph-block.active-playing-bar {
    background: rgba(6, 182, 212, 0.1) !important;
    border: 1.5px solid #22d3ee !important;
    box-shadow: 0 0 25px rgba(34, 211, 238, 0.15), inset 0 0 15px rgba(34, 211, 238, 0.05) !important;
    transform: scale(1.01);
    z-index: 2;
}

.sheet-margin-label {
    position: absolute;
    left: -4.5rem;
    top: 1rem;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.5px;
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    border: 1px solid rgba(6, 182, 212, 0.2);
    display: flex;
    align-items: center;
    gap: 0.2rem;
    transition: all 0.2s ease;
}

.sheet-paragraph-block.active-playing-bar .sheet-margin-label {
    background: var(--cyan) !important;
    color: #000 !important;
    box-shadow: 0 0 10px var(--cyan);
}

.sheet-floor-row {
    position: relative;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    min-height: 24px;
    display: flex;
    align-items: center;
    width: 100%;
    background: rgba(255, 255, 255, 0.01);
    border: 1px solid rgba(255, 255, 255, 0.02);
    box-sizing: border-box;
}

.sheet-floor-indicator {
    font-size: 0.45rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.3;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    transition: opacity 0.2s;
}

.sheet-floor-row:hover .sheet-floor-indicator {
    opacity: 0.7;
}

.sheet-text-lyric {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f3f4f6;
    line-height: 1.3;
    width: 100%;
    display: block;
}

.sheet-text-chord {
    font-size: 0.85rem;
    font-weight: 800;
    color: #f59e0b;
    font-family: monospace;
    letter-spacing: 0.5px;
    display: block;
    width: 100%;
}

.sheet-text-score {
    font-size: 0.75rem;
    font-family: monospace;
    color: #c084fc;
    background: rgba(192, 132, 252, 0.08);
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    border: 1px solid rgba(192, 132, 252, 0.12);
    display: block;
    width: 100%;
}

.sheet-floor-empty {
    font-style: italic;
    color: rgba(255, 255, 255, 0.15);
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    width: 100%;
    gap: 0.3rem;
}

.sheet-text-degree {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--cyan);
    font-family: var(--font-mono);
    letter-spacing: 1px;
    display: block;
    width: 100%;
}

/* ===================================================
   CANVAS WORD EDITOR - BLOQUES INTERACTIVOS (IMAGEN 2)
   =================================================== */

.lyrics-canvas-editor-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    overflow-y: auto;
    max-height: calc(100vh - 250px);
    padding-right: 0.5rem;
}

.editor-section-banner {
    width: 100%;
    margin: 1.5rem 0 0.5rem 0;
    padding: 0.55rem 1rem;
    background: linear-gradient(90deg, rgba(139, 92, 246, 0.2) 0%, rgba(139, 92, 246, 0.02) 100%);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.05);
}

.editor-section-banner h5 {
    font-family: var(--font-accent);
    font-weight: 700;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
}

.editor-section-banner span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--primary);
    background: rgba(139, 92, 246, 0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-weight: 700;
}

.editor-block-card {
    display: flex;
    gap: 1rem;
    align-items: stretch;
    background: rgba(20, 20, 22, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 0.85rem;
    margin-bottom: 0.5rem;
    transition: border-color 0.2s, background-color 0.2s, transform 0.2s;
}

.editor-block-card:hover {
    background: rgba(20, 20, 22, 0.6);
    border-color: rgba(6, 182, 212, 0.25);
    transform: translateY(-1px);
}

.editor-block-time-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 95px;
    background: rgba(6, 182, 212, 0.06);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: 8px;
    color: var(--cyan);
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    padding: 0.5rem;
    text-align: center;
    gap: 0.2rem;
}

.editor-block-time-badge:hover {
    background: var(--cyan);
    color: #000;
    box-shadow: 0 0 12px var(--cyan-glow);
    border-color: var(--cyan);
}

.editor-block-floors {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.editor-floor-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.015);
    border: 1px dashed rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 0.35rem 0.75rem;
    position: relative;
    transition: all 0.2s;
}

.editor-floor-input-row:focus-within {
    background: rgba(255, 255, 255, 0.035);
    border-color: rgba(168, 85, 247, 0.35);
    border-style: solid;
}

.editor-floor-input-row i {
    font-size: 0.8rem;
    color: var(--text-muted);
    width: 14px;
    text-align: center;
}

.editor-floor-input {
    flex-grow: 1;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    color: var(--text-main);
    font-size: 0.85rem;
    padding: 0 !important;
    box-shadow: none !important;
}

.editor-floor-input::placeholder {
    color: rgba(255, 255, 255, 0.2) !important;
    font-style: italic;
}

/* Colores específicos de piso */
.editor-floor-input-row.floor-score i { color: #c084fc; }
.editor-floor-input.score-type {
    font-family: monospace;
    color: #c084fc;
}

.editor-floor-input-row.floor-chords i { color: #f59e0b; }
.editor-floor-input.chords-type {
    font-family: monospace;
    font-weight: 700;
    color: #f59e0b;
}

.editor-floor-input-row.floor-degree i { color: var(--cyan); }
.editor-floor-input.degree-type {
    font-family: monospace;
    font-weight: 700;
    color: var(--cyan);
}

.editor-floor-input-row.floor-lyric i { color: #fff; }
.editor-floor-input.lyric-type {
    font-weight: 600;
    color: #fff;
}

.editor-floor-indicator-badge {
    font-size: 0.5rem;
    font-weight: 800;
    color: var(--text-muted);
    opacity: 0.35;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    letter-spacing: 0.5px;
    user-select: none;
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
}

.editor-block-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
    min-width: 36px;
    align-items: center;
}

.action-btn-round {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.75rem;
}

.action-btn-round.delete:hover {
    background: rgba(239, 68, 68, 0.12);
    color: var(--red);
    border-color: var(--red);
}

.action-btn-round.duplicate:hover {
    background: rgba(6, 182, 212, 0.12);
    color: var(--cyan);
    border-color: var(--cyan);
}

.action-btn-round.add:hover {
    background: rgba(168, 85, 247, 0.12);
    color: var(--primary);
    border-color: var(--primary);
}

.editor-block-card.active-playing-bar {
    background: rgba(6, 182, 212, 0.1) !important;
    border-color: #22d3ee !important;
    border-width: 1.5px !important;
    box-shadow: 0 0 15px rgba(34, 211, 238, 0.12), inset 0 0 8px rgba(34, 211, 238, 0.03) !important;
    transform: scale(1.005);
}

.editor-block-card.active-playing-bar .editor-block-time-badge {
    background: var(--cyan) !important;
    color: #000 !important;
    border-color: var(--cyan) !important;
    box-shadow: 0 0 10px var(--cyan-glow);
}

/* AUDIO BUFFER DAW ENGINE LOADER OVERLAY */
.audio-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(9, 9, 11, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    opacity: 0;
    visibility: hidden;
    border-radius: 12px;
}

.audio-loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.audio-loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 2.5rem;
    background: rgba(20, 20, 25, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    max-width: 420px;
    width: 90%;
}

.loader-spinner {
    font-size: 2.8rem;
    color: #a855f7;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 10px rgba(168, 85, 247, 0.5));
}

.audio-loader-content h3 {
    font-family: var(--font-accent);
    font-weight: 700;
    color: #fff;
    margin: 0;
    font-size: 1.15rem;
    letter-spacing: 0.5px;
}

.audio-loader-content p {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0;
    line-height: 1.4;
}

.loader-progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.02);
}

.loader-progress-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #a855f7, #06b6d4);
    border-radius: 4px;
    transition: width 0.15s ease-out;
}

.loader-percentage {
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 700;
    color: var(--cyan);
    text-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

