/**
 * Arrastre de Módulos - Estilos
 * Sistema de módulos flotantes arrastrables para DJ Console
 */

/* ========== SWITCHES DE MÓDULOS ARRASTRABLES EN MODAL CONF ========== */
/* Color especial (cyan/turquesa) para los módulos que se pueden arrastrar */

.config-item[data-module="loopInOut"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="keylock"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="slipMode"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="beatjump"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="hotCuesExtended"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="loopRoll"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="keyDetect"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="phraseSync"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="killSwitches"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="crossfaderCurves"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="phaseMeter"] .config-toggle input:checked + .config-toggle-slider,
.config-item[data-module="recorder"] .config-toggle input:checked + .config-toggle-slider {
    background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%);
    border-color: rgba(6, 182, 212, 0.6);
    box-shadow: 0 0 8px rgba(6, 182, 212, 0.4);
}

/* Indicador de arrastrable (icono de mover) */
.config-item[data-module="loopInOut"] .config-item-name::after,
.config-item[data-module="keylock"] .config-item-name::after,
.config-item[data-module="slipMode"] .config-item-name::after,
.config-item[data-module="beatjump"] .config-item-name::after,
.config-item[data-module="hotCuesExtended"] .config-item-name::after,
.config-item[data-module="loopRoll"] .config-item-name::after,
.config-item[data-module="keyDetect"] .config-item-name::after,
.config-item[data-module="phraseSync"] .config-item-name::after,
.config-item[data-module="killSwitches"] .config-item-name::after,
.config-item[data-module="crossfaderCurves"] .config-item-name::after,
.config-item[data-module="phaseMeter"] .config-item-name::after,
.config-item[data-module="recorder"] .config-item-name::after {
    content: '⋮⋮';
    margin-left: 6px;
    font-size: 10px;
    color: #06b6d4;
    opacity: 0.7;
    vertical-align: middle;
}

/* ========== MÓDULO FLOTANTE BASE ========== */
.modulo-flotante {
    position: fixed;
    z-index: 800;
    background: linear-gradient(145deg, rgba(30, 30, 40, 0.95), rgba(20, 20, 30, 0.98));
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset,
        0 0 20px rgba(0, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    min-width: 80px;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.modulo-flotante:hover {
    box-shadow:
        0 12px 40px rgba(0, 0, 0, 0.6),
        0 0 0 1px rgba(0, 255, 255, 0.2) inset,
        0 0 30px rgba(0, 255, 255, 0.15);
}

.modulo-flotante.arrastrando {
    opacity: 0.9;
    transform: scale(1.02);
    box-shadow:
        0 16px 50px rgba(0, 0, 0, 0.7),
        0 0 0 2px rgba(0, 255, 255, 0.4) inset,
        0 0 40px rgba(0, 255, 255, 0.25);
    cursor: grabbing;
    z-index: 850;
}

/* ========== BARRA DE ARRASTRE (HANDLE) ========== */
.modulo-handle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px;
    background: linear-gradient(90deg, rgba(0, 255, 255, 0.15), rgba(255, 0, 255, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 7px 7px 0 0;
    cursor: grab;
    user-select: none;
}

.modulo-handle:active {
    cursor: grabbing;
}

.modulo-handle-title {
    font-size: 9px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.modulo-handle-title::before {
    content: '⋮⋮';
    font-size: 10px;
    color: rgba(0, 255, 255, 0.5);
    margin-right: 2px;
}

.modulo-handle-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 80, 80, 0.2);
    border: 1px solid rgba(255, 80, 80, 0.3);
    border-radius: 50%;
    color: rgba(255, 80, 80, 0.8);
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    line-height: 1;
}

.modulo-handle-close:hover {
    background: rgba(255, 80, 80, 0.4);
    color: #fff;
    transform: scale(1.1);
}

/* ========== CONTENIDO DEL MÓDULO ========== */
.modulo-contenido {
    padding: 8px;
}

/* ========== INDICADOR DE POSICIÓN ========== */
.modulo-flotante::after {
    content: '';
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, transparent 50%, rgba(255, 255, 255, 0.2) 50%);
    border-radius: 0 0 4px 0;
    pointer-events: none;
}

/* ========== BOTÓN RESET POSICIONES ========== */
.reset-posiciones-btn {
    position: fixed;
    bottom: 10px;
    right: 10px;
    padding: 6px 12px;
    background: rgba(255, 100, 0, 0.2);
    border: 1px solid rgba(255, 100, 0, 0.4);
    border-radius: 6px;
    color: rgba(255, 150, 50, 0.9);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    z-index: 900;
    transition: all 0.2s ease;
    display: none;
}

.reset-posiciones-btn:hover {
    background: rgba(255, 100, 0, 0.4);
    color: #fff;
}

.reset-posiciones-btn.visible {
    display: block;
}

/* ========== ANIMACIÓN DE ENTRADA ========== */
@keyframes moduloEntrada {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modulo-flotante.nuevo {
    animation: moduloEntrada 0.3s ease-out;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .modulo-flotante {
        min-width: 70px;
        max-width: 90vw;
    }

    .modulo-handle {
        padding: 3px 6px;
    }

    .modulo-handle-title {
        font-size: 8px;
    }
}

/* ========== ESTILOS ESPECÍFICOS POR MÓDULO ========== */

/* FX Buttons flotante */
.modulo-flotante .fx-buttons-container {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0;
}

/* Recorder flotante */
.modulo-flotante .recorder-panel {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Phase Meter flotante */
.modulo-flotante .phase-meter-container {
    background: transparent;
}

/* Kill Switches flotante */
.modulo-flotante .kill-switches-container {
    background: transparent;
}

/* Crossfader Curves flotante */
.modulo-flotante .crossfader-curve-container {
    background: transparent;
}

/* Loop In/Out flotante */
.modulo-flotante .loop-inout-controls {
    background: transparent;
}

/* Keylock flotante */
.modulo-flotante .keylock-container {
    background: transparent;
}

/* Slip Mode flotante */
.modulo-flotante .slip-container {
    background: transparent;
}

/* Beatjump flotante */
.modulo-flotante .beatjump-container {
    background: transparent;
}

/* Hot Cues Extended flotante */
.modulo-flotante .cue-memory-extended {
    background: transparent;
}

/* Loop Roll flotante */
.modulo-flotante .loop-roll-container {
    background: transparent;
}

/* Key Display flotante */
.modulo-flotante .key-display,
.modulo-flotante .harmonic-compat-container {
    background: transparent;
}

/* Phrase Sync flotante */
.modulo-flotante .phrase-selector-container {
    background: transparent;
    border: none;
}
