/* ==========================================================
   ACERVO PURÉPECHA — HOJA DE ESTILOS (TEMA OSCURO)
   Paleta viva inspirada en la bandera P'urhépecha:
   Morado · Turquesa · Amarillo · Verde
   ========================================================== */

/* ==========================================
   1. VARIABLES GLOBALES
   ========================================== */
:root {
    /* --- Paleta viva (afinada para convivir en armonía sobre fondo oscuro) --- */
    --purple:        #8B5CF6;
    --purple-hover:  #A78BFA;
    --purple-text:   #C4B5FD;
    --purple-bg:     #2E2650;

    --green:         #10B981;
    --green-hover:   #34D399;
    --green-text:    #6EE7B7;
    --green-bg:      #0E3A2C;

    --yellow:        #F59E0B;
    --yellow-hover:  #FBBF24;
    --yellow-text:   #FCD34D;
    --yellow-bg:     #3B2A08;

    --blue:          #0891B2;
    --blue-hover:    #22D3EE;
    --blue-text:     #67E8F9;
    --blue-bg:       #0B3A42;

    /* --- Color primario de la marca --- */
    --primary:        var(--purple);
    --primary-hover:  var(--purple-hover);
    --primary-text:   var(--purple-text);

    /* --- Colores de estado --- */
    --danger:        #EF4444;
    --danger-hover:  #F87171;
    --danger-text:   #FCA5A5;

    --warning:       var(--yellow);
    --warning-hover: var(--yellow-hover);
    --warning-text:  var(--yellow-text);

    --info:          var(--blue);
    --info-hover:    var(--blue-hover);
    --info-text:     var(--blue-text);

    /* --- Fondo y superficies (gris oscuro, como un tema oscuro de chat) --- */
    --bg-body:       #1C1B20;
    --bg-surface:    #26242B;
    --bg-muted:      #302E37;
    --border-color:  #423F4A;

    /* --- Texto --- */
    --text-main:     #F1EFF5;
    --text-gray:     #A6A2AF;
    --text-white:    #FFFFFF;

    /* --- Sombras (profundidad real de tema oscuro) --- */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 22px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 40px rgba(0, 0, 0, 0.55);
    --shadow-glow: 0 0 0 4px rgba(167, 139, 250, 0.35);

    /* --- Espaciados globales --- */
    --space-xs: 6px;
    --space-sm: 12px;
    --space-md: 20px;
    --space-lg: 32px;
    --space-xl: 56px;

    /* --- Bordes y transiciones --- */
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.25s ease;
}

/* ==========================================
   2. RESET Y BASE
   ========================================== */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-body);
    background-image:
        radial-gradient(circle at 8% 10%, rgba(16, 185, 129, 0.24) 0%, transparent 42%),
        radial-gradient(circle at 94% 6%, rgba(8, 145, 178, 0.26) 0%, transparent 44%),
        radial-gradient(circle at 88% 94%, rgba(245, 158, 11, 0.22) 0%, transparent 44%),
        radial-gradient(circle at 6% 92%, rgba(139, 92, 246, 0.28) 0%, transparent 46%),
        radial-gradient(circle at 50% 45%, rgba(139, 92, 246, 0.08) 0%, transparent 60%);
    background-attachment: fixed;
    color: var(--text-main);
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text-main);
}

a { color: inherit; }

img { max-width: 100%; display: block; }

/* Accesibilidad: foco visible consistente en toda la página */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.filter-chip:focus-visible,
.hero-card:focus-visible,
.card:focus-visible {
    outline: 3px solid var(--blue-hover);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
}

::selection {
    background: var(--purple);
    color: var(--text-white);
}

/* Scrollbar (WebKit) acorde al tema oscuro */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 20px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--purple);
}

/* Contenedor general del contenido */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 5%;
}

.content-section {
    animation: fadeIn 0.4s ease;
}

