/* =============================================
   DASHBOARD — Layout base
============================================= */
.dash-body {
    background: #f0f2f5;
}

.dash-layout {
    display: flex;
    padding-top: 70px;
    min-height: 100vh;
}

/* =============================================
   SIDEBAR
============================================= */
.dash-sidebar {
    width: 280px;
    min-width: 280px;
    background: white;
    border-right: 1px solid #e8eaed;
    position: sticky;
    top: 70px;
    height: calc(100vh - 70px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.dash-sidebar-profile {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1.2rem 1.2rem 1rem;
    border-bottom: 1px solid #f0f0f0;
}

.sidebar-avatar {
    font-size: 2.2rem;
    color: var(--primary-color);
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-profile-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-profile-name {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-profile-sub {
    font-size: 0.76rem;
    color: #aaa;
}

.sidebar-stats {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.2rem;
    gap: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.sidebar-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.1rem;
    flex: 1;
}

.sidebar-stat-val {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
}

.sidebar-stat-lbl {
    font-size: 0.67rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #aaa;
}

.sidebar-stat-divider {
    width: 1px;
    height: 28px;
    background: #eee;
    flex-shrink: 0;
}


.sidebar-section {
    border-bottom: 1px solid #f2f2f2;
}

.sidebar-section-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 1.2rem;
    cursor: pointer;
    user-select: none;
    transition: background 0.15s;
    font-size: 0.82rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #999;
}

.sidebar-section-header:hover { background: #fafafa; }

.sidebar-section-header.active {
    background: rgba(44,62,80,0.06);
    color: var(--primary-color);
    border-left: 3px solid var(--accent-color);
}
.sidebar-section-header.active .sidebar-section-icon {
    color: var(--accent-color);
}

/* Paneles del dashboard — se muestran/ocultan con JS */
.dash-panel-hidden { display: none !important; }

.sidebar-section-icon {
    font-size: 0.8rem;
    color: var(--secondary-color);
}

.sidebar-section-body { display: none; }
.sidebar-section.open .sidebar-section-body { display: block; }

.sidebar-item {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    color: #555;
    transition: background 0.15s;
    border-left: 3px solid transparent;
}

.sidebar-item:hover { background: #f7f8fa; color: var(--primary-color); }

.sidebar-item.active {
    background: rgba(44,62,80,0.05);
    border-left-color: var(--accent-color);
    color: var(--primary-color);
}

.sidebar-item-icon {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.75rem;
    flex-shrink: 0;
}

.sidebar-item-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    overflow: hidden;
    flex: 1;
}

.sidebar-item-title {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.83rem;
    font-weight: 500;
    color: var(--primary-color);
}

.sidebar-item-progress {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.sipb-track {
    flex: 1;
    height: 4px;
    background: #eee;
    border-radius: 50px;
    overflow: hidden;
}

.sipb-fill {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 50px;
}

.sipb-pct {
    font-size: 0.7rem;
    color: #27ae60;
    font-weight: 700;
    flex-shrink: 0;
}

.sidebar-item-badge {
    font-size: 0.68rem;
    padding: 0.1rem 0.5rem;
    border-radius: 50px;
    font-weight: 600;
}

.badge-pending {
    background: rgba(243,156,18,0.12);
    color: #e67e22;
}

.badge-count {
    background: rgba(142,68,173,0.1);
    color: var(--secondary-color);
}

/* =============================================
   CONTENIDO PRINCIPAL
============================================= */
.dash-main {
    flex: 1;
    padding: 2rem 2.5rem;
    overflow-y: auto;
    min-width: 0;
}

.dash-alerts { margin-bottom: 1.5rem; }

/* Banner */
.dash-banner {
    background: linear-gradient(135deg, var(--primary-color), #4a6491);
    color: white;
    padding: 2rem 2.5rem;
    border-radius: 16px;
    margin-bottom: 2.5rem;
    position: relative;
    overflow: hidden;
}

.dash-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 20% 30%, rgba(52,152,219,0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(231,76,60,0.1) 0%, transparent 50%);
}

.dash-banner-text { position: relative; z-index: 1; }

.dash-banner-text h1 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
}

.dash-banner-text p { font-size: 1rem; opacity: 0.85; }


/* Secciones */
.dash-content-section { margin-bottom: 3rem; }

.dash-section-header {
    margin-bottom: 1.2rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #eee;
}

.dash-section-header h2 {
    font-size: 1.3rem;
    color: var(--primary-color);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dash-section-header h2 i {
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.dash-subsection-title {
    color: #999;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    margin: 1.2rem 0 0.6rem;
}

.dash-catalogo {
    padding-top: 1rem;
    border-top: 1px solid #e8eaed;
}

/* Estado vacío */
.dash-empty {
    text-align: center;
    padding: 4rem 2rem;
    max-width: 480px;
    margin: 0 auto;
}

.dash-empty-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(142,68,173,0.1), rgba(231,76,60,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
}

.dash-empty-icon i {
    font-size: 2.2rem;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dash-empty h3 { color: var(--primary-color); font-size: 1.3rem; margin-bottom: 0.7rem; }
.dash-empty p  { color: #777; font-size: 0.95rem; line-height: 1.6; margin-bottom: 2rem; }

/* =============================================
   LISTA DE PROGRAMAS (pi = program item)
============================================= */
.programs-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.pi {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1.2rem;
    background: white;
    border-radius: 12px;
    border: 1px solid #eaecef;
    transition: box-shadow 0.2s, border-color 0.2s;
}

.pi:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.07);
    border-color: #d5d8dc;
}

.pi-confirmado {
    border-left: 3px solid #2ecc71;
}

.pi-pendiente {
    border-left: 3px solid #f39c12;
}

/* Ícono cuadrado del programa */
.pi-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.1rem;
    flex-shrink: 0;
}

/* Cuerpo central */
.pi-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.pi-title {
    font-weight: 600;
    font-size: 0.93rem;
    color: var(--primary-color);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pi-meta {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.pi-meta span {
    font-size: 0.76rem;
    color: #999;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.pi-meta span i { font-size: 0.7rem; }

.pi-price {
    font-weight: 700;
    color: var(--accent-color) !important;
    font-size: 0.82rem !important;
}

/* Barra de progreso inline */
.pi-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 220px;
}

.pi-progress-track {
    flex: 1;
    height: 5px;
    background: #eee;
    border-radius: 50px;
    overflow: hidden;
}

.pi-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #27ae60);
    border-radius: 50px;
    transition: width 0.4s ease;
}

.pi-progress-pct {
    font-size: 0.72rem;
    font-weight: 700;
    color: #27ae60;
    flex-shrink: 0;
    min-width: 2rem;
    text-align: right;
}

/* Acción (derecha) */
.pi-action {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    min-width: 220px;
    justify-content: flex-end;
}

/* Botones de acción */
.pi-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.1rem;
    border-radius: 50px;
    font-size: 0.83rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
}

.pi-btn-continuar {
    background: var(--accent-color);
    color: white;
    box-shadow: 0 3px 10px rgba(231,76,60,0.25);
}

.pi-btn-continuar:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(231,76,60,0.35);
}

.pi-btn-done {
    background: #f1c40f;
    color: #7d6608;
    box-shadow: 0 3px 10px rgba(241,196,15,0.25);
}

.pi-btn-done:hover {
    background: #d4ac0d;
    transform: translateY(-1px);
}

.pi-btn-inscribir {
    background: transparent;
    color: var(--accent-color);
    border: 1.5px solid var(--accent-color);
    box-shadow: none;
    min-width: 120px;
    justify-content: center;
}

.pi-btn-inscribir:hover {
    background: var(--accent-color);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231,76,60,0.25);
}

/* Badges de estado */
.pi-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.38rem 0.9rem;
    border-radius: 50px;
    font-size: 0.78rem;
    font-weight: 600;
}

.pi-badge-pending {
    background: rgba(243,156,18,0.1);
    color: #e67e22;
}

.pi-badge-closed {
    background: rgba(189,195,199,0.2);
    color: #95a5a6;
    min-width: 120px;
    justify-content: center;
}

/* =============================================
   MIS DIPLOMAS
============================================= */
.pi-diploma {
    border-left: 3px solid #d4ac0d;
    background: linear-gradient(to right, rgba(212,175,55,0.04), white 120px);
}

.pi-meta-done {
    color: #27ae60 !important;
    font-weight: 600;
}

.pi-btn-diploma {
    background: linear-gradient(135deg, #c9a700, #e8c520);
    color: #4a3800;
    box-shadow: 0 3px 10px rgba(212,175,55,0.3);
    text-decoration: none;
}

.pi-btn-diploma:hover {
    background: linear-gradient(135deg, #b89600, #d4b01e);
    transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(212,175,55,0.4);
    color: #3a2c00;
}

.badge-diploma {
    background: rgba(212,175,55,0.15);
    color: #8a6d00;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
}

.badge-diploma i {
    font-size: 0.6rem;
}

/* =============================================
   CATÁLOGO — tarjeta expandible
============================================= */

/* .pi-cat convierte la tarjeta en columna */
.pi-cat {
    flex-direction: column;
    align-items: stretch;
}

/* La fila superior (ícono + cuerpo + acción) se comporta como el .pi original */
.pi-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    width: 100%;
}

/* Grupo de botones: Detalles + Inscribirme */
.pi-action-group {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Botón Detalles */
.pi-btn-detalles {
    background: #f0f2f5;
    color: #555;
    border: 1.5px solid #dde0e4;
}

.pi-btn-detalles:hover,
.pi-btn-detalles.active {
    background: #2c3e50;
    color: white;
    border-color: #2c3e50;
    transform: translateY(-1px);
}

/* Panel expandible — oculto por defecto */
.pi-expand {
    display: none;
    border-top: 1px solid #eaecef;
    margin-top: 0.75rem;
}

.pi-expand-open {
    display: block;
    animation: expandDown 0.25s ease;
}

@keyframes expandDown {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Borde izquierdo azul oscuro cuando está expandido */
.pi-cat.pi-expand-active {
    border-color: #2c3e50;
    border-left: 3px solid #2c3e50;
}

/* Contenido del panel */
.pi-expand-body {
    padding: 1rem 0 0.4rem 0;
}

.pi-expand-body p {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.7;
    margin-bottom: 1rem;
}

/* Chips de meta-info en el panel */
.pi-expand-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.pi-expand-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #f5f7fa;
    border: 1px solid #e8eaed;
    border-radius: 50px;
    padding: 0.3rem 0.85rem;
    font-size: 0.8rem;
    color: #555;
}

.pi-expand-meta-item i {
    font-size: 0.75rem;
    color: var(--secondary-color);
}

/* Descripción larga */
.pi-expand-desc {
    font-size: 0.88rem;
    color: #555;
    line-height: 1.75;
    margin-bottom: 1.2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid #f0f0f0;
}

/* Sección de módulos */
.pi-expand-modulos {
    margin-top: 1.4rem;
}

.pi-expand-modulos h4 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pi-expand-modulos h4 i {
    color: var(--secondary-color);
    font-size: 0.85rem;
}

/* Grid de módulos: 2 columnas en pantallas anchas */
.pi-modulos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
}

/* Módulo individual */
.pi-modulo {
    background: #f7f8fc;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    overflow: hidden;
}

.pi-modulo-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    background: #eef0f5;
    border-bottom: 1px solid #e0e3ea;
}

.pi-modulo-num {
    background: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.pi-modulo-titulo {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary-color);
    flex: 1;
    line-height: 1.3;
}

.pi-modulo-count {
    font-size: 0.7rem;
    color: #999;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Lecciones */
.pi-lecciones {
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
}

.pi-lecciones li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    color: #666;
    border-bottom: 1px solid #eee;
    line-height: 1.4;
}

.pi-lecciones li:last-child { border-bottom: none; }

.pi-lecciones li i {
    font-size: 0.7rem;
    margin-top: 2px;
    flex-shrink: 0;
}

.pi-lecciones .fa-play-circle  { color: #e74c3c; }
.pi-lecciones .fa-file-pdf     { color: #c0392b; }
.pi-lecciones .fa-file-alt     { color: #8e44ad; }

/* =============================================
   Responsive
============================================= */
@media (max-width: 1024px) {
    .dash-main { padding: 1.5rem; }
}

/* Banner móvil: oculto por defecto */
.dash-banner-mobile {
    display: none;
}

@media (max-width: 768px) {
    .dash-layout {
        flex-direction: column;
        padding-top: 140px; /* más espacio para header apilado en móvil */
    }

    .dash-sidebar {
        width: 100%;
        min-width: unset;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid #e8eaed;
    }

    .dash-main { padding: 1.2rem; }

    /* Ocultar banner del main en móvil (se muestra en sidebar) */
    .dash-main > .dash-banner {
        display: none;
    }

    /* Mostrar banner dentro del sidebar en móvil */
    .dash-banner-mobile {
        display: block;
        border-radius: 12px;
        margin: 0.8rem;
        padding: 1.2rem 1rem;
        text-align: center;
    }

    .dash-banner-mobile .dash-banner-text h1 { font-size: 1.3rem; }
    .dash-banner-mobile .dash-banner-text p { font-size: 0.88rem; }

    /* Ocultar títulos de sección en el contenido (ya están en el menú lateral) */
    .dash-section-header {
        display: none;
    }

    .pi { flex-wrap: wrap; }

    .pi-row { flex-wrap: wrap; }

    .pi-body { min-width: 0; width: 100%; }

    .pi-action { width: 100%; justify-content: center; min-width: 0; }

    .pi-progress { max-width: 100%; }

    .pi-action-group { flex-wrap: wrap; justify-content: center; width: 100%; }
}
