:root {
    /* Paleta inspirada en la imagen de Fiestas Patrias */
    --color-chile-red: #E02130;
    --color-chile-blue: #0033A0;
    --color-white: #FFFFFF;
    
    --bg-main: #F4F7F6;
    --bg-sidebar: #FFFFFF;
    --bg-stage: #D9E4E8; /* Piso cyan suave / celeste apagado similar a la imagen */
    
    --text-main: #2C3E50;
    --text-muted: #7F8C8D;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 16px rgba(0,0,0,0.15);
    
    --radius: 12px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
}

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

/* Sidebar */
.sidebar {
    width: 320px;
    background-color: var(--bg-sidebar);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    z-index: 10;
    padding: 20px;
    overflow-y: auto;
}

.sidebar-header h1 {
    font-size: 1.5rem;
    color: var(--color-chile-blue);
    margin-bottom: 15px;
    font-weight: 700;
}

.dance-selector {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.dance-selector select {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius);
    font-family: inherit;
    outline: none;
}

.tools-section, .scenes-section, .music-section {
    display: flex;
    flex-direction: column;
    margin-bottom: 20px;
}

.music-section {
    flex: 0 0 auto;
    background: #f8f9fa;
    padding: 15px;
    border-radius: var(--radius);
    margin-bottom: 20px;
}

.audio-input {
    width: 100%;
    font-size: 0.8rem;
    margin-bottom: 10px;
}

.audio-player {
    width: 100%;
    display: none;
    height: 35px;
}

.tools-section h2, .scenes-section h2, .music-section h2 {
    font-size: 1.1rem;
    margin-bottom: 10px;
    color: var(--color-chile-red);
}

.tools-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 10px;
    flex: 0 0 auto;
}

.palette {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding-bottom: 10px;
}

.scenes-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.scene-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: #f8f9fa;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    border-left: 4px solid transparent;
    font-size: 0.9rem;
}

.scene-actions {
    display: flex;
    gap: 5px;
}

.btn-icon-small {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    opacity: 0; /* Oculto por defecto */
    transition: var(--transition);
}

.scene-item:hover .btn-icon-small {
    opacity: 0.5; /* Muestra al pasar el mouse por la escena */
}

.btn-icon-small:hover {
    opacity: 1 !important;
    transform: scale(1.2);
}

.scene-item:hover {
    background: #e9ecef;
}

.scene-item.active {
    background: #e8f0fe;
    border-left-color: var(--color-chile-blue);
    font-weight: 600;
}

/* Buttons */
.btn {
    padding: 10px 15px;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.btn-primary {
    background-color: var(--color-chile-blue);
    color: white;
    width: 100%;
}
.btn-primary:hover {
    background-color: #002277;
}

.btn-secondary {
    background-color: #e9ecef;
    color: var(--text-main);
}
.btn-secondary:hover {
    background-color: #dee2e6;
}

.btn-success {
    background-color: #2ecc71;
    color: white;
    width: 100%;
}
.btn-success:hover {
    background-color: #27ae60;
}

.btn-icon {
    background: white;
    border: 1px solid #ddd;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}
.btn-icon:hover {
    background: var(--color-chile-red);
    color: white;
    border-color: var(--color-chile-red);
}

/* Main Content & Stage */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: white;
    padding: 15px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.stage-header h2 {
    font-size: 1.3rem;
    font-weight: 600;
}

.playback-controls {
    display: flex;
    gap: 10px;
}

.scene-description-container {
    margin-bottom: 20px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 10px;
}

.rich-textarea {
    width: 100%;
    border: none;
    min-height: 60px;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-main);
    outline: none;
    padding: 5px;
    background: transparent;
    white-space: pre-wrap;
    overflow-y: auto;
    max-height: 150px;
}
.rich-textarea:empty:before {
    content: attr(placeholder);
    color: #a0aab5;
    pointer-events: none;
}

.stage-wrapper {
    flex: 1;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    padding: 20px;
    position: relative;
    min-height: 500px;
}

.stage-wrapper:fullscreen {
    background: #f4f7f6;
    padding: 40px;
}

.audience-indicator {
    text-align: center;
    padding: 10px;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    border-bottom: 2px dashed #ddd;
    margin-bottom: 20px;
}

.stage {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 60vh;
    max-width: calc(60vh * 16 / 9);
    margin: 0 auto;
    background-color: #e0e5ec;
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 10px;
    background-image: 
        linear-gradient(rgba(255,255,255,0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    flex-shrink: 0;
}

/* Centro marcado para referencia */
.stage::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    height: 50%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    pointer-events: none;
}

.stage-wrapper:fullscreen {
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1a1a;
    padding: 0;
}

.stage-wrapper:fullscreen .stage {
    width: 100%;
    height: 100%;
    max-width: calc(100vh * 16 / 9);
    max-height: calc(100vw * 9 / 16);
    aspect-ratio: 16 / 9;
    margin: auto;
}

.stage-wrapper:fullscreen .playback-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
}

.stage-center-mark {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    background: rgba(255,255,255,0.8);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

/* Dancers (Elements) */
.dancer {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    cursor: grab;
    user-select: none;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, top 0.5s ease-in-out, left 0.5s ease-in-out;
    position: relative;
}

.dancer:active {
    cursor: grabbing;
    transform: scale(1.1);
}

.dancer-label {
    pointer-events: none;
}

/* Types of Dancers */
.dancer.ociel { background: var(--color-chile-blue); border: 2px solid white; z-index: 5; }
.dancer.continente { background: #27ae60; border: 2px solid white; }
.dancer.bailarina { background: var(--color-white); color: var(--color-chile-blue); border: 2px solid var(--color-chile-red); }
.dancer.pareja { background: var(--color-chile-red); border: 2px solid white; }

/* Palette items */
.palette .dancer {
    position: static;
    margin: 0 auto;
    margin-bottom: 5px;
}

.palette-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: #f8f9fa;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
    font-size: 0.8rem;
    text-align: center;
}

/* Tooltips para identificar bailarines en el stage */
.dancer::after {
    content: attr(data-id);
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.7rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.dancer:hover::after {
    opacity: 1;
}