/* ==========================================
   3. BARRA DE NAVEGACIÓN (NAVBAR)
   ========================================== */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.85rem 6%;
    min-height: 48px;
    background: rgba(28, 27, 32, 0.85);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 3px solid transparent;
    border-image: linear-gradient(90deg, var(--purple), var(--blue), var(--green), var(--yellow)) 1;
}

.logo {
    font-size: clamp(1.05rem, 2.4vw, 1.5rem);
    font-weight: 800;
    letter-spacing: -1px;
    color: var(--text-main);
    white-space: nowrap;
}

.logo span {
    display: inline-block;
    color: var(--purple-text);
    animation: colorCycle 6s ease-in-out infinite;
}

/* Agrupa el logo institucional (opcional) junto al nombre "Juchari Echeri" */
/* 🔴 Ahora es un <a>, así que también funciona como botón hacia Inicio */
.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
}

.brand:hover {
    opacity: 0.85;
}

.nav-links {
    display: flex;
    list-style: none;
    align-items: center;
    gap: 2rem;
    margin: 0;
    padding: 0;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-gray);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    padding: 6px 4px;
    position: relative;
    transition: var(--transition);
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: var(--transition);
    border-radius: 2px;
}

.nav-links a:hover {
    color: var(--text-main);
}

.nav-links a:hover::after {
    width: 100%;
}

/* --- Dropdown "Acerca de" --- */
.nav-dropdown {
    position: relative;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
}

.dropdown-caret {
    font-size: 0.7rem;
    transition: var(--transition);
    display: inline-block;
}

.nav-dropdown.open .dropdown-caret {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 8px;
    position: absolute;
    top: calc(100% + 14px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    min-width: 190px;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 1100;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.nav-dropdown-menu li a {
    display: block;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    white-space: nowrap;
}

.nav-dropdown-menu li a::after {
    display: none;
}

.nav-dropdown-menu li a:hover {
    background: var(--purple-bg);
    color: var(--text-main);
}

/* ==========================================
   4. SECCIÓN HERO (INICIO)
   ========================================== */
.hero {
    text-align: center;
    padding: var(--space-xl) 5%;
    background: transparent; /* Las manchas de colores viven en el <body>: todo fluye parejo, sin recuadros */
}

.hero h1 {
    font-size: clamp(2rem, 4vw, 3.25rem);
    margin-bottom: 1rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    max-width: 640px;
    margin: 0 auto;
    color: var(--text-gray);
    font-size: 1.05rem;
}

.hero-cards {
    display: flex;
    justify-content: center;
    gap: var(--space-md);
    margin-top: var(--space-lg);
    flex-wrap: wrap;
}

.hero-card {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 28px 22px;
    width: 210px;
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
    box-shadow: var(--shadow-sm);
}

/* Cada tarjeta vive en su propio color (Música=verde, Libros=turquesa, Partituras=amarillo, Radio Nicolaita=morado) */
.hero-card:nth-child(1) { background: var(--green-bg);  border-color: var(--green); }
.hero-card:nth-child(2) { background: var(--blue-bg);   border-color: var(--blue); }
.hero-card:nth-child(3) { background: var(--yellow-bg); border-color: var(--yellow); }
.hero-card:nth-child(4) { background: var(--purple-bg); border-color: var(--purple); }

.hero-card:nth-child(1):hover { box-shadow: var(--shadow-lg), 0 0 0 4px rgba(52, 211, 153, 0.35); }
.hero-card:nth-child(2):hover { box-shadow: var(--shadow-lg), 0 0 0 4px rgba(34, 211, 238, 0.35); }
.hero-card:nth-child(3):hover { box-shadow: var(--shadow-lg), 0 0 0 4px rgba(251, 191, 36, 0.4); }
.hero-card:nth-child(4):hover { box-shadow: var(--shadow-lg), 0 0 0 4px rgba(167, 139, 250, 0.4); }

.hero-card:hover {
    transform: translateY(-6px) scale(1.02);
}

.hero-card .icon {
    font-size: 2.5rem;
    margin-bottom: 10px;
}

.hero-card h3 {
    margin: 0 0 8px 0;
    color: var(--text-main);
    font-size: 1.1rem;
}

.hero-card p {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin: 0;
}

/* Recuadro del logo institucional, mostrado en la barra de navegación junto
   al nombre "ACERVO", solo cuando el admin haya cargado uno (ver Gestiones
   > Personalización) */
.uni-logo-wrapper {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.uni-logo-img {
    height: 44px;
    width: auto;
    max-width: 140px;
    max-height: 44px;
    object-fit: contain;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px 6px;
}

/* ==========================================
   5. BOTONES Y ETIQUETAS
   ========================================== */
.btn-primary {
    background: var(--primary);
    color: var(--text-white);
    border: none;
    padding: 12px 26px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

.btn-primary::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 40%;
    height: 100%;
    background: rgba(255, 255, 255, 0.35);
    transform: translateX(-120%) skewX(-15deg);
    z-index: 1;
}

.btn-primary:hover::before {
    animation: shimmer 0.7s ease forwards;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-md), var(--shadow-glow);
    transform: translateY(-2px);
}

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

.btn-secondary {
    background: var(--bg-muted);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    padding: 12px 26px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-secondary:hover {
    border-color: var(--blue-hover);
    background: var(--blue-bg);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.25);
    transform: translateY(-2px);
}

.btn-login {
    background: transparent;
    border: 1.5px solid var(--primary);
    color: var(--primary-text) !important;
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    text-decoration: none;
    transition: var(--transition);
    display: inline-block;
}

.btn-login:hover {
    background: var(--primary);
    color: var(--text-white) !important;
    box-shadow: var(--shadow-glow);
}

/* Botones de acción (admin / editor) */
.btn-action {
    border: none;
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    transition: var(--transition);
    flex: 1;
    font-size: 0.8rem;
}

.btn-edit {
    background: var(--blue-bg);
    color: var(--blue-text);
}
.btn-edit:hover {
    background: var(--blue);
    color: var(--text-white);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.3);
    transform: translateY(-1px);
}

.btn-delete {
    background: rgba(239, 68, 68, 0.14);
    color: var(--danger-text);
}
.btn-delete:hover {
    background: var(--danger);
    color: #ffffff;
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.3);
    transform: translateY(-1px);
}

