/**
 * Auto BPM - Estilos para analizador profesional de BPM
 */

/* ================================
   MODAL ANALIZADOR BPM
   ================================ */
.auto-bpm-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auto-bpm-modal.active {
    display: flex;
}

.auto-bpm-content {
    background: linear-gradient(180deg, #1a1a2e 0%, #16162a 100%);
    border: 1px solid rgba(34, 197, 94, 0.3);
    border-radius: 12px;
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5),
                0 0 60px rgba(34, 197, 94, 0.1);
}

/* Header */
.auto-bpm-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: rgba(34, 197, 94, 0.1);
    border-bottom: 1px solid rgba(34, 197, 94, 0.2);
}

.auto-bpm-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.auto-bpm-icon svg {
    width: 20px;
    height: 20px;
    color: white;
}

.auto-bpm-title {
    flex: 1;
}

.auto-bpm-title h3 {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.auto-bpm-title p {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    margin: 2px 0 0 0;
}

/* Body */
.auto-bpm-body {
    padding: 16px;
}

.auto-bpm-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 12px;
}

.auto-bpm-info svg {
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

.auto-bpm-info span {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.auto-bpm-info strong {
    color: #22c55e;
}

/* Method badge */
.auto-bpm-method {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: 6px;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.method-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 3px 6px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: white;
    border-radius: 4px;
}

.method-desc {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
}

/* Quality selector */
.auto-bpm-quality {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.quality-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    white-space: nowrap;
}

.quality-buttons {
    display: flex;
    gap: 4px;
    flex: 1;
}

.quality-btn {
    flex: 1;
    padding: 5px 8px;
    font-size: 10px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quality-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
    border-color: rgba(255, 255, 255, 0.25);
}

.quality-btn.active {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
    border-color: #22c55e;
}

.quality-btn.active:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}

/* Quality btn - low (naranja) */
.quality-btn[data-quality="low"].active {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #f59e0b;
}

.quality-btn[data-quality="low"].active:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

/* Quality btn - high (azul) */
.quality-btn[data-quality="high"].active {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    border-color: #6366f1;
}

.quality-btn[data-quality="high"].active:hover {
    background: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
}

/* Status */
.auto-bpm-status {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auto-bpm-status .current-song {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.auto-bpm-status .percent {
    font-weight: 700;
    color: #22c55e;
    min-width: 40px;
    text-align: right;
}

/* Progress bar */
.auto-bpm-progress {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 8px;
}

.auto-bpm-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 50%, #4ade80 100%);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 0%;
}

/* Counter */
.auto-bpm-counter {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
}

/* Current result display */
.auto-bpm-current-result {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
}

.auto-bpm-current-result.visible {
    display: flex;
}

.current-bpm-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.current-bpm-display .bpm-number {
    font-size: 24px;
    font-weight: 800;
    color: #22c55e;
    font-family: 'Courier New', monospace;
    line-height: 1;
}

.current-bpm-display .bpm-label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.confidence-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.confidence-fill {
    height: 100%;
    background: linear-gradient(90deg, #22c55e, #16a34a);
    border-radius: 4px;
    transition: width 0.3s ease, background 0.3s ease;
    width: 0%;
}

.confidence-text {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 70px;
    text-align: right;
}

/* Results */
.auto-bpm-results {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: none;
}

.auto-bpm-results.visible {
    display: block;
}

.auto-bpm-results-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    text-align: center;
}

.bpm-result-item {
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
}

.bpm-result-item .label {
    font-size: 9px;
    color: rgba(255, 255, 255, 0.4);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bpm-result-item .value {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    margin-top: 2px;
}

.bpm-result-item .value.success { color: #22c55e; }
.bpm-result-item .value.warning { color: #f59e0b; }
.bpm-result-item .value.error { color: #ef4444; }

/* ================================
   BPM BAJA CONFIANZA (< 90%)
   ================================ */
.bpm-low-confidence,
.col-bpm.bpm-low-confidence {
    color: #f472b6 !important;
    background: rgba(244, 114, 182, 0.1);
    border-radius: 4px;
    padding: 2px 6px;
}

/* En el modal - BPM detectado con baja confianza */
.current-bpm-display.low-confidence .bpm-number {
    color: #f472b6;
}

/* Barra de confianza rosa para < 90% */
.confidence-fill.low-confidence {
    background: linear-gradient(90deg, #f472b6, #ec4899) !important;
}

/* Footer */
.auto-bpm-footer {
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    display: flex;
    gap: 8px;
}

.auto-bpm-btn {
    flex: 1;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    outline: none;
}

.auto-bpm-btn.cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
}

.auto-bpm-btn.cancel:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.auto-bpm-btn.primary {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #fff;
}

.auto-bpm-btn.primary:hover {
    background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    transform: translateY(-1px);
}

.auto-bpm-btn.primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.auto-bpm-btn.reanalyze {
    background: rgba(249, 115, 22, 0.2);
    color: #fb923c;
    border: 1px solid rgba(249, 115, 22, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.auto-bpm-btn.reanalyze:hover {
    background: rgba(249, 115, 22, 0.3);
    color: #fdba74;
    border-color: rgba(249, 115, 22, 0.5);
}

.auto-bpm-btn.reanalyze:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auto-bpm-btn.reanalyze svg {
    width: 14px;
    height: 14px;
}

.auto-bpm-btn.background {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
}

.auto-bpm-btn.background:hover {
    background: rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.auto-bpm-btn.background svg {
    width: 12px;
    height: 12px;
    margin-right: 4px;
}

/* Spinner */
.auto-bpm-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bpm-spin 0.8s linear infinite;
    display: inline-block;
    vertical-align: middle;
    margin-right: 6px;
}

@keyframes bpm-spin {
    to { transform: rotate(360deg); }
}

/* Completed state */
.auto-bpm-modal.completed .auto-bpm-progress-bar {
    background: linear-gradient(90deg, #22c55e 0%, #16a34a 100%);
}

/* ================================
   MINI INDICADOR FLOTANTE
   ================================ */
.auto-bpm-mini {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 12px;
    padding: 10px 14px;
    display: none;
    align-items: center;
    gap: 10px;
    z-index: 9998;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4),
                0 0 40px rgba(34, 197, 94, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 140px;
}

.auto-bpm-mini.active {
    display: flex;
    animation: bpm-mini-slide-in 0.3s ease;
}

@keyframes bpm-mini-slide-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.auto-bpm-mini:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5),
                0 0 50px rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.6);
}

.bpm-mini-icon {
    width: 28px;
    height: 28px;
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: bpm-mini-pulse 2s ease-in-out infinite;
}

@keyframes bpm-mini-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.bpm-mini-icon svg {
    width: 16px;
    height: 16px;
    color: white;
}

.bpm-mini-progress {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    min-width: 50px;
}

.bpm-mini-bar {
    height: 100%;
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

.bpm-mini-percent {
    font-size: 11px;
    font-weight: 700;
    color: #22c55e;
    min-width: 32px;
    text-align: right;
}

/* ================================
   RESPONSIVE
   ================================ */
@media (max-width: 360px) {
    .auto-bpm-content {
        max-width: 100%;
    }

    .auto-bpm-results-grid {
        gap: 4px;
    }

    .bpm-result-item .value {
        font-size: 14px;
    }

    .auto-bpm-mini {
        bottom: 10px;
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}
