:root {
    --fondo: #f6f6f8;
    --superficie: #ffffff;
    --superficie-2: #f1f1f4;
    --texto: #1c1c22;
    --texto-suave: #6b6b76;
    --borde: #e4e4e9;
    --acento: #6d4ae0;
    --acento-hover: #5a38cc;
    --acento-texto: #ffffff;
    --acento-suave: #efeafd;
    --error: #d93636;
    --sombra: 0 1px 2px rgba(20, 20, 30, 0.04), 0 4px 16px rgba(20, 20, 30, 0.06);
    --arcoiris: linear-gradient(90deg, #e40303 0 16.66%, #ff8c00 0 33.33%, #ffed00 0 50%, #008026 0 66.66%, #004dff 0 83.33%, #750787 0);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fondo: #0f0f13;
        --superficie: #1a1a21;
        --superficie-2: #23232c;
        --texto: #ececf1;
        --texto-suave: #9d9daa;
        --borde: #2c2c36;
        --acento: #a08cff;
        --acento-hover: #b5a6ff;
        --acento-texto: #15121f;
        --acento-suave: #2a2340;
        --error: #ff6b6b;
        --sombra: 0 1px 2px rgba(0, 0, 0, 0.3), 0 4px 16px rgba(0, 0, 0, 0.25);
    }
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: var(--fondo);
    color: var(--texto);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

button {
    font: inherit;
    color: inherit;
}

.icono {
    width: 20px;
    height: 20px;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.arcoiris {
    height: 4px;
    background: var(--arcoiris);
}

/* Login */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 16px;
}

.login-box {
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: 16px;
    box-shadow: var(--sombra);
    max-width: 380px;
    width: 100%;
    overflow: hidden;
}

.logo-section {
    padding: 36px 32px 8px;
    text-align: center;
}

.logo-section h1 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    margin-top: 6px;
    color: var(--texto-suave);
    font-size: 14px;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 24px 32px 32px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
}

.form-group input {
    padding: 12px 14px;
    border: 1px solid var(--borde);
    border-radius: 10px;
    font: inherit;
    font-size: 16px;
    background: var(--superficie);
    color: var(--texto);
}

.form-group input:focus,
.search-input:focus {
    outline: none;
    border-color: var(--acento);
    box-shadow: 0 0 0 3px var(--acento-suave);
}

.btn-login {
    padding: 12px;
    background: var(--acento);
    color: var(--acento-texto);
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-login:hover {
    background: var(--acento-hover);
}

.error-message {
    color: var(--error);
    font-size: 14px;
    text-align: center;
    display: none;
}

.error-message.show {
    display: block;
    animation: shake 0.4s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-8px); }
    75% { transform: translateX(8px); }
}

/* App */
.app-container {
    min-height: 100vh;
    flex-direction: column;
}

.header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--superficie);
    border-bottom: 1px solid var(--borde);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.header h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.search-box {
    position: relative;
    flex: 0 1 300px;
    display: flex;
    align-items: center;
    color: var(--texto-suave);
}

.search-box .icono {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--borde);
    border-radius: 999px;
    font: inherit;
    font-size: 15px;
    background: var(--superficie-2);
    color: var(--texto);
}

.content {
    flex: 1;
    max-width: 1100px;
    margin: 0 auto;
    width: 100%;
    padding: 28px 16px 48px;
}

.songs-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--texto-suave);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 14px;
}

.songs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.song-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 16px 14px 16px 18px;
    text-align: left;
    background: var(--superficie);
    border: 1px solid var(--borde);
    border-radius: 14px;
    box-shadow: var(--sombra);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
}

.song-card:hover {
    border-color: var(--acento);
    transform: translateY(-2px);
}

.song-card-info {
    flex: 1;
    min-width: 0;
}

.song-card h3 {
    font-size: 17px;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin-bottom: 8px;
}

.badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px 3px 7px;
    border-radius: 999px;
    background: var(--acento-suave);
    color: var(--acento);
    font-size: 13px;
    font-weight: 600;
}

.badge .icono {
    width: 15px;
    height: 15px;
}

.song-card > .icono {
    color: var(--texto-suave);
}

.vacio {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--texto-suave);
    padding: 24px 0;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 15, 0.55);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.2s ease-out;
}

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

.modal-content {
    background: var(--superficie);
    border-radius: 16px;
    width: 100%;
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 24px;
    animation: slideUp 0.25s ease-out;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.modal-header h2 {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex: none;
    border: none;
    border-radius: 50%;
    background: var(--superficie-2);
    color: var(--texto-suave);
    cursor: pointer;
}

.modal-close:hover {
    color: var(--texto);
}

.tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 20px;
    background: var(--superficie-2);
    border-radius: 12px;
}

.tab-btn {
    flex: 1;
    padding: 9px 6px;
    border: none;
    border-radius: 9px;
    background: none;
    color: var(--texto-suave);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.tab-btn.active {
    background: var(--superficie);
    color: var(--texto);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

.tab-content {
    display: none;
}

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

.file-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.archivo {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 12px;
    padding: 14px;
    border: 1px solid var(--borde);
    border-radius: 12px;
}

.archivo-nombre {
    flex: 1 1 160px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 15px;
    min-width: 0;
}

.archivo-nombre .icono {
    color: var(--acento);
}

.archivo audio {
    flex: 1 1 100%;
    width: 100%;
    order: 3;
}

.acciones {
    display: flex;
    gap: 8px;
}

.boton {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 9px;
    border: 1px solid var(--borde);
    background: var(--superficie);
    color: var(--texto);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.boton:hover {
    border-color: var(--acento);
}

.boton .icono {
    width: 17px;
    height: 17px;
}

.boton-principal {
    background: var(--acento);
    border-color: var(--acento);
    color: var(--acento-texto);
}

.boton-principal:hover {
    background: var(--acento-hover);
}

/* Visor PDF */
.pdf-fullscreen {
    position: fixed;
    inset: 0;
    background: #111114;
    display: flex;
    flex-direction: column;
    z-index: 2000;
    padding-top: 64px;
    animation: fadeIn 0.2s ease-out;
}

.pdf-fullscreen-close {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2001;
}

.pdf-fullscreen-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.pdf-paginas {
    flex: 1;
    width: 100%;
    max-width: 900px;
    margin: 0 auto;
    overflow-y: auto;
}

.pdf-paginas canvas {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    background: #fff;
}

.pdf-cargando {
    color: #ccc;
    text-align: center;
    margin-top: 40px;
}

.pdf-fullscreen-viewer {
    width: 100%;
    height: 100%;
    border: none;
}

@media (max-width: 640px) {
    .header-content {
        flex-direction: column;
        align-items: stretch;
    }

    .search-box {
        flex: none;
    }

    .songs-grid {
        grid-template-columns: 1fr;
    }

    .modal {
        padding: 0;
    }

    .modal-content {
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        padding: 16px;
    }

    .modal-header h2 {
        font-size: 20px;
    }
}
