/**
 * DJ Loop Roll Module - Styles
 * Pads para Loop Roll con efectos visuales
 */

/* ===============================================
   CONTENEDOR LOOP ROLL
   =============================================== */
.loop-roll-container {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 4px;
    background: linear-gradient(180deg, rgba(20, 20, 30, 0.9) 0%, rgba(10, 10, 15, 0.95) 100%);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 8px rgba(0, 0, 0, 0.5);
}

.loop-roll-container.active {
    border-color: rgba(0, 200, 255, 0.4);
    box-shadow:
        0 0 15px rgba(0, 200, 255, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.loop-roll-label {
    font-size: 7px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin-bottom: 2px;
}

/* ===============================================
   PADS DE LOOP ROLL
   =============================================== */
.loop-roll-pads {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2px;
}

.loop-roll-pad {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    font-weight: 700;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.1s ease;
    position: relative;

    background: linear-gradient(180deg, #2a2a35 0%, #1a1a22 100%);
    color: rgba(255, 255, 255, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.05),
        0 2px 4px rgba(0, 0, 0, 0.3);

    /* Evitar selección de texto */
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.loop-roll-pad:hover {
    background: linear-gradient(180deg, #3a3a45 0%, #2a2a32 100%);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.2);
}

.loop-roll-pad:active,
.loop-roll-pad.active {
    background: linear-gradient(180deg, #0a3a4a 0%, #052530 100%);
    color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow:
        0 0 15px rgba(0, 212, 255, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform: scale(0.95);
}

/* Flash al activar */
.loop-roll-pad.flash {
    animation: loop-roll-flash 0.1s ease-out;
}

@keyframes loop-roll-flash {
    0% {
        transform: scale(1);
        box-shadow: 0 0 5px rgba(0, 212, 255, 0.5);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 0 20px rgba(0, 212, 255, 0.8);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
    }
}

/* ===============================================
   COLORES POR TAMAÑO
   =============================================== */
/* Loops pequeños - Más brillantes (para scratch) */
.loop-roll-pad[data-size="0.0625"]:active,
.loop-roll-pad[data-size="0.125"]:active,
.loop-roll-pad[data-size="0.0625"].active,
.loop-roll-pad[data-size="0.125"].active {
    background: linear-gradient(180deg, #4a1a3a 0%, #300d25 100%);
    color: #ff00c8;
    border-color: rgba(255, 0, 200, 0.5);
    box-shadow: 0 0 15px rgba(255, 0, 200, 0.5);
}

/* Loops medianos */
.loop-roll-pad[data-size="0.25"]:active,
.loop-roll-pad[data-size="0.5"]:active,
.loop-roll-pad[data-size="0.25"].active,
.loop-roll-pad[data-size="0.5"].active {
    background: linear-gradient(180deg, #3a3a1a 0%, #252510 100%);
    color: #ffcc00;
    border-color: rgba(255, 204, 0, 0.5);
    box-shadow: 0 0 15px rgba(255, 204, 0, 0.5);
}

/* Loops normales - Cyan */
.loop-roll-pad[data-size="1"]:active,
.loop-roll-pad[data-size="2"]:active,
.loop-roll-pad[data-size="1"].active,
.loop-roll-pad[data-size="2"].active {
    background: linear-gradient(180deg, #0a3a4a 0%, #052530 100%);
    color: #00d4ff;
    border-color: rgba(0, 212, 255, 0.5);
    box-shadow: 0 0 15px rgba(0, 212, 255, 0.5);
}

/* Loops largos - Verde */
.loop-roll-pad[data-size="4"]:active,
.loop-roll-pad[data-size="8"]:active,
.loop-roll-pad[data-size="4"].active,
.loop-roll-pad[data-size="8"].active {
    background: linear-gradient(180deg, #1a4a3a 0%, #0d3025 100%);
    color: #00ff88;
    border-color: rgba(0, 255, 136, 0.5);
    box-shadow: 0 0 15px rgba(0, 255, 136, 0.5);
}

/* ===============================================
   DISPLAY DE LOOP ACTIVO
   =============================================== */
.loop-roll-display {
    font-size: 12px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #00d4ff;
    text-shadow: 0 0 6px rgba(0, 212, 255, 0.6);
    text-align: center;
    min-height: 16px;
    opacity: 0;
    transition: opacity 0.15s ease;
}

.loop-roll-container.active .loop-roll-display {
    opacity: 1;
    animation: loop-roll-pulse 0.3s ease-in-out infinite;
}

@keyframes loop-roll-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ===============================================
   POSICIONAMIENTO EN DECK
   =============================================== */
.deck-a .loop-roll-container {
    position: absolute;
    left: 4px;
    bottom: 140px;
    z-index: 50;
}

.deck-b .loop-roll-container {
    position: absolute;
    right: 4px;
    bottom: 140px;
    z-index: 50;
}

/* ===============================================
   LAYOUT HORIZONTAL (alternativo)
   =============================================== */
.loop-roll-container.horizontal {
    flex-direction: row;
    align-items: center;
}

.loop-roll-container.horizontal .loop-roll-pads {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
}

.loop-roll-container.horizontal .loop-roll-pad {
    width: 22px;
    height: 20px;
    font-size: 7px;
}

/* ===============================================
   RESPONSIVE
   =============================================== */
@media (max-width: 768px) {
    .loop-roll-container {
        padding: 3px;
        gap: 2px;
    }

    .loop-roll-pads {
        grid-template-columns: repeat(4, 1fr);
        gap: 1px;
    }

    .loop-roll-pad {
        width: 20px;
        height: 20px;
        font-size: 7px;
    }

    .loop-roll-label {
        font-size: 6px;
    }

    .loop-roll-display {
        font-size: 10px;
    }

    .deck-a .loop-roll-container,
    .deck-b .loop-roll-container {
        bottom: 100px;
    }
}

/* ===============================================
   INDICADOR EN WAVEFORM
   =============================================== */
/* Overlay cuando loop roll está activo */
.waveform-channel-dual[data-loop-roll-active="true"] {
    border-color: rgba(0, 212, 255, 0.5);
}

.waveform-channel-dual[data-loop-roll-active="true"]::after {
    content: 'ROLL';
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 8px;
    font-weight: 700;
    color: #00d4ff;
    background: rgba(0, 0, 0, 0.6);
    padding: 2px 4px;
    border-radius: 2px;
    animation: loop-roll-pulse 0.3s ease-in-out infinite;
}

/* ===============================================
   TOOLTIP
   =============================================== */
.loop-roll-pad[title]::after {
    content: attr(title);
    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;
}

.loop-roll-pad:hover::after {
    opacity: 1;
    visibility: visible;
}
