/**
 * DJ Key Detection Module - Styles
 * Display de tonalidad y compatibilidad armónica
 */

/* ===============================================
   KEY DISPLAY EN CDJ SCREEN
   =============================================== */
.key-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    padding: 2px 6px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 32px;
}

.key-display:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}

.key-display.has-key {
    border-color: var(--key-color, rgba(255, 255, 255, 0.3));
    box-shadow: 0 0 6px color-mix(in srgb, var(--key-color, #fff) 30%, transparent);
}

.key-label {
    font-size: 6px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.key-value {
    font-size: 12px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: var(--key-color, rgba(255, 255, 255, 0.5));
    text-shadow: 0 0 4px var(--key-color, transparent);
    line-height: 1;
}

.key-note {
    font-size: 7px;
    color: rgba(255, 255, 255, 0.4);
}

.key-display.has-key .key-note {
    color: var(--key-color, rgba(255, 255, 255, 0.6));
}

/* ===============================================
   INDICADOR DE COMPATIBILIDAD ARMÓNICA
   =============================================== */
.harmonic-compat-container {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 4px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.harmonic-compat-label {
    font-size: 7px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.3);
    text-transform: uppercase;
}

.harmonic-compat-indicator {
    font-size: 14px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.5);
    min-width: 20px;
    text-align: center;
    transition: all 0.2s ease;
}

/* Estados de compatibilidad */
.harmonic-compat-indicator.compatible {
    color: #00ff88;
    text-shadow: 0 0 6px rgba(0, 255, 136, 0.6);
}

.harmonic-compat-indicator.semi {
    color: #ffcc00;
    text-shadow: 0 0 6px rgba(255, 204, 0, 0.6);
}

.harmonic-compat-indicator.incompatible {
    color: #ff4444;
    text-shadow: 0 0 6px rgba(255, 68, 68, 0.6);
}

/* ===============================================
   COLORES POR NÚMERO CAMELOT
   =============================================== */
/* Rueda de Camelot - colores cromáticos */
[data-camelot="1A"], [data-camelot="1B"] { --key-color: #ff4444; }
[data-camelot="2A"], [data-camelot="2B"] { --key-color: #ff8800; }
[data-camelot="3A"], [data-camelot="3B"] { --key-color: #ffcc00; }
[data-camelot="4A"], [data-camelot="4B"] { --key-color: #aaff00; }
[data-camelot="5A"], [data-camelot="5B"] { --key-color: #00ff88; }
[data-camelot="6A"], [data-camelot="6B"] { --key-color: #00ffcc; }
[data-camelot="7A"], [data-camelot="7B"] { --key-color: #00d4ff; }
[data-camelot="8A"], [data-camelot="8B"] { --key-color: #0088ff; }
[data-camelot="9A"], [data-camelot="9B"] { --key-color: #4444ff; }
[data-camelot="10A"], [data-camelot="10B"] { --key-color: #8800ff; }
[data-camelot="11A"], [data-camelot="11B"] { --key-color: #cc00ff; }
[data-camelot="12A"], [data-camelot="12B"] { --key-color: #ff00aa; }

/* ===============================================
   ANIMACIONES
   =============================================== */
@keyframes key-pulse {
    0%, 100% {
        box-shadow: 0 0 6px color-mix(in srgb, var(--key-color, #fff) 30%, transparent);
    }
    50% {
        box-shadow: 0 0 12px color-mix(in srgb, var(--key-color, #fff) 50%, transparent);
    }
}

.key-display.has-key:hover {
    animation: key-pulse 1s ease-in-out infinite;
}

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 768px) {
    .key-display {
        padding: 2px 4px;
        min-width: 28px;
    }

    .key-value {
        font-size: 10px;
    }

    .key-note {
        font-size: 6px;
    }

    .harmonic-compat-container {
        padding: 2px 6px;
    }

    .harmonic-compat-indicator {
        font-size: 12px;
    }
}

/* ===============================================
   KEY WHEEL VISUAL (MINI)
   =============================================== */
.key-wheel-mini {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: conic-gradient(
        #ff4444 0deg 30deg,
        #ff8800 30deg 60deg,
        #ffcc00 60deg 90deg,
        #aaff00 90deg 120deg,
        #00ff88 120deg 150deg,
        #00ffcc 150deg 180deg,
        #00d4ff 180deg 210deg,
        #0088ff 210deg 240deg,
        #4444ff 240deg 270deg,
        #8800ff 270deg 300deg,
        #cc00ff 300deg 330deg,
        #ff00aa 330deg 360deg
    );
    position: relative;
    opacity: 0.5;
}

.key-wheel-mini::after {
    content: '';
    position: absolute;
    top: 30%;
    left: 30%;
    right: 30%;
    bottom: 30%;
    background: #0a0a0f;
    border-radius: 50%;
}

/* ===============================================
   TOOLTIP PARA EDICIÓN
   =============================================== */
.key-display::after {
    content: 'Click para editar';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 3px 6px;
    background: rgba(0, 0, 0, 0.95);
    color: #fff;
    font-size: 8px;
    white-space: nowrap;
    border-radius: 3px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 100;
    margin-bottom: 4px;
}

.key-display:hover::after {
    opacity: 1;
    visibility: visible;
}

/* ===============================================
   INTEGRACIÓN CON WAVEFORM
   =============================================== */
/* Mostrar key info encima del waveform */
.waveform-key-badge {
    position: absolute;
    top: 2px;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 4px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.6);
    color: var(--key-color, #fff);
    z-index: 10;
}

.waveform-channel-dual[data-deck="A"] .waveform-key-badge {
    left: 20px;
}

.waveform-channel-dual[data-deck="B"] .waveform-key-badge {
    left: 20px;
}
