/* =====================================================================
   PLATAFORMA GESTIÓN MUSICAL - ESTILOS VISUALES PROFESIONALES
   Soporte para personalización dinámica mediante variables CSS
   ===================================================================== */

:root {
    --primary-color: #1e3a8a;
    --primary-hover: #1e40af;
    --secondary-color: #d97706;
    --secondary-hover: #b45309;
    --bg-light: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --sidebar-width: 260px;
    --card-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --card-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.07);
}

/* Escala tipográfica adaptativa */
/* PC / Escritorio: Reducción adicional del 10% (escala 70%) */
html {
    font-size: 70%;
}

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-light);
    min-height: 100vh;
    font-size: 0.95rem;
    line-height: 1.45;
    display: flex;
    flex-direction: column;
}

/* Identidad visual dinámica */
.bg-primary-custom {
    background-color: var(--primary-color) !important;
}

.text-primary-custom {
    color: var(--primary-color) !important;
}

.btn-primary-custom {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: #ffffff;
    transition: all 0.2s ease-in-out;
}

.btn-primary-custom:hover,
.btn-primary-custom:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(30, 58, 138, 0.25);
}

.btn-secondary-custom {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: #ffffff;
}

.btn-secondary-custom:hover {
    background-color: var(--secondary-hover);
    border-color: var(--secondary-hover);
    color: #ffffff;
}

/* Barra lateral / Navegación (Usuario siempre visible sin scroll) */
.sidebar {
    width: var(--sidebar-width);
    background: #0f172a;
    color: #f1f5f9;
    height: 100vh;
    max-height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: all 0.3s;
    z-index: 1040;
}

.sidebar .brand-header {
    flex-shrink: 0;
    padding: 1rem 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-nav-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-user-footer {
    flex-shrink: 0;
    margin-top: auto;
    background-color: var(--primary-color);
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sidebar .nav-link {
    color: #94a3b8;
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    border-radius: 0.375rem;
    margin: 0.2rem 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.2s;
}

.sidebar .nav-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.sidebar .nav-link.active {
    color: #ffffff;
    background-color: var(--primary-color);
}

.sidebar .nav-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 1rem 1.25rem 0.25rem;
    font-weight: 700;
}

/* Contenido Principal */
.main-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.top-navbar {
    background-color: #0f172a;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1.5rem;
    color: #ffffff;
}

.content-container {
    padding: 1.75rem;
    flex: 1;
}

/* Tarjetas y Estadísticas */
.card-custom {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    box-shadow: var(--card-shadow);
    background-color: #ffffff;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card-custom:hover {
    box-shadow: var(--card-shadow-hover);
}

.stat-card {
    border-left: 4px solid var(--primary-color);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    background-color: rgba(30, 58, 138, 0.1);
    color: var(--primary-color);
}

/* Carpetas musicales (Tarjetas de agrupaciones) */
.folder-card {
    border-radius: 0.75rem;
    transition: all 0.25s ease;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

.folder-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--primary-color);
}

.folder-header-icon {
    font-size: 2.2rem;
    color: var(--primary-color);
}

/* Visor de Letras de Alabanza */
.lyrics-box {
    background-color: #ffffff;
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    padding: 2rem;
    font-family: inherit;
    font-size: 1.15rem;
    line-height: 1.8;
    white-space: pre-wrap;
    box-shadow: var(--card-shadow);
}

/* Reproductor y Grabador de Audio */
.audio-recorder-panel {
    background: #f8fafc;
    border: 2px dashed #cbd5e1;
    border-radius: 0.75rem;
    padding: 1.75rem;
    text-align: center;
}

.recorder-timer {
    font-size: 2.5rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #0f172a;
    margin: 1rem 0;
}

.recording-pulse {
    animation: pulse-red 1.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Material Items */
.material-item {
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    background: #ffffff;
    transition: background-color 0.15s;
}

.material-item:hover {
    background-color: #f8fafc;
}

.badge-audio { background-color: #3b82f6; color: white; }
.badge-video { background-color: #8b5cf6; color: white; }
.badge-partitura { background-color: #10b981; color: white; }

/* Responsive adjustments */
@media (max-width: 991.98px) {
    html {
        font-size: 78%;
    }
    .top-navbar {
        padding: 0.6rem 0.85rem;
    }
    .sidebar {
        position: fixed;
        left: -100%;
        top: 0;
        bottom: 0;
        height: 100%;
        max-height: 100%;
    }
    .sidebar.show {
        left: 0;
    }
    /* Al abrir el menú lateral en móvil, ocultar el logo de la barra superior para no ser redundante */
    .sidebar.show ~ .main-wrapper #topNavbarMobileLogo {
        display: none !important;
    }
    .content-container {
        padding: 0.85rem;
    }
}

/* Cabecera de alabanza fija / sticky en celular al hacer scroll */
@media (max-width: 767.98px) {
    .praise-header-sticky {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 1020 !important;
        background-color: #ffffff !important;
        margin-left: -0.6rem;
        margin-right: -0.6rem;
        margin-top: -0.6rem;
        border-radius: 0 0 0.75rem 0.75rem !important;
        border-top: none !important;
        padding: 0.75rem 0.9rem !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
    }
    .praise-header-sticky .praise-title-text {
        font-size: calc(1.25rem + 2px) !important;
        line-height: 1.25;
    }
}

@media (max-width: 576px) {
    html {
        font-size: 75%;
    }
    .content-container {
        padding: 0.6rem;
    }
    .card-custom {
        padding: 0.85rem !important;
        border-radius: 0.5rem;
    }
    .lyrics-box {
        padding: 1rem;
        font-size: 0.95rem;
    }
}

/* =====================================================================
   OVERLAY DE BLOQUEO Y CARGA DE SUBIDA (100% RESPONSIVE)
   ===================================================================== */
#uploadLoadingOverlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    background: rgba(15, 23, 42, 0.85) !important;
    backdrop-filter: blur(6px) !important;
    -webkit-backdrop-filter: blur(6px) !important;
    z-index: 100000 !important;
    display: none;
    align-items: center !important;
    justify-content: center !important;
    padding: 1.5rem !important;
    box-sizing: border-box !important;
    margin: 0 !important;
}

#uploadLoadingOverlay.active {
    display: flex !important;
}

.upload-loading-card {
    background: #ffffff !important;
    border-radius: 1.25rem !important;
    box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    text-align: center !important;
    padding: 2rem 1.5rem !important;
    width: 100% !important;
    max-width: 320px !important;
    margin: auto !important;
    box-sizing: border-box !important;
}

.upload-loading-card .spinner-border {
    width: 3.2rem !important;
    height: 3.2rem !important;
    border-width: 0.28em !important;
}

@media (max-width: 576px) {
    #uploadLoadingOverlay {
        padding: 1rem !important;
    }
    .upload-loading-card {
        padding: 1.5rem 1.15rem !important;
        max-width: calc(100% - 2rem) !important;
        width: 100% !important;
        border-radius: 1rem !important;
    }
    .upload-loading-card .spinner-border {
        width: 2.75rem !important;
        height: 2.75rem !important;
    }
    .upload-loading-card h5 {
        font-size: 1.1rem !important;
    }
    .upload-loading-card p {
        font-size: 0.82rem !important;
    }
}