.btn-request {
    background: var(--yellow-bg);
    color: var(--yellow-text);
}
.btn-request:hover {
    background: var(--yellow);
    color: #241a03;
    box-shadow: 0 0 0 4px rgba(251, 191, 36, 0.4);
    transform: translateY(-1px);
}

.badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(28, 27, 32, 0.85);
    backdrop-filter: blur(4px);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--purple-text);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Variantes de color para el badge según categoría */
.badge-green  { background: rgba(16, 185, 129, 0.18); color: var(--green-text); }
.badge-blue   { background: rgba(8, 145, 178, 0.22);  color: var(--blue-text); }
.badge-yellow { background: rgba(245, 158, 11, 0.2);  color: var(--yellow-text); }

/* ==========================================
   6. FILTROS Y BÚSQUEDA
   ========================================== */
.section-header {
    padding-top: var(--space-lg);
}

.section-header h2 {
    margin-bottom: var(--space-sm);
}

.section-subtitle {
    color: var(--text-gray);
    max-width: 680px;
}

/* ==========================================
   6.1 "ACERCA DE": QUIÉNES SOMOS
   ========================================== */
.about-content {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: 32px 36px;
    margin: var(--space-lg) 0;
    max-width: 900px;
}

.about-content p {
    color: var(--text-main);
    font-size: 1rem;
    line-height: 1.8;
    white-space: pre-line;
    margin: 0;
}

.custom-filters {
    display: flex;
    gap: 10px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.filter-chip {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-gray);
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
}

.filter-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--text-white);
    box-shadow: var(--shadow-md), var(--shadow-glow);
}

