/**
 * Estilos para el módulo de subida de música
 * subir.php
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    font-family: 'Inter', sans-serif;
}

/* Scrollbar personalizada */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #0f0f17;
}

::-webkit-scrollbar-thumb {
    background: #252532;
    border-radius: 3px;
}

/* YouTube URL download */
.yt-url-wrapper {
    transition: border-color 0.2s;
    cursor: text;
}
.yt-url-wrapper:hover {
    border-color: rgba(255, 0, 0, 0.3);
}
.yt-url-wrapper:focus-within {
    border-color: rgba(255, 0, 0, 0.5);
}
.yt-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ef4444;
    border-radius: 50%;
    animation: ytSpin 0.6s linear infinite;
    flex-shrink: 0;
}
@keyframes ytSpin {
    to { transform: rotate(360deg); }
}

/* Zona de subida (ahora es el fileList) */
#fileList.dragover {
    background-color: rgba(99, 102, 241, 0.1);
    border: 2px dashed #6366f1;
    border-radius: 0.5rem;
}

#fileList {
    transition: background-color 0.2s, border 0.2s;
    border: 2px dashed transparent;
}

/* Estados de archivos en la lista */
.file-item.active {
    background: rgba(99, 102, 241, 0.2);
    border-left: 3px solid #6366f1;
}

.file-item.uploading {
    opacity: 0.5;
}

.file-item.uploaded {
    opacity: 0.6;
}

.file-item.error {
    background: rgba(239, 68, 68, 0.1);
}

.file-item.rejected {
    opacity: 0.5;
    background: rgba(239, 68, 68, 0.1);
}

/* Estilos .file-item.duplicate movidos a duplicados_pro.css */

.file-item.already_uploaded {
    opacity: 0.5;
    background: rgba(59, 130, 246, 0.1);
}

.file-item.edited {
    border-left: 3px solid #22c55e;
}

/* Estilos de formulario */
select option {
    background-color: #0f0f17;
    color: white;
    padding: 8px 12px;
}

/* Dropdown de género personalizado */
.genre-dropdown-container {
    position: relative;
}

.genre-dropdown {
    position: relative;
}

.genre-dropdown-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    background: #1a1a2e;
    border: 2px solid rgba(99, 102, 241, 0.6);
    border-radius: 8px;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.15s;
    text-align: left;
}

.genre-dropdown-btn:hover,
.genre-dropdown-btn:focus {
    border-color: #6366f1;
    outline: none;
}

.genre-dropdown-btn span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.genre-dropdown-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 70vh; /* Fallback, JS lo ajustará dinámicamente */
    overflow-y: auto;
    overflow-x: hidden;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    z-index: 100;
    scroll-behavior: smooth;
}

.genre-dropdown-list::-webkit-scrollbar {
    width: 6px;
}

.genre-dropdown-list::-webkit-scrollbar-track {
    background: transparent;
}

.genre-dropdown-list::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 3px;
}

.genre-option {
    padding: 5px 10px;
    cursor: pointer;
    transition: background 0.1s;
    font-size: 12px;
    line-height: 1.3;
}

.genre-option:hover {
    background: rgba(99, 102, 241, 0.2);
}

.genre-option.selected {
    background: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.genre-option-new {
    color: #4ade80;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 2px;
    padding-top: 6px;
}

/* Mejorar scroll en selects nativos restantes */
select {
    scrollbar-width: thin;
    scrollbar-color: #6366f1 #1a1a2e;
}

select::-webkit-scrollbar {
    width: 6px;
}

select::-webkit-scrollbar-track {
    background: #1a1a2e;
    border-radius: 3px;
}

select::-webkit-scrollbar-thumb {
    background: #6366f1;
    border-radius: 3px;
}

select::-webkit-scrollbar-thumb:hover {
    background: #818cf8;
}

/* Range slider */
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #6366f1;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* Notificaciones */
.notification {
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 3s forwards;
}

/* Notificación persistente - sin fadeOut automático */
.notification.persistent {
    animation: slideIn 0.3s ease;
}

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

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* Botón editar móvil - oculto por defecto */
.btn-edit-mobile {
    display: none;
}

/* ==========================================
   ESTILOS MÓVIL (max-width: 600px)
   Usando clases específicas aplicadas via JS
   ========================================== */
@media (max-width: 600px) {
    /* Body: usar dvh para evitar problemas con barra de direcciones */
    body.subir-page {
        height: 100dvh;
        min-height: -webkit-fill-available;
        overflow: auto;
    }

    /* Layout principal */
    body.subir-page #subirMainContainer {
        flex-direction: column;
        overflow-y: auto;
        overflow-x: hidden;
    }

    /* Panel de subida ocupa todo el ancho */
    body.subir-page #panelUpload {
        width: 100%;
        flex: 1;
        min-height: 45%;
        flex-shrink: 0;
        border-right: none;
        border-bottom: 2px solid #6366f1;
    }

    /* Panel de detalles oculto en móvil (usar modal) */
    body.subir-page #panelDetails {
        display: none;
    }

    /* Botón editar visible en móvil */
    body.subir-page .btn-edit-mobile {
        display: flex;
    }

    /* Navegación inferior fija y visible en móvil */
    body.subir-page nav.h-14 {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        padding-bottom: env(safe-area-inset-bottom);
    }

    /* Agregar padding al contenido para no tapar con la nav fija */
    body.subir-page #subirMainContainer {
        padding-bottom: 60px;
    }

    /* Header stats más compactos */
    body.subir-page #headerStats {
        font-size: 0.6rem;
        gap: 0.5rem;
    }

    body.subir-page #headerStats svg {
        width: 0.75rem;
        height: 0.75rem;
    }

    /* Zona de arrastre compacta */
    body.subir-page #dropZone {
        margin: 0.5rem;
        padding: 0.75rem;
    }

    body.subir-page #dropZone .w-12 {
        width: 2.5rem;
        height: 2.5rem;
    }

    body.subir-page #dropZone svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    body.subir-page #dropZone p {
        font-size: 0.75rem;
    }

    body.subir-page #dropZone p.text-xs {
        font-size: 0.65rem;
    }

    /* Contador de archivos */
    body.subir-page #panelUpload > .px-4.pb-2 {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
    }

    /* Lista de archivos */
    body.subir-page #fileList {
        padding: 0.25rem;
        overflow-x: hidden;
    }

    body.subir-page .file-item {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    /* En móvil: título se adapta, iconos tienen prioridad */
    body.subir-page .file-item .file-info {
        flex: 1 1 0;
        min-width: 60px;
    }

    /* Ocultar botón de género en móvil */
    body.subir-page .file-item .btn-genre {
        display: none;
    }

    /* Progreso de subida */
    body.subir-page #uploadProgress {
        padding: 0.5rem;
    }

    body.subir-page #uploadProgress .text-sm {
        font-size: 0.7rem;
    }

    /* Notificaciones */
    body.subir-page #notifications {
        right: 0.5rem;
        left: 0.5rem;
        top: 50px;
    }

    body.subir-page .notification {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
    }

    /* Modales adaptados (duplicatesModal movido a duplicados_pro.css) */
    body.subir-page #newGenreModal > div,
    body.subir-page #fileSizeModal > div,
    body.subir-page #lowQualityModal > div,
    body.subir-page #searchModal > div {
        margin: 0.5rem;
        max-height: 85vh;
        max-width: calc(100vw - 1rem);
    }

    body.subir-page #newGenreModal h3,
    body.subir-page #fileSizeModal h3,
    body.subir-page #lowQualityModal h3,
    body.subir-page #searchModal h2 {
        font-size: 1rem;
    }
}
