/**
 * DUPLICADOS PRO - Estilos del Sistema de Detección de Duplicados
 * Versión: 1.0.0
 */

/* ========================================
   MODAL PRINCIPAL
   ======================================== */

.duplicates-pro-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

.duplicates-pro-modal.hidden {
    display: none;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.duplicates-pro-content {
    background: #0f0f17;
    border-radius: 1rem;
    width: 100%;
    max-width: 800px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   HEADER
   ======================================== */

.duplicates-pro-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03) 0%, transparent 100%);
}

.duplicates-pro-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.duplicates-pro-title h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.duplicates-pro-subtitle {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
}

.duplicates-pro-close {
    padding: 0.5rem;
    border-radius: 0.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.duplicates-pro-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

/* ========================================
   TABS
   ======================================== */

.duplicates-pro-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(0, 0, 0, 0.2);
}

.duplicates-pro-tabs .tab-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    background: transparent;
    border: 1px solid transparent;
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
}

.duplicates-pro-tabs .tab-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.duplicates-pro-tabs .tab-btn.active {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #818cf8;
}

.tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.25rem;
    height: 1.25rem;
    padding: 0 0.375rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    font-weight: 600;
}

.tab-btn.active .tab-count {
    background: rgba(99, 102, 241, 0.3);
}

/* ========================================
   BODY
   ======================================== */

.duplicates-pro-body {
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

.tab-content {
    display: none;
    height: 100%;
}

.tab-content.active {
    display: block;
}

.duplicates-pro-list {
    height: 100%;
    max-height: 400px;
    overflow-y: auto;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Scrollbar personalizado */
.duplicates-pro-list::-webkit-scrollbar {
    width: 6px;
}

.duplicates-pro-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.duplicates-pro-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.duplicates-pro-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Estado vacío */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: rgba(255, 255, 255, 0.5);
    text-align: center;
}

.empty-state p {
    margin-top: 1rem;
    font-size: 0.875rem;
}

/* ========================================
   DUPLICATE CARDS
   ======================================== */

.duplicate-card {
    display: flex;
    gap: 0.5rem;
    padding: 0.625rem 0.75rem;
    background: #16161f;
    border-radius: 0.5rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.2s;
}

.duplicate-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: #1a1a24;
}

/* Quality indicators */
.duplicate-card.quality-better {
    border-left: 3px solid #22c55e;
}

.duplicate-card.quality-worse {
    border-left: 3px solid #ef4444;
}

.duplicate-card.quality-same {
    border-left: 3px solid #6b7280;
}

/* Checkbox */
.dup-select {
    display: flex;
    align-items: flex-start;
    padding-top: 0.25rem;
}

.dup-checkbox {
    width: 1.125rem;
    height: 1.125rem;
    border-radius: 0.25rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    cursor: pointer;
    appearance: none;
    transition: all 0.2s;
    position: relative;
}

.dup-checkbox:checked {
    background: #6366f1;
    border-color: #6366f1;
}

.dup-checkbox:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid white;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.dup-checkbox:hover {
    border-color: rgba(255, 255, 255, 0.5);
}