/* Identidad de color por categoría */
.filter-chip[data-filter="musica"]:hover    { border-color: var(--green); }
.filter-chip[data-filter="libro"]:hover     { border-color: var(--blue); }
.filter-chip[data-filter="partitura"]:hover { border-color: var(--yellow); }

.filter-chip[data-filter="musica"].active {
    background: var(--green);
    border-color: var(--green);
    color: var(--text-white);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(52, 211, 153, 0.35);
}

.filter-chip[data-filter="libro"].active {
    background: var(--blue);
    border-color: var(--blue);
    color: var(--text-white);
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(34, 211, 238, 0.35);
}

.filter-chip[data-filter="partitura"].active {
    background: var(--yellow);
    border-color: var(--yellow);
    color: #241a03;
    box-shadow: var(--shadow-md), 0 0 0 4px rgba(251, 191, 36, 0.4);
}

.sub-filters {
    display: flex;
    gap: 15px;
    margin-top: var(--space-md);
    flex-wrap: wrap;
}

.select-premium {
    background: var(--blue-bg);
    color: var(--blue-text);
    border: 1.5px solid var(--blue);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    outline: none;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.select-premium option {
    background: var(--bg-surface);
    color: var(--text-main);
}

.select-premium:hover {
    border-color: var(--blue-hover);
    background: rgba(8, 145, 178, 0.3);
}

.select-premium:focus {
    border-color: var(--blue-hover);
    box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.3);
}

/* ==========================================
   7. GRID Y TARJETAS (BIBLIOTECA)
   ========================================== */
.grid-contenido {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--space-md);
    padding: var(--space-lg) 0 var(--space-xl);
}

.grid-contenido .card {
    animation: cardIn 0.45s ease both;
}

.grid-contenido .card:nth-child(4n+1) { animation-delay: 0.02s; }
.grid-contenido .card:nth-child(4n+2) { animation-delay: 0.08s; }
.grid-contenido .card:nth-child(4n+3) { animation-delay: 0.14s; }
.grid-contenido .card:nth-child(4n+4) { animation-delay: 0.2s; }

.card {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 16px;
    transition: var(--transition);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary);
}

.card[data-category="musica"]::before    { background: var(--green); }
.card[data-category="libro"]::before     { background: var(--blue); }
.card[data-category="partitura"]::before { background: var(--yellow); }

.card:hover {
    transform: translateY(-6px);
    border-color: var(--primary);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.card[data-category="musica"]:hover {
    border-color: var(--green);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(52, 211, 153, 0.3);
}

.card[data-category="libro"]:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(34, 211, 238, 0.3);
}

.card[data-category="partitura"]:hover {
    border-color: var(--yellow);
    box-shadow: var(--shadow-lg), 0 0 0 4px rgba(251, 191, 36, 0.35);
}

.card-img {
    width: 100%;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-muted);
    border-radius: var(--radius-sm);
    position: relative;
    cursor: pointer;
}

.card-info {
    padding-top: 12px;
}

.card-info h3 {
    margin: 0 0 4px 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.card-info p {
    margin: 0;
    color: var(--text-gray);
    font-size: 0.88rem;
}

.card-info .meta-info {
    margin-top: 8px;
    font-size: 0.78rem !important;
    color: var(--text-gray) !important;
}

/* Fila de botones de administración dentro de la tarjeta */
.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

.add-card {
    border: 2px dashed var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: var(--bg-muted);
}

.add-card:hover {
    border-color: var(--primary);
    background: var(--purple-bg);
}

.plus {
    font-size: 3rem;
    color: var(--primary-text);
}

/* ==========================================
   8. PANELES DE ADMINISTRACIÓN Y FORMULARIOS
   ========================================== */
.admin-panel {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    padding: 34px 36px;
    margin: var(--space-lg) 0;
    position: relative;
    overflow: hidden;
}

.admin-panel::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: linear-gradient(90deg, var(--purple), var(--blue), var(--green), var(--yellow));
}

