fix(pwa): optimize responsive mobile UI, safe area insets, navigation bar and stable SW v7

This commit is contained in:
unknown
2026-10-04 20:18:06 -06:00
parent cfa8efbc0a
commit e6ea875411
5 changed files with 525 additions and 91 deletions
+321 -18
View File
@@ -3,6 +3,10 @@
========================================================================== */
:root {
--safe-top: env(safe-area-inset-top, 0px);
--safe-bottom: env(safe-area-inset-bottom, 0px);
--safe-left: env(safe-area-inset-left, 0px);
--safe-right: env(safe-area-inset-right, 0px);
--primary: #0284c7;
--primary-hover: #0369a1;
--secondary: #10b981;
@@ -33,7 +37,7 @@ body.dark-mode {
--shadow: 0 10px 20px -3px rgba(0, 0, 0, 0.5);
}
* {
*, *::before, *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
@@ -41,10 +45,23 @@ body.dark-mode {
-webkit-tap-highlight-color: transparent;
}
html {
width: 100%;
max-width: 100vw;
overflow-x: hidden;
position: relative;
-webkit-text-size-adjust: 100%;
}
body {
background-color: var(--bg-main);
color: var(--text-main);
min-height: 100vh;
min-height: -webkit-fill-available;
width: 100%;
max-width: 100vw;
overflow-x: hidden;
position: relative;
display: flex;
flex-direction: column;
transition: background-color 0.3s ease, color 0.3s ease;
@@ -55,13 +72,14 @@ body {
max-width: 480px;
margin: 0 auto;
width: 100%;
padding-bottom: 90px;
padding-bottom: calc(90px + var(--safe-bottom));
box-sizing: border-box;
}
/* Top App Bar */
.top-bar {
background: var(--card-bg);
padding: 14px 18px;
padding: calc(12px + var(--safe-top)) 16px 12px 16px;
display: flex;
justify-content: space-between;
align-items: center;
@@ -70,6 +88,35 @@ body {
top: 0;
z-index: 40;
box-shadow: var(--shadow);
width: 100%;
box-sizing: border-box;
}
@media (max-width: 480px) {
.top-bar {
padding: calc(10px + var(--safe-top)) 12px 10px 12px;
}
.brand-badge {
font-size: 1.05rem;
gap: 6px;
}
.brand-badge .logo-icon {
width: 32px;
height: 32px;
font-size: 1.05rem;
}
.top-actions {
gap: 5px;
}
.theme-toggle-btn {
width: 34px;
height: 34px;
font-size: 1.05rem;
}
.logout-btn {
padding: 6px 10px;
font-size: 0.75rem;
}
}
.brand-badge {
@@ -161,6 +208,13 @@ body.dark-mode .logout-btn {
border: 1px solid rgba(255, 255, 255, 0.2);
}
@media (max-width: 480px) {
.wallet-card {
margin: 12px 10px;
padding: 16px 14px;
}
}
body.dark-mode .wallet-card {
background: linear-gradient(135deg, #1e293b, #0f172a);
border: 1px solid #334155;
@@ -208,10 +262,39 @@ body.dark-mode .wallet-card {
margin-top: 2px;
}
.wallet-logout-pill {
background: rgba(255, 255, 255, 0.2);
border: 1px solid rgba(255, 255, 255, 0.4);
color: #ffffff;
font-size: 0.74rem;
font-weight: 800;
padding: 5px 11px;
border-radius: 9999px;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 4px;
white-space: nowrap;
transition: all 0.15s ease;
backdrop-filter: blur(4px);
-webkit-backdrop-filter: blur(4px);
flex-shrink: 0;
}
.wallet-logout-pill:hover,
.wallet-logout-pill:active {
background: #ef4444;
border-color: #ef4444;
color: #ffffff;
transform: scale(0.96);
}
.balance-row {
display: flex;
justify-content: space-between;
align-items: flex-end;
flex-wrap: wrap;
gap: 10px;
border-top: 1px solid rgba(255, 255, 255, 0.2);
padding-top: 14px;
}
@@ -267,25 +350,39 @@ body.dark-mode .wallet-card {
.modal-qr-backdrop {
position: fixed;
inset: 0;
background: rgba(15, 23, 42, 0.8);
backdrop-filter: blur(6px);
background: rgba(15, 23, 42, 0.82);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
display: flex;
align-items: center;
justify-content: center;
z-index: 100;
padding: 20px;
z-index: 200;
padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom)) 16px;
overflow-y: auto;
box-sizing: border-box;
}
.modal-qr-card {
background: white;
background: var(--card-bg, #ffffff);
color: var(--text-main, #0f172a);
border-radius: 24px;
padding: 26px 20px;
max-width: 340px;
padding: 24px 18px;
max-width: 360px;
width: 100%;
text-align: center;
box-shadow: 0 20px 40px rgba(0,0,0,0.3);
position: relative;
animation: zoomIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
box-sizing: border-box;
max-height: calc(100vh - 36px - var(--safe-top) - var(--safe-bottom));
overflow-y: auto;
}
@media (max-width: 480px) {
.modal-qr-card {
padding: 18px 14px;
border-radius: 20px;
}
}
@keyframes zoomIn {
@@ -480,6 +577,15 @@ body.dark-mode .wallet-card {
cursor: pointer;
}
@media (max-width: 640px) {
.floating-cart-bar {
bottom: calc(72px + var(--safe-bottom));
left: 12px;
right: 12px;
padding: 10px 14px;
}
}
body.dark-mode .floating-cart-bar {
background: #0284c7;
border: 1px solid rgba(255, 255, 255, 0.2);
@@ -1105,8 +1211,11 @@ body.dark-mode .floating-cart-bar {
margin: 0 auto;
min-height: 100vh;
background: var(--bg-main, #f8fafc);
padding: 16px 16px 60px 16px;
padding: calc(16px + var(--safe-top)) 16px calc(60px + var(--safe-bottom)) 16px;
box-sizing: border-box;
width: 100%;
max-width: 100vw;
overflow-x: hidden;
}
.admin-header {
@@ -1119,6 +1228,34 @@ body.dark-mode .floating-cart-bar {
padding: 14px 18px;
margin-bottom: 16px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
flex-wrap: wrap;
gap: 12px;
}
.admin-header-actions {
display: flex;
gap: 8px;
align-items: center;
flex-wrap: wrap;
}
.admin-action-btn-caja {
padding: 7px 12px;
background: #0284c7;
color: #ffffff;
border-radius: 10px;
font-size: 0.78rem;
font-weight: 800;
text-decoration: none;
display: inline-flex;
align-items: center;
gap: 4px;
white-space: nowrap;
transition: background 0.15s ease;
}
.admin-action-btn-caja:hover {
background: #0369a1;
}
.admin-badge {
@@ -1169,6 +1306,11 @@ body.dark-mode .floating-cart-bar {
margin-bottom: 16px;
overflow-x: auto;
padding-bottom: 4px;
scrollbar-width: none;
}
.admin-tabs::-webkit-scrollbar {
display: none;
}
.admin-tab-btn {
@@ -1185,6 +1327,7 @@ body.dark-mode .floating-cart-bar {
gap: 6px;
white-space: nowrap;
transition: all 0.15s;
flex-shrink: 0;
}
.admin-tab-btn.active {
@@ -1203,21 +1346,55 @@ body.dark-mode .floating-cart-bar {
margin-bottom: 16px;
}
/* Tabla / Lista de Inventario Admin */
/* Tabla / Lista de Inventario Admin Responsive */
.inventory-item-row {
display: grid;
grid-template-columns: 44px 1fr auto auto;
align-items: center;
gap: 12px;
display: flex;
flex-direction: column;
gap: 10px;
padding: 12px;
border-bottom: 1px solid var(--border, #f1f5f9);
transition: background 0.15s;
width: 100%;
box-sizing: border-box;
}
@media (min-width: 640px) {
.inventory-item-row {
flex-direction: row;
align-items: center;
justify-content: space-between;
}
}
.inventory-item-row:last-child {
border-bottom: none;
}
.inventory-item-top {
display: flex;
align-items: center;
gap: 12px;
flex: 1;
min-width: 0;
}
.inventory-item-bottom {
display: flex;
align-items: center;
justify-content: space-between;
gap: 8px;
flex-shrink: 0;
width: 100%;
}
@media (min-width: 640px) {
.inventory-item-bottom {
width: auto;
justify-content: flex-end;
gap: 12px;
}
}
.inventory-stock-controls {
display: flex;
align-items: center;
@@ -1225,11 +1402,11 @@ body.dark-mode .floating-cart-bar {
}
.stock-btn-quick {
padding: 5px 9px;
padding: 6px 10px;
background: #f1f5f9;
border: 1px solid #cbd5e1;
border-radius: 8px;
font-size: 0.78rem;
font-size: 0.8rem;
font-weight: 800;
cursor: pointer;
color: #1e293b;
@@ -1239,6 +1416,44 @@ body.dark-mode .floating-cart-bar {
background: #e2e8f0;
}
.admin-student-card {
transition: transform 0.15s ease, box-shadow 0.15s ease;
}
@media (max-width: 600px) {
.admin-container {
padding: calc(12px + var(--safe-top)) 10px calc(80px + var(--safe-bottom)) 10px;
}
.admin-header {
flex-direction: column;
align-items: flex-start;
gap: 10px;
padding: 12px;
}
.admin-header-actions {
width: 100%;
justify-content: space-between;
}
.admin-stats-grid {
grid-template-columns: repeat(2, 1fr);
gap: 8px;
}
.admin-stat-card {
padding: 10px 8px;
}
.admin-stat-card .val {
font-size: 1.25rem;
}
.admin-tab-btn {
padding: 8px 12px;
font-size: 0.8rem;
}
.admin-card {
padding: 14px 12px;
border-radius: 14px;
}
}
/* ==========================================================================
PRODUCTO AGOTADO (GREYED OUT) Y TARJETA BLOQUEADA
========================================================================== */
@@ -1290,3 +1505,91 @@ body.dark-mode .banner-card-blocked {
border-color: #ef4444;
}
/* ==========================================================================
BARRA DE NAVEGACIÓN INFERIOR PWA (MÓVILES)
========================================================================== */
.pwa-bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: calc(62px + var(--safe-bottom));
padding-bottom: var(--safe-bottom);
background: var(--card-bg, #ffffff);
border-top: 1px solid var(--border, #e2e8f0);
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
display: flex;
justify-content: space-around;
align-items: center;
z-index: 100;
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
}
@media (min-width: 641px) {
.pwa-bottom-nav {
display: none !important;
}
}
body.dark-mode .pwa-bottom-nav {
background: rgba(30, 41, 59, 0.95);
border-color: #334155;
box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4);
}
.pwa-nav-item {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: transparent;
border: none;
outline: none;
cursor: pointer;
padding: 6px 0;
color: var(--text-muted, #64748b);
transition: all 0.15s ease;
min-width: 0;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
.pwa-nav-item:active {
transform: scale(0.92);
}
.pwa-nav-icon {
font-size: 1.35rem;
line-height: 1;
display: block;
}
.pwa-nav-label {
font-size: 0.68rem;
font-weight: 700;
margin-top: 3px;
line-height: 1;
display: block;
white-space: nowrap;
}
.pwa-nav-item.active {
color: var(--primary, #0284c7);
}
.pwa-nav-item.active .pwa-nav-icon {
transform: scale(1.1);
transition: transform 0.15s ease;
}
.pwa-nav-logout {
color: #ef4444 !important;
}
.pwa-nav-logout:active {
background: rgba(239, 68, 68, 0.1);
border-radius: 8px;
}