/* Info section */
.dup-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.dup-row {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

.dup-label {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
    width: 3rem;
    flex-shrink: 0;
}

.dup-title {
    flex: 1;
    min-width: 0;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dup-existing .dup-title {
    color: rgba(255, 255, 255, 0.6);
}

.dup-bitrate {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    flex-shrink: 0;
}

.dup-bitrate.quality-better {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.dup-bitrate.quality-worse {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

/* Footer con método y calidad */
.dup-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.125rem;
    padding-top: 0.25rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.match-method {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 0.25rem;
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.match-icon {
    font-size: 0.75rem;
}

.match-label {
    font-weight: 500;
}

.match-score {
    font-size: 0.6rem;
    padding: 0.1rem 0.25rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 0.2rem;
    color: rgba(255, 255, 255, 0.8);
}

.quality-rec {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
}

/* Variant badges */
.variant-badge {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    background: rgba(251, 191, 36, 0.2);
    color: #fbbf24;
}

.variant-badge.variant-remix {
    background: rgba(236, 72, 153, 0.2);
    color: #f472b6;
}

.variant-badge.variant-live {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}

.variant-badge.variant-acoustic {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
}

.variant-badge.variant-extended {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.variant-badge.variant-instrumental {
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
}

.variant-badge.variant-cover {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* ========================================
   QUEUE DUPLICATES
   ======================================== */

.duplicate-card.queue-dup {
    flex-direction: column;
    padding: 1rem;
}

.dup-files {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.dup-file {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
}

.file-index {
    font-size: 0.7rem;
    font-weight: 600;
    color: #818cf8;
}

.file-name {
    flex: 1;
    font-size: 0.8rem;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dup-vs {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255, 255, 255, 0.3);
    font-size: 0.7rem;
    font-weight: 600;
}

.dup-vs svg {
    width: 1rem;
    height: 1rem;
}

.dup-match-info {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 0.75rem;
}

.similarity {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.dup-queue-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.dup-queue-actions button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
}

.dup-queue-actions button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-keep-first:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.3);
    color: #4ade80;
}

.btn-keep-second:hover {
    background: rgba(59, 130, 246, 0.2);
    border-color: rgba(59, 130, 246, 0.3);
    color: #60a5fa;
}

.btn-keep-both:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: rgba(168, 85, 247, 0.3);
    color: #c084fc;
}

/* ========================================
   FOOTER
   ======================================== */

.duplicates-pro-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.duplicates-pro-stats {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.5);
}

.duplicates-pro-stats .separator {
    color: rgba(255, 255, 255, 0.2);
}

.duplicates-pro-actions {
    display: flex;
    gap: 0.5rem;
}

.duplicates-pro-actions button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    border-radius: 0.5rem;
    border: none;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.duplicates-pro-actions .btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.duplicates-pro-actions .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.duplicates-pro-actions .btn-warning {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.duplicates-pro-actions .btn-warning:hover {
    background: rgba(245, 158, 11, 0.3);
}

.duplicates-pro-actions .btn-primary {
    background: #6366f1;
    color: #fff;
}

.duplicates-pro-actions .btn-primary:hover {
    background: #4f46e5;
}

.duplicates-pro-actions .btn-success {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.3);
}

.duplicates-pro-actions .btn-success:hover {
    background: rgba(34, 197, 94, 0.3);
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 640px) {
    .duplicates-pro-content {
        max-height: 95vh;
        border-radius: 0.75rem;
    }

    .duplicates-pro-header {
        padding: 0.625rem 0.75rem;
    }

    .duplicates-pro-title h3 {
        font-size: 0.95rem;
    }

    .duplicates-pro-subtitle {
        font-size: 0.65rem;
    }

    .duplicates-pro-tabs {
        padding: 0.375rem 0.5rem;
        gap: 0.25rem;
    }

    .duplicates-pro-tabs .tab-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    .duplicates-pro-list {
        padding: 0.5rem;
        max-height: 320px;
        gap: 0.375rem;
    }

    .duplicate-card {
        padding: 0.5rem;
    }

    .dup-row {
        font-size: 0.75rem;
    }

    .dup-label {
        width: 2.5rem;
        font-size: 0.6rem;
    }

    .dup-bitrate {
        font-size: 0.65rem;
        padding: 0.1rem 0.3rem;
    }

    .dup-footer {
        gap: 0.375rem;
    }

    .match-method {
        font-size: 0.6rem;
        padding: 0.1rem 0.3rem;
    }

    .quality-rec {
        font-size: 0.6rem;
    }

    .dup-files {
        flex-direction: column;
        gap: 0.5rem;
    }

    .dup-vs {
        flex-direction: row;
        gap: 0.5rem;
    }

    .dup-vs svg:last-child {
        transform: rotate(180deg);
    }

    .dup-queue-actions {
        flex-direction: column;
    }

    .duplicates-pro-footer {
        padding: 0.625rem 0.75rem;
    }

    .duplicates-pro-actions {
        flex-direction: column;
    }

    .duplicates-pro-actions button {
        width: 100%;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }
}

/* ========================================
   ANIMATIONS
   ======================================== */

.duplicate-card {
    animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Animación para items eliminados */
.duplicate-card.removing {
    animation: slideOut 0.2s ease-out forwards;
}

@keyframes slideOut {
    to {
        opacity: 0;
        transform: translateX(10px);
        height: 0;
        padding: 0;
        margin: 0;
    }
}

/* ========================================
   PROCESSING INDICATOR
   ======================================== */

.duplicates-pro-modal .processing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 2rem;
    color: rgba(255, 255, 255, 0.6);
}

.processing-indicator .spinner {
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ========================================
   TOOLTIP
   ======================================== */

.dup-tooltip {
    position: relative;
}

.dup-tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.375rem 0.625rem;
    background: #1f1f2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.375rem;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
    z-index: 10;
}

.dup-tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ========================================
   FILE ITEM STATES (migrado de subir.css)
   ======================================== */

/* Estilo para archivos marcados como duplicados OMITIDOS */
.file-item.duplicate {
    opacity: 0.4;
    background: rgba(107, 114, 128, 0.1);
    text-decoration: line-through;
}

/* Hover en archivo duplicado omitido */
.file-item.duplicate:hover {
    opacity: 0.6;
    background: rgba(107, 114, 128, 0.15);
}

/* Estilo para archivos PENDIENTES DE DECISIÓN (duplicado detectado, sin resolver) */
.file-item.duplicate_pending {
    background: rgba(245, 158, 11, 0.15);
    border-left: 3px solid #f59e0b;
    opacity: 0.85;
}

/* Hover en archivo pendiente de decisión */
.file-item.duplicate_pending:hover {
    background: rgba(245, 158, 11, 0.25);
}

/* Indicador de doble clic para archivos duplicados */
.file-item.duplicate,
.file-item.duplicate_pending {
    cursor: pointer;
}

.file-item.duplicate:hover::before,
.file-item.duplicate_pending:hover::before {
    content: 'Doble clic para revisar';
    position: absolute;
    top: -24px;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.25rem 0.5rem;
    background: #1f1f2e;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 0.25rem;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    z-index: 10;
    pointer-events: none;
}

/* ========================================
   BOTÓN FLOTANTE - REABRIR MODAL
   ======================================== */

.reopen-duplicates-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.75rem 0.75rem 0 0.75rem;
    padding: 0.625rem 1rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border: none;
    border-radius: 0.5rem;
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transition: all 0.3s ease;
    animation: pulseButton 2s infinite;
}

.reopen-duplicates-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(245, 158, 11, 0.4);
}

.reopen-duplicates-btn:active {
    transform: translateY(0);
}

.reopen-duplicates-btn.hidden {
    display: none;
}

@keyframes pulseButton {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    }
    50% {
        box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3),
                    0 0 0 4px rgba(245, 158, 11, 0.15);
    }
}

.reopen-duplicates-btn svg {
    width: 1.125rem;
    height: 1.125rem;
    flex-shrink: 0;
}

.reopen-duplicates-btn .reopen-count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 1.375rem;
    height: 1.375rem;
    padding: 0 0.375rem;
    background: rgba(255, 255, 255, 0.25);
    border-radius: 1rem;
    font-size: 0.7rem;
    font-weight: 700;
}

.reopen-duplicates-btn .reopen-text {
    white-space: nowrap;
}

/* Responsive móvil */
@media (max-width: 600px) {
    .reopen-duplicates-btn {
        margin: 0.5rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.75rem;
    }

    .reopen-duplicates-btn .reopen-count {
        min-width: 1.25rem;
        height: 1.25rem;
        font-size: 0.65rem;
    }
}