.admin-header {
    margin-bottom: var(--space-md);
}

.admin-header p {
    color: var(--text-gray);
    margin-top: 4px;
}

.upload-form {
    background: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.form-column { min-width: 0; }

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-gray);
}

.input-group input,
.input-group textarea,
.input-group select,
.file-input {
    width: 100%;
    padding: 12px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    box-sizing: border-box;
    font-family: inherit;
    transition: var(--transition);
}

.input-group input:hover,
.input-group textarea:hover,
.file-input:hover {
    border-color: var(--primary);
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-glow);
}

.special-fields {
    margin-top: 30px;
    padding-top: 20px;
}

.special-fields hr {
    border: none;
    border-top: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sub-form-box {
    background: var(--purple-bg);
    padding: 20px;
    border-radius: var(--radius-sm);
    border-left: 4px solid var(--primary);
    margin-top: 15px;
    animation: fadeIn 0.4s ease;
}

.form-footer {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
    flex-wrap: wrap;
    gap: 12px;
}

.meta-info-preview {
    font-size: 0.85rem;
    color: var(--text-gray);
}

/* ==========================================
   9. COMPONENTES DE CANCIONES (TRACKS)
   ========================================== */
.tracks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--space-md);
    margin-top: var(--space-md);
}

.track-item {
    background: var(--bg-muted);
    padding: 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
}

.track-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.track-card:hover {
    border-color: var(--blue);
    box-shadow: var(--shadow-md);
}

.track-header {
    background: var(--blue-bg);
    padding: 8px 15px;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--blue-text);
    border-bottom: 1px solid var(--border-color);
}

.track-body {
    padding: 15px;
}

.track-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
}

.track-row input {
    flex: 1;
    font-size: 0.85rem;
    padding: 8px !important;
}

.mini-label {
    font-size: 0.7rem;
    color: var(--text-gray);
    display: flex;
    align-items: center;
}

.file-input-mini {
    font-size: 0.7rem !important;
    padding: 5px !important;
}

.track-body textarea {
    font-size: 0.8rem;
    padding: 8px !important;
    resize: none;
}

/* Tracklist dentro del modal de álbum: usa todo el espacio libre disponible
   (fila elástica del grid) y tiene su propio scroll interno; las filas de
   canciones son planas (sin caja individual) */
.modal-tracklist-wrapper:not(:empty) {
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 14px;
    min-height: 0;
    height: 100%;
    overflow-y: auto;
}

.album-tracklist {
    display: flex;
    flex-direction: column;
}

.track-row-flat {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: var(--transition);
}

.track-row-flat:last-child {
    border-bottom: none;
}

.track-row-flat:hover {
    background: rgba(139, 92, 246, 0.1);
}

.track-row-flat.is-locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.track-row-flat.is-locked:hover {
    background: transparent;
}

.track-name {
    color: var(--text-main);
    font-size: 0.9rem;
}

.track-index {
    color: var(--text-gray);
    margin-right: 10px;
}

.track-play-label {
    color: var(--primary-text);
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
}

.track-locked-label {
    color: var(--text-gray);
    font-size: 0.7rem;
    white-space: nowrap;
}

.track-empty {
    color: var(--text-gray);
    padding: 10px 2px;
}

/* Lista de canciones dentro del modal de EDICIÓN de álbum: cada fila permite
   elegir un archivo nuevo del dispositivo y reemplazar esa canción puntual. */
.edit-tracks-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 260px;
    overflow-y: auto;
    padding-right: 4px;
    margin-top: 8px;
}

.edit-track-row {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
}

.edit-track-name {
    color: var(--text-main);
    font-size: 0.85rem;
    flex: 1 1 140px;
}

.edit-track-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.edit-track-actions .file-input-mini {
    max-width: 170px;
}

/* Vista previa del logo institucional dentro del panel de Personalización */
.logo-preview-row {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 48px;
}

