/* ========================================================
   SISTEMA DE DISEÑO RESPONSIVO (MOBILE-FIRST) & MURO SOCIAL
   Centro Educativo Madre Teresa de Calcuta (CEMTC)
   ======================================================== */

/* 1. CERO DESPLAZAMIENTO HORIZONTAL GLOBAL */
html, body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
    width: 100% !important;
    margin: 0;
    padding: 0;
    -webkit-text-size-adjust: 100%;
}

*, *::before, *::after {
    box-sizing: border-box !important;
}

img, video, iframe {
    max-width: 100% !important;
    height: auto;
}

/* 2. ESTÉTICA Y PROPORCIÓN DE BOTONES (TOUCH-FRIENDLY & NO-WRAP) */
.btn {
    white-space: nowrap !important;
    touch-action: manipulation;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-weight: 600;
    transition: all 0.2s ease-in-out;
}

@media (max-width: 576px) {
    .btn-mobile-full {
        width: 100% !important;
        margin-bottom: 0.5rem;
    }
    .btn-group-mobile {
        display: flex !important;
        flex-direction: column !important;
        width: 100% !important;
        gap: 0.5rem !important;
    }
    .btn-group-mobile .btn {
        width: 100% !important;
        border-radius: 50rem !important;
    }
}

/* 3. ADAPTACIÓN DE TABLAS (TABLE-RESPONSIVE) */
.table-responsive {
    -webkit-overflow-scrolling: touch;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    border-radius: 12px;
}

@media (max-width: 768px) {
    .d-mobile-none {
        display: none !important;
    }
    .table td, .table th {
        padding: 0.5rem 0.4rem !important;
        font-size: 0.85rem !important;
    }
}

/* 4. REORGANIZACIÓN VERTICAL */
@media (max-width: 768px) {
    .row.g-4 > [class*="col-"],
    .row.g-3 > [class*="col-"] {
        margin-bottom: 0.75rem;
    }
    .stat-card {
        margin-bottom: 0.75rem;
    }
}

/* 5. MENÚS TÁCTILES TIPO HAMBURGUESA */
.navbar-toggler {
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0.5rem 0.75rem;
}
.navbar-toggler:focus {
    box-shadow: none !important;
}

/* SISTEMA UNIVERSAL DE MENÚ LATERAL (OFFCANVAS MOBILE) */
.offcanvas-end {
    top: 0 !important;
    bottom: 0 !important;
    height: 100vh !important;
    margin: 0 !important;
    border: none !important;
    width: 320px !important;
    max-width: 85vw !important;
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.25) !important;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1) !important;
    z-index: 1060 !important;
}

.offcanvas .btn-menu-item {
    transition: all 0.18s ease;
    text-decoration: none;
}
.offcanvas .btn-menu-item:hover,
.offcanvas .btn-menu-item:active {
    background-color: #f8fafc !important;
    transform: translateX(3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06) !important;
}

@media (max-width: 991px) {
    .navbar {
        position: relative;
    }
    .navbar-collapse {
        background: #0f172a !important; /* Elegante azul oscuro profesional */
        border: 1px solid rgba(255, 255, 255, 0.15) !important;
        padding: 0.85rem 1rem !important;
        border-radius: 18px !important;
        margin-top: 0.65rem !important;
        box-shadow: 0 12px 35px rgba(0, 0, 0, 0.4) !important;
        max-width: 270px !important; /* Ancho acotado y elegante, no abarca toda la pantalla */
        width: 100% !important;
        margin-left: auto !important; /* Se acopla a la derecha bajo el botón hamburguesa */
    }

    .navbar-collapse .navbar-nav {
        align-items: flex-start !important;
        text-align: left !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        gap: 0.4rem !important;
    }

    .navbar-collapse .nav-item {
        width: 100% !important;
        text-align: left !important;
        display: block !important;
    }

    /* Textos, botones y badges estrictamente alineados a la izquierda */
    .navbar-collapse .nav-link,
    .navbar-collapse .btn,
    .navbar-collapse .badge {
        width: 100% !important;
        text-align: left !important;
        justify-content: flex-start !important;
        padding: 0.65rem 0.95rem !important;
        font-size: 0.88rem !important;
        border-radius: 12px !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.65rem !important;
        margin: 0.15rem 0 !important;
        box-shadow: none !important;
    }

    .navbar-collapse .btn i,
    .navbar-collapse .nav-link i,
    .navbar-collapse .badge i {
        font-size: 1rem !important;
        width: 1.25rem !important;
        text-align: center !important;
        flex-shrink: 0 !important;
    }

    .navbar-collapse .d-flex {
        flex-direction: column !important;
        align-items: stretch !important;
        width: 100% !important;
        gap: 0.4rem !important;
    }
}

