/* 
    ESTILOS EXCLUSIVOS PWA (MÓVIL)
    Este archivo contiene el layout y componentes que solo se activan en la App.
*/

/* --- Configuración Global para Sensación de App --- */
html.pwa-mode, body.pwa-mode {
    height: 100%;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; 
    background-color: var(--primary);
}

/* --- Sistema de Mensajes --- */
.mensaje-card {
    animation: slideInUp 0.4s ease-out forwards;
}

.mensaje-card.no-leido {
    background: #f0f9ff !important;
}

@keyframes slideInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Layout PWA Nativa --- */
.app-container {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    height: 100dvh; 
    display: flex;
    flex-direction: column;
    background: var(--light);
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden; 
}

@media (max-width: 500px) {
    .app-container {
        max-width: 100%;
        box-shadow: none;
        border-radius: 0;
    }
}

/* Header Estilo App Real */
.main-header {
    background: var(--gradient-primary);
    color: var(--white);
    padding: calc(env(safe-area-inset-top) + 1.25rem) 1rem 2.5rem;
    border-bottom-left-radius: 24px;
    border-bottom-right-radius: 24px;
    text-align: center;
    box-shadow: var(--shadow-md);
    z-index: 1000;
    flex-shrink: 0;
}

.main-header button:active, .main-header a:active {
    transform: scale(0.92);
    opacity: 0.8;
}

/* Área de Contenido Scrolleable */
main {
    flex-grow: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 1rem;
    padding-bottom: calc(120px + env(safe-area-inset-bottom)); /* Aumentado de 90px */
}

/* Scrollbar invisible para móvil */
main::-webkit-scrollbar {
    width: 0px;
    background: transparent;
}

/* --- Navegación Inferior --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(70px + env(safe-area-inset-bottom));
    background: var(--gradient-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid rgba(0,0,0,0.05);
    z-index: 2000;
}

.nav-item {
    color: #9ca3af;
    text-decoration: none;
    font-size: 0.6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: var(--transition);
    position: relative;
    width: 16%;
    font-weight: 500;
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

/* --- Banner Instalación PWA --- */
.pwa-install-banner {
    position: fixed;
    bottom: calc(85px + env(safe-area-inset-bottom));
    left: 20px;
    right: 20px;
    background: var(--white);
    padding: 16px;
    border-radius: 20px;
    display: none;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--shadow-lg);
    z-index: 3000;
    border: 1px solid rgba(255,255,255,0.05);
    animation: premiumSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* --- Componentes de Detalle (Hospital/Contacto) --- */
.section-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1.5rem 1rem 0.75rem;
    color: var(--primary);
    font-size: 1rem;
}

.section-title h3 {
    font-size: 1.05rem;
    font-weight: 700;
}

.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 1rem;
}

.info-item {
    background: var(--light);
    padding: 12px;
    border-radius: 16px;
    transition: var(--transition);
}

.info-label {
    font-size: 0.65rem;
    color: #888;
    text-transform: uppercase;
    font-weight: 700;
    margin-bottom: 4px;
}

.info-value {
    font-size: 0.9rem;
    color: var(--dark);
    font-weight: 600;
}

.phase-badge {
    display: inline-block;
    padding: 8px 16px;
    border-radius: 12px;
    color: white;
    font-weight: 700;
    font-size: 0.85rem;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--white);
    border-radius: 20px;
    margin: 0 1rem 10px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0,0,0,0.03);
    transition: var(--transition);
}

.contact-card:active {
    transform: scale(0.97);
    background: #fdfdfd;
}

.avatar {
    width: 48px;
    height: 48px;
    background: var(--light);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.main-sheet {
    margin-top: -25px;
    border-top-left-radius: 30px;
    border-top-right-radius: 30px;
    background: var(--white);
    flex-grow: 1;
    padding-bottom: 140px; /* Aumentado de 100px */
    position: relative;
    z-index: 10;
}