.logo-preview-img {
    max-height: 48px;
    max-width: 160px;
    object-fit: contain;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
}

/* ==========================================
   10. VENTANAS EMERGENTES (MODAL Y LOGIN)
   ========================================== */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 70vh;
}

.login-box {
    background: var(--bg-surface);
    padding: 40px;
    border-radius: var(--radius-md);
    width: 100%;
    max-width: 400px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.login-box h2 {
    margin-top: 0;
    margin-bottom: 5px;
}

.login-box p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 25px;
}

.login-footer {
    margin-top: 20px;
    text-align: center;
    font-size: 0.9rem;
}

.login-footer a {
    color: var(--primary-text);
    text-decoration: none;
    font-weight: 600;
}

.w-100 { width: 100%; }

.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(6px);
    overflow: auto;
}

.modal-content {
    background-color: var(--bg-surface);
    margin: 4% auto;
    padding: 30px;
    border-radius: var(--radius-lg);
    width: 92%;
    max-width: 960px;
    max-height: 88vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease;
}

/* Ventanas de formulario (editar, contacto, etc.): además del scroll del
   propio modal-content, dejamos algo de aire abajo para que el último
   campo/botón nunca quede pegado al borde. */
.modal-content .upload-form:last-child {
    padding-bottom: 4px;
}

/* Layout: portada pequeña + descripción a la izquierda; a la derecha, apiladas
   y pegadas entre sí: lista de canciones, reproductor y botón de descarga.
   .modal-info se "vuelve invisible" como caja (display:contents) para que sus
   hijos entren directo al grid de modal-body. */
.modal-body {
    display: grid;
    grid-template-columns: 220px 1fr;
    grid-template-rows: auto auto auto auto 1fr auto auto;
    grid-template-areas:
        "title    list"
        "subtitle list"
        "cover    list"
        "desc     list"
        ".        list"
        ".        player"
        ".        actions";
    gap: 8px 28px;
    max-height: calc(88vh - 60px);
}

.modal-info {
    display: contents;
}

/* Modo "documento" (libros y partituras): no hay lista de canciones, así que
   la descripción/sinopsis ocupa toda la columna derecha (antes vacía) y la
   columna izquierda se queda solo con portada, autor y título. */
.modal-body.is-doc-mode {
    grid-template-areas:
        "title    desc"
        "subtitle desc"
        "cover    desc"
        ".        desc"
        ".        desc"
        ".        player"
        ".        actions";
}

.modal-body.is-doc-mode #modal-descripcion {
    grid-area: desc;
    max-height: none;
    height: 100%;
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px 20px;
    font-size: 0.95rem;
    line-height: 1.7;
}

#modal-titulo {
    grid-area: title;
    align-self: end;
    margin: 0;
    font-size: 1.6rem;
}

#modal-subtitulo {
    grid-area: subtitle;
    align-self: start;
    color: var(--primary-text);
    margin: 0 0 4px 0;
    font-weight: 600;
    font-size: 0.95rem;
}

#modal-descripcion {
    grid-area: desc;
    align-self: start;
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-gray);
    max-height: 140px;
    overflow-y: auto;
    padding-right: 4px;
}

#player-section {
    grid-area: player;
    margin: 0;
}

#modal-tracklist-wrapper {
    grid-area: list;
}

.modal-img {
    grid-area: cover;
    width: 100%;
    max-width: 220px;
    aspect-ratio: 1;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-muted);
    border-radius: var(--radius-sm);
    align-self: start;
}

.modal-actions {
    grid-area: actions;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 0;
    padding-top: var(--space-sm);
    border-top: 1px solid var(--border-color);
}

.close-modal {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-gray);
    transition: var(--transition);
}

.close-modal:hover {
    color: var(--danger-text);
    transform: rotate(90deg);
}

/* ==========================================
   11. REPRODUCTOR DE AUDIO
   ========================================== */
.player-container { margin-top: 0; }

