/* --- 1. IMPORTACIÓN DE FUENTE "PLUS JAKARTA SANS" --- */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
    /* --- PALETA DE DÍA --- */
    --bg-body: #f7f6f3;
    --bg-card: #ffffff;
    --bg-input: #f0efeb;
    --bg-hover: #e7e5df;
    
    --text-main: #222a36;
    --text-muted: #6b7280;
    --border-light: #e6e4dd;

    /* Acentos */
    --primary: #2b4a72;
    --celeste: #2B8CC4;
    --primary-glow: rgba(43, 74, 114, 0.18);
    --accent-gradient: linear-gradient(135deg, #2b4a72 0%, #2B8CC4 100%);
    --logo-gradient: linear-gradient(to right, #2b4a72 0%, #2B8CC4 55%, #ffffff 100%);
    
    --success: #10b981;
    --danger: #ef4444;
    --print: var(--celeste);

    /* FÍSICA VISUAL */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    
    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-card: 0 2px 8px -2px rgba(15, 23, 42, 0.08);
    --shadow-float: 0 8px 20px -8px rgba(15, 23, 42, 0.14);
}

/* --- MODO NOCTURNO --- */
body.dark-mode {
    --bg-body: #10141b;  
    --bg-card: #171c25;  
    --bg-input: #1f2530;
    --bg-hover: #293140;
    
    --text-main: #e9e7e2;
    --text-muted: #9aa2b0;
    --border-light: #2e3746;
    
    --primary: #6c8fb5; 
    --celeste: #7cc3ea;
    --primary-glow: rgba(108, 143, 181, 0.3);
    --accent-gradient: linear-gradient(135deg, #6c8fb5 0%, #7cc3ea 100%);
    --logo-gradient: linear-gradient(to right, #ffffff 0%, #dff1fb 35%, #6c8fb5 100%);
    
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 10px 30px -5px rgba(0, 0, 0, 0.5);
}

/* --- BASE --- */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body { 
    font-family: 'Plus Jakarta Sans', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    line-height: 1.6;
    font-size: 16px;
    transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s;
    padding-bottom: 120px;
}

/* --- HEADER "OBSIDIAN GLASS" --- */
.header { 
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-light);
    padding: 1rem 1.5rem;
    position: sticky; top: 0; z-index: 100;
    transition: all 0.4s ease;
}

body.dark-mode .header { 
    background: rgba(11, 17, 33, 0.75); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: none; 
}

.header-content { max-width: 900px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }

/* LOGO: firma de marca con destello sutil */
.logo { 
    color: transparent;
    background: var(--logo-gradient);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 800; 
    font-size: 1.4rem; 
    letter-spacing: -0.03em; 
    animation: logoShine 7s ease-in-out infinite;
}

@keyframes logoShine {
    0%, 100% { background-position: 0% center; }
    50% { background-position: 100% center; }
}

@media (prefers-reduced-motion: reduce) {
    .logo { animation: none; background-position: 0% center; }
}

.theme-toggle-btn { 
    background: var(--bg-input); border: none; border-radius: 50%; width: 42px; height: 42px; 
    display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 1.2rem; transition: transform 0.2s;
}
body.dark-mode .theme-toggle-btn { background: rgba(255,255,255,0.05); color: #fbbf24; box-shadow: none; } 
.theme-toggle-btn:active { transform: scale(0.9); }

/* --- CONTENEDOR --- */
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; animation: slideUp 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* --- TARJETAS --- */
.card {
    background-color: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-interactive:hover { transform: translateY(-2px); box-shadow: var(--shadow-float); border-color: var(--celeste); }

/* --- UI COMPONENTS DASHBOARD --- */
.recent-full-item { 
    background: var(--bg-hover); 
    border-radius: var(--radius-md); 
    padding: 20px; 
    border-left: 4px solid var(--success); 
    margin-top: 10px;
}

/* === AQUÍ ESTÁ EL CAMBIO PARA EL TEXTO DEL DASHBOARD === */
.recent-full-item ul li {
    /* Usamos la fuente del sistema para máxima legibilidad en celular/PC */
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    font-weight: 400 !important; /* Grosor Normal (Fino) */
    font-size: 0.95rem; /* Tamaño ligeramente ajustado */
    letter-spacing: 0.01em; /* Aire entre letras */
    margin-bottom: 8px;
}

.recent-full-item ul li strong {
    /* El nombre de la canción en Semi-negrita (600) en vez de Bold (700) para quitar lo "gordo" */
    font-weight: 600 !important; 
}
/* ======================================================= */

.search-result-item { 
    padding: 12px 15px; 
    background: var(--bg-hover); 
    border-radius: var(--radius-sm); 
    margin-bottom: 8px; 
    font-size: 0.9rem; 
    border-left: 3px solid var(--primary); 
    transition: background 0.2s;
}
.search-result-item:hover { background: var(--bg-input); }

.detail-header { 
    background: linear-gradient(to right, var(--bg-hover), var(--bg-card)); 
    padding: 20px; 
    border-radius: var(--radius-md); 
    margin-bottom: 20px; 
    display: flex; justify-content: space-between; align-items: center; 
    border: 1px solid var(--border-light); 
}

/* --- FORMULARIOS --- */
.form-group { margin-bottom: 1.5rem; position: relative; }

label { 
    display: block; font-size: 0.85rem; font-weight: 600; color: var(--text-muted); 
    margin-bottom: 0.5rem; text-transform: uppercase; letter-spacing: 0.05em;
}

input, select, textarea {
    width: 100%; padding: 11px 14px;
    border-radius: var(--radius-sm); border: 1px solid var(--border-light);
    background-color: var(--bg-input); color: var(--text-main);
    font-family: inherit; font-size: 0.95rem; font-weight: 500;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

input:hover, select:hover, textarea:hover { border-color: var(--text-muted); }

input:focus, select:focus, textarea:focus {
    outline: none; background-color: var(--bg-card);
    border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-glow);
}

::placeholder { color: var(--text-muted); opacity: 0.75; }

.song-lyrics { font-family: 'Plus Jakarta Sans', sans-serif; min-height: 200px; line-height: 1.8; }

/* --- BOTONES --- */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 12px 22px; font-weight: 600; font-size: 0.9rem;
    border-radius: var(--radius-sm); border: none; cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease; gap: 8px;
}
.btn:active { transform: scale(0.98); }

.btn-primary { 
    background-color: var(--primary); color: #fff; 
    box-shadow: var(--shadow-sm);
}
.btn-primary:hover { filter: brightness(0.92); }

.btn-secondary { background-color: var(--bg-input); color: var(--text-main); border: 1px solid var(--border-light); font-weight: 600; }
.btn-secondary:hover { background-color: var(--bg-hover); }

.btn-danger { background-color: rgba(239, 68, 68, 0.1); color: var(--danger); }
.btn-danger:hover { background-color: rgba(239, 68, 68, 0.18); }
.btn-print, .btn-pdf { background-color: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-print:hover, .btn-pdf:hover { filter: brightness(0.92); }

.btn-ghost { background: transparent; color: var(--text-muted); padding: 8px; border-radius: var(--radius-sm); }
.btn-ghost:hover { background: var(--bg-hover); color: var(--primary); }

.btn-mini-add {
    width: 48px; height: 48px; border-radius: var(--radius-sm);
    border: 1px dashed var(--border-light); background: transparent;
    color: var(--primary); font-size: 1.4rem; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; cursor: pointer;
}
.btn-mini-add:hover { background: var(--bg-input); border-color: var(--celeste); }

/* --- PESTAÑAS --- */
.tabs {
    display: flex; gap: 4px; margin-bottom: 1.5rem; overflow-x: auto; padding: 4px;
    background: var(--bg-input); border: 1px solid var(--border-light); border-radius: var(--radius-sm);
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
    flex: 1; min-width: max-content; padding: 10px 18px;
    border-radius: var(--radius-sm); background: transparent;
    color: var(--text-muted); font-size: 0.85rem; font-weight: 600;
    border: none; cursor: pointer; transition: all 0.15s ease;
}
.tab-btn:hover { color: var(--primary); background: var(--bg-hover); }
.tab-btn.active {
    background-color: var(--primary); color: #fff;
}

/* --- LISTA DE CANCIONES --- */
.song-card {
    background: var(--bg-card); border-radius: var(--radius-md);
    padding: 1.25rem; margin-bottom: 1rem; border: 1px solid var(--border-light);
    border-left: 5px solid var(--primary);
    position: relative;
}

.song-drag-handle {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px dashed var(--border-light);
}

.song-badge {
    background: var(--bg-input); color: var(--text-main);
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.8rem; font-weight: 800;
}

.repertoire-section-title {
    font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em;
    color: var(--text-muted); margin: 2.5rem 0 1rem; font-weight: 800;
    display: flex; align-items: center; gap: 10px;
}
.repertoire-section-title::after { content: ""; flex: 1; height: 2px; background: var(--accent-gradient); border-radius: 2px; }

/* --- EXTRAS Y DETALLES --- */
.extras-panel {
    background: var(--bg-input); padding: 1.25rem; border-radius: var(--radius-md);
    margin-top: 1rem; animation: fadeIn 0.3s ease;
}

.toggle-btn {
    width: 100%; text-align: center; font-size: 0.85rem; font-weight: 600;
    color: var(--primary); background: none; border: none; padding: 10px; cursor: pointer;
}

.compact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* --- TABLA DE USUARIOS --- */
.users-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.users-table th {
    text-align: left; font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted);
    padding: 15px; border-bottom: 2px solid var(--border-light); font-weight: 700;
}
.users-table td { padding: 15px; border-bottom: 1px solid var(--border-light); }

/* --- UI HELPERS --- */
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.loading-overlay { 
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.9); backdrop-filter: blur(8px);
    display: none; flex-direction: column; justify-content: center; align-items: center; z-index: 9999;
}
.spinner { width: 50px; height: 50px; border: 4px solid rgba(255,255,255,0.1); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s ease infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#messageBox {
    position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
    background: var(--text-main); color: var(--bg-card);
    padding: 14px 28px; border-radius: var(--radius-md); font-weight: 600;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3); z-index: 3000; display: none;
    animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.user-badge {
    font-size: 0.85rem; color: var(--text-main); font-weight: 600;
    background: var(--bg-input); border: 1px solid var(--border-light); padding: 6px 14px; border-radius: var(--radius-sm);
}

/* --- ESTADÍSTICAS DEL ADMIN --- */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 15px; margin-bottom: 25px; }
.stat-card { 
    background: var(--bg-card); 
    padding: 15px; 
    border-radius: var(--radius-md); 
    border: 1px solid var(--border-light); 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    text-align: center;
    border-left: 4px solid var(--primary);
}
.stat-card strong { font-size: 0.85rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 5px; }
.stat-card span { font-size: 1.8rem; font-weight: 800; color: var(--text-main); }
.stat-active { border-left-color: var(--success); }

/* --- MÓVIL --- */
@media (max-width: 600px) {
    .container { padding: 1rem; }
    .compact-grid { grid-template-columns: 1fr; }
    .btn { width: 100%; margin-bottom: 8px; height: 50px; }
    .btn-group-mobile { flex-direction: column; width: 100%; }
    .header { padding: 0.8rem 1rem; }
    
    .users-table th:nth-child(2), .users-table td:nth-child(2),
    .users-table th:nth-child(3), .users-table td:nth-child(3) { display: none; }
}

/* --- COMPATIBILIDAD: variables usadas en JS e index.html --- */
:root {
    --accent-primary: var(--primary);
    --accent-secondary: #2B8CC4;
    --text-secondary: var(--text-muted);
    --text-primary: var(--text-main);
    --border-color: var(--border-light);
    --bg-tertiary: var(--bg-input);
    --print-primary: var(--print);
}
body.dark-mode {
    --accent-secondary: #7cc3ea;
}

/* --- ESTADÍSTICAS DEL DASHBOARD --- */
.stat-list { margin: 0; padding-left: 20px; }
.stat-list li { margin-bottom: 5px; font-size: 0.9rem; }
.stat-count { display: inline-block; background: var(--bg-input); border-radius: 10px; padding: 0 8px; font-size: 0.8rem; font-weight: 700; color: var(--accent-primary); }