/* ========================================================
   TABLA DE ASISTENCIA RESPONSIVA PARA MÓVILES
   ======================================================== */
@media (max-width: 768px) {
    .tabla-asistencia-movil {
        border: none !important;
    }
    .tabla-asistencia-movil thead {
        display: none !important; /* Se oculta el encabezado rígido en teléfonos */
    }
    .tabla-asistencia-movil tbody tr {
        display: block !important;
        background: #ffffff !important;
        border: 1px solid #e2e8f0 !important;
        border-radius: 16px !important;
        padding: 0.85rem 1rem !important;
        margin-bottom: 0.85rem !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
    }
    .tabla-asistencia-movil td {
        display: block !important;
        width: 100% !important;
        padding: 0.25rem 0 !important;
        border: none !important;
        text-align: left !important;
    }
    .tabla-asistencia-movil .asistencia-student-wrap {
        margin-bottom: 0.5rem !important;
    }
    .tabla-asistencia-movil .radio-asistencia {
        display: flex !important;
        width: 100% !important;
        gap: 0.45rem !important;
        margin-top: 0.25rem !important;
    }
    .tabla-asistencia-movil .radio-asistencia label {
        flex: 1 1 0 !important;
        text-align: center !important;
        padding: 9px 4px !important;
        font-size: 0.85rem !important;
        border-radius: 50rem !important;
        white-space: nowrap !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        touch-action: manipulation;
    }
    .tabla-asistencia-movil .asistencia-archivo-box {
        margin-top: 0.5rem !important;
        width: 100% !important;
    }
}

/* ========================================================
   6. FEED SOCIAL ESTILO TIKTOK / INSTAGRAM (MURO DE TALLER)
   ======================================================== */
.feed-social-container {
    max-width: 680px;
    margin: 0 auto;
}

.post-card-social {
    background: #ffffff;
    border-radius: 24px;
    border: 1px solid rgba(0,0,0,0.06);
    box-shadow: 0 10px 30px rgba(0,0,0,0.04);
    margin-bottom: 2rem;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card-social:hover {
    box-shadow: 0 15px 35px rgba(0,0,0,0.08);
}

.post-header-social {
    padding: 1.25rem 1.25rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.post-avatar-wrap {
    position: relative;
    padding: 3px;
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    border-radius: 50%;
    display: inline-block;
}

.post-avatar-img {
    width: 48px;
    height: 48px;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid #ffffff;
    display: block;
}

.post-content-text {
    padding: 0.5rem 1.25rem 0.75rem;
    font-size: 1.05rem;
    line-height: 1.5;
    color: #262626;
    word-break: break-word;
}

.post-media-container {
    position: relative;
    width: 100%;
    background: #000000;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.post-media-img {
    width: 100%;
    max-height: 550px;
    object-fit: contain;
    display: block;
    user-select: none;
    -webkit-user-drag: none;
}

/* Doble Tap Corazón Flotante (Instagram / TikTok) */
.double-tap-heart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    color: #ff2b56;
    font-size: 5rem;
    opacity: 0;
    pointer-events: none;
    z-index: 10;
    filter: drop-shadow(0 4px 15px rgba(0,0,0,0.4));
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease;
}

.double-tap-heart.animate {
    animation: heartBurst 0.8s ease-out forwards;
}

@keyframes heartBurst {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 0; }
    50% { transform: translate(-50%, -50%) scale(1.3); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(1) translateY(-20px); opacity: 0; }
}

/* BARRA DE ACCIONES TIKTOK / INSTAGRAM */
.post-actions-bar {
    padding: 0.75rem 1.25rem 0.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn-social-action {
    background: transparent;
    border: none;
    padding: 0.4rem 0.6rem;
    border-radius: 50rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 1.15rem;
    color: #4b5563;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.btn-social-action:hover {
    background: rgba(0,0,0,0.05);
    color: #111827;
}

.btn-social-action.liked {
    color: #e11d48 !important;
}

.btn-social-action.liked i {
    animation: likeBounce 0.4s ease;
}

@keyframes likeBounce {
    0% { transform: scale(1); }
    50% { transform: scale(1.4); }
    100% { transform: scale(1); }
}

/* BARRA DE REACCIONES DE EMOTICONES RÁPIDOS */
.reactions-pill-bar {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    padding: 0.25rem 0;
    scrollbar-width: none;
}
.reactions-pill-bar::-webkit-scrollbar {
    display: none;
}

.reaction-pill-btn {
    border: 1px solid rgba(0,0,0,0.08);
    background: #f8fafc;
    border-radius: 50rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
}

.reaction-pill-btn:hover {
    background: #f1f5f9;
    transform: translateY(-1px);
}

.reaction-pill-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
    font-weight: 700;
}