.audio-player {
    background: var(--bg-muted);
    padding: 12px;
    border-radius: var(--radius-sm);
    margin: 0;
    border: 1px solid var(--border-color);
}

#preview-tag {
    font-size: 0.8rem;
    color: var(--danger-text);
    margin-bottom: 10px;
    margin-top: 0;
}

audio {
    width: 100%;
    height: 40px;
    border-radius: var(--radius-sm);
}

/* ==========================================
   12. SISTEMA DE ROLES Y SEGURIDAD
   ========================================== */
.admin-only {
    display: none !important;
}

body.role-admin .admin-only,
body.role-editor .admin-only {
    display: flex !important;
}

body.role-admin li.admin-only,
body.role-editor li.admin-only {
    display: list-item !important;
}

.access-denied-message {
    display: block;
    text-align: center;
    padding: 100px 20px;
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    border: 1px dashed var(--danger);
    margin-top: var(--space-lg);
}

body.role-admin .access-denied-message,
body.role-editor .access-denied-message {
    display: none;
}

/* Nivel: solo administradores principales */
.super-admin-only {
    display: none !important;
}

body.role-admin .super-admin-only {
    display: block !important;
}

body.role-admin li.super-admin-only {
    display: list-item !important;
}

.error-icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

/* ==========================================
   13. PERFIL, MENÚ Y MODALES SECUNDARIOS
   ========================================== */
.perfil-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--primary);
    transition: var(--transition);
    object-fit: cover;
}

.perfil-avatar:hover {
    transform: scale(1.08);
    box-shadow: var(--shadow-glow);
}

.perfil-menu {
    position: absolute;
    top: 55px;
    right: -10px;
    background: var(--bg-surface);
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    z-index: 2000;
}

.btn-logout {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    width: max-content;
    transition: var(--transition);
}

.btn-logout:hover {
    background: var(--danger-hover);
    box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.3);
}

.modal-title-info   { color: var(--blue-text); }
.modal-title-danger { color: var(--danger-text); }

.contact-box {
    background: var(--bg-muted);
    padding: 15px;
    border-radius: var(--radius-sm);
    text-align: left;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.modal-close-text {
    color: var(--text-gray);
    float: right;
    font-size: 26px;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
}

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

/* ==========================================
   14. BANDEJAS DE ADMINISTRACIÓN Y ESTADOS
   ========================================== */
.queue-card {
    background: var(--bg-muted);
    padding: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    margin-bottom: 15px;
    box-shadow: var(--shadow-sm);
}

.queue-card.queue-danger  { border-left-color: var(--danger); }
.queue-card.queue-warning { border-left-color: var(--yellow); }
.queue-card.queue-info    { border-left-color: var(--blue); }

.queue-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
    gap: 10px;
}

.queue-card-title {
    margin: 0;
    color: var(--danger-text);
    font-size: 1.1rem;
}

.queue-card-subtitle {
    margin: 5px 0 10px 0;
    color: var(--text-main);
}

.queue-card-date {
    font-size: 0.8rem;
    color: var(--text-gray);
    white-space: nowrap;
}

.queue-card-reason {
    font-size: 0.9rem;
    margin-bottom: 5px;
    color: var(--text-main);
}

.queue-card-meta {
    font-size: 0.85rem;
    color: var(--text-gray);
    margin-bottom: 8px;
}

.queue-card-actions {
    display: flex;
    gap: 10px;
    margin-top: 12px;
}

.queue-card-actions button {
    border: none;
    padding: 10px 15px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    flex: 1;
    transition: var(--transition);
}

.btn-approve { background: var(--danger); color: #fff; }
.btn-approve:hover { background: var(--danger-hover); box-shadow: 0 0 0 4px rgba(248, 113, 113, 0.3); }

.btn-reject { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-color) !important; }
.btn-reject:hover { background: var(--border-color); }

.btn-publish { background: var(--green); color: #fff; }
.btn-publish:hover { background: var(--green-hover); box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.3); }

.btn-grant { background: var(--blue); color: #fff; }
.btn-grant:hover { background: var(--blue-hover); box-shadow: 0 0 0 4px rgba(34, 211, 238, 0.3); }

.text-highlight-blue { color: var(--blue-text); font-weight: 700; }

/* Mensajes de estado (vacío / cargando) dentro de listas y bandejas */
.empty-state {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--green-bg);
    color: var(--green-text);
    border: 1px solid var(--green);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-weight: 700;
    margin: 4px 0;
}

.loading-state {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-muted);
    color: var(--text-gray);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    font-style: italic;
    margin: 4px 0;
}

/* ==========================================
   15. ANIMACIONES
   ========================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes colorCycle {
    0%, 100% { color: var(--purple-text); }
    25%      { color: var(--blue-text); }
    50%      { color: var(--green-text); }
    75%      { color: var(--yellow-text); }
}

@keyframes shimmer {
    0%   { transform: translateX(-120%) skewX(-15deg); }
    100% { transform: translateX(220%) skewX(-15deg); }
}

@keyframes cardIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ==========================================
   16. RESPONSIVO
   ========================================== */

/* Tablets */
@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .modal-content {
        max-height: 92vh;
    }

    .modal-body,
    .modal-body.is-doc-mode {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
        grid-template-areas:
            "title"
            "subtitle"
            "cover"
            "desc"
            "list"
            "player"
            "actions";
        max-height: calc(92vh - 60px);
        overflow-y: auto;
    }

    .modal-body.is-doc-mode #modal-descripcion {
        height: auto;
        max-height: none;
    }

    .modal-img {
        max-width: 220px;
        margin: 0 auto;
        align-self: center;
    }

    .modal-tracklist-wrapper:not(:empty) {
        max-height: 320px;
    }

    .hero h1 {
        font-size: 2.4rem;
    }
}

/* Móviles */
@media (max-width: 640px) {
    .navbar {
        flex-wrap: wrap;
        gap: 10px;
        padding: 1rem 5%;
    }

    .nav-links {
        gap: 1rem;
        width: 100%;
        justify-content: center;
    }

    .container {
        padding: 0 5%;
    }

    .hero {
        padding: var(--space-lg) 5%;
    }

    .hero-cards {
        gap: 12px;
    }

    .hero-card {
        width: 100%;
        max-width: 280px;
    }

    .grid-contenido {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 14px;
        padding: var(--space-md) 0 var(--space-lg);
    }

    .admin-panel {
        padding: 24px 20px;
    }

    .modal-content {
        width: 94%;
        margin: 8% auto;
        padding: 20px;
    }

    .modal-tracklist-wrapper:not(:empty) {
        max-height: 200px;
    }

    .form-footer {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    #contenedor-auth {
        margin-left: auto;
    }
}

/* Accesibilidad: respeta la preferencia de movimiento reducido */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}

/* ==========================================
   17. PIE DE PÁGINA (CRÉDITOS, DERECHOS Y PRIVACIDAD)
   ========================================== */
.site-footer {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    margin-top: var(--space-xl);
}

.footer-inner {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
    padding: var(--space-lg) 5%;
}

.footer-col h4 {
    color: var(--text-main);
    font-size: 1rem;
    margin: 0 0 10px 0;
}

.footer-col p {
    color: var(--text-gray);
    font-size: 0.85rem;
    line-height: 1.6;
    margin: 0;
}

.footer-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.footer-links a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
}

.footer-links a:hover {
    color: var(--primary-text);
}

.footer-bottom {
    border-top: 1px solid var(--border-color);
    padding: var(--space-sm) 5%;
    text-align: center;
}

.footer-bottom p {
    color: var(--text-gray);
    font-size: 0.8rem;
    margin: 0;
}

@media (max-width: 900px) {
    .footer-inner {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .footer-inner {
        grid-template-columns: 1fr;
        text-align: center;
        gap: var(--space-md);
    }

    .footer-links {
        align-items: center;
    }
}