/* CAJA DE COMENTARIOS MODERNA */
.comments-section-social {
    padding: 0.75rem 1.25rem 1.25rem;
    border-top: 1px solid rgba(0,0,0,0.05);
    background: #fafafa;
}

.comment-bubble {
    background: #ffffff;
    border-radius: 18px;
    padding: 0.6rem 0.9rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.03);
    margin-bottom: 0.5rem;
    border: 1px solid rgba(0,0,0,0.04);
}

.comment-bubble.is-mine {
    background: #f0f7ff;
    border-color: #bfdbfe;
}

.comment-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    background: #ffffff;
    border-radius: 50rem;
    padding: 0.25rem 0.5rem 0.25rem 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.comment-input-field {
    border: none;
    outline: none;
    background: transparent;
    flex-grow: 1;
    font-size: 0.95rem;
}
.comment-input-field:focus {
    outline: none;
}

/* ========================================================
   7. BOTÓN DESCARGAR APP PWA (EXCLUSIVO MÓVILES)
   ======================================================== */
.btn-descargar-app {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%) !important;
    color: #ffffff !important;
    font-weight: 700 !important;
    font-size: 0.82rem !important;
    letter-spacing: 0.2px;
    border: none !important;
    border-radius: 50rem !important;
    padding: 0.45rem 1rem !important;
    box-shadow: 0 4px 14px rgba(217, 119, 6, 0.35) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
    text-decoration: none !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease !important;
    white-space: nowrap !important;
}

.btn-descargar-app:active {
    transform: scale(0.96) !important;
}

.btn-descargar-app i {
    font-size: 0.95rem;
    animation: bounceIcon 2.2s infinite ease-in-out;
}

@keyframes bounceIcon {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

@media (min-width: 992px) {
    .btn-descargar-app,
    .btn-descargar-app-mobile-only,
    .pwa-floating-install-pill,
    #btnDescargarAppUniversalBarra {
        display: none !important;
    }
}

/* Píldora Flotante Móvil de Instalación */
.pwa-floating-install-pill {
    position: fixed;
    bottom: 22px;
    right: 20px;
    z-index: 10400;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-floating-install-pill button {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.28) !important;
}

.pwa-floating-install-pill:active {
    transform: scale(0.94);
}

/* ========================================================
   6. PANTALLA DE CARGA (SPLASH SCREEN) - REGLA ESTRICTA DE DISEÑO
   ======================================================== */
.pwa-splash-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background-color: #0b2c5e !important;
    z-index: 9999999 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out !important;
    pointer-events: all;
}

.pwa-splash-overlay.pwa-splash-hidden {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

.pwa-splash-container {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 20px !important;
    width: 100% !important;
    max-width: 420px !important;
}

/* Regla estricta: No ocupar 100% de pantalla, centrado vertical y horizontal,
   object-fit: contain, proporciones originales, tamaño máximo 250px-300px, círculo perfecto */
.pwa-splash-logo {
    width: 260px !important;
    height: 260px !important;
    max-width: 72vw !important;
    max-height: 72vw !important;
    aspect-ratio: 1 / 1 !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 50% !important;
    background-color: #ffffff !important;
    padding: 6px !important;
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.42) !important;
    animation: pwaSplashPulse 2.4s ease-in-out infinite !important;
}

@keyframes pwaSplashPulse {
    0%, 100% {
        transform: scale(0.98);
        box-shadow: 0 12px 28px rgba(0, 0, 0, 0.38);
    }
    50% {
        transform: scale(1.02);
        box-shadow: 0 16px 38px rgba(0, 0, 0, 0.48), 0 0 25px rgba(255, 255, 255, 0.18);
    }
}

.pwa-splash-spinner {
    margin-top: 22px !important;
    width: 36px !important;
    height: 36px !important;
    border: 3.5px solid rgba(255, 255, 255, 0.22) !important;
    border-top-color: #ffffff !important;
    border-radius: 50% !important;
    animation: pwaSpin 0.85s linear infinite !important;
}

@keyframes pwaSpin {
    to { transform: rotate(360deg); }
}

.pwa-splash-text {
    color: #ffffff !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
    margin-top: 14px !important;
    letter-spacing: 0.5px !important;
    opacity: 0.92 !important;
}

