Files
terra-view/app/ui/static/mobile.css

613 lines
11 KiB
CSS

/* Mobile-specific styles for Seismo Fleet Manager */
/* Touch-optimized, portrait-first design */
/* ===== MOBILE TOUCH TARGETS ===== */
@media (max-width: 767px) {
/* Buttons - 44x44px minimum (iOS standard) */
.btn, button:not(.tab-button), .button, a.button {
min-width: 44px;
min-height: 44px;
padding: 12px 16px;
}
/* Icon-only buttons */
.icon-button, .btn-icon {
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
padding: 0;
}
/* Form inputs - 48px height, 16px font prevents iOS zoom */
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
min-height: 48px;
font-size: 16px !important;
padding: 12px 16px;
}
/* Checkboxes and radio buttons - larger touch targets */
input[type="checkbox"],
input[type="radio"] {
width: 24px;
height: 24px;
min-height: 24px;
}
/* Bottom nav buttons - 56px industry standard */
.bottom-nav button {
min-height: 56px;
padding: 8px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
}
/* Increase spacing between clickable elements */
.btn + .btn,
button + button {
margin-left: 8px;
}
}
/* ===== HAMBURGER MENU ===== */
.hamburger-btn {
position: fixed;
top: 1rem;
left: 1rem;
z-index: 50;
width: 44px;
height: 44px;
display: flex;
align-items: center;
justify-content: center;
background-color: white;
border: 1px solid #e5e7eb;
border-radius: 0.5rem;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
transition: all 0.2s;
}
.hamburger-btn:active {
transform: scale(0.95);
}
.dark .hamburger-btn {
background-color: #1e293b;
border-color: #374151;
}
/* Hamburger icon */
.hamburger-icon {
width: 24px;
height: 24px;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.hamburger-line {
width: 100%;
height: 2px;
background-color: #374151;
transition: all 0.3s;
}
.dark .hamburger-line {
background-color: #e5e7eb;
}
/* Hamburger animation when menu open */
.menu-open .hamburger-line:nth-child(1) {
transform: translateY(8px) rotate(45deg);
}
.menu-open .hamburger-line:nth-child(2) {
opacity: 0;
}
.menu-open .hamburger-line:nth-child(3) {
transform: translateY(-8px) rotate(-45deg);
}
/* ===== SIDEBAR (RESPONSIVE) ===== */
.sidebar {
position: fixed;
left: 0;
top: 0;
width: 16rem; /* 256px */
height: 100vh;
z-index: 40;
transition: transform 0.3s ease-in-out;
}
@media (max-width: 767px) {
.sidebar {
transform: translateX(-100%);
}
.sidebar.open {
transform: translateX(0);
}
}
@media (min-width: 768px) {
.sidebar {
transform: translateX(0) !important;
}
}
/* ===== BACKDROP ===== */
.backdrop {
position: fixed;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
z-index: 30;
opacity: 0;
transition: opacity 0.3s ease-in-out;
pointer-events: none;
}
.backdrop.show {
opacity: 1;
pointer-events: auto;
}
@media (min-width: 768px) {
.backdrop {
display: none;
}
}
/* ===== BOTTOM NAVIGATION ===== */
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 4rem;
background-color: white;
border-top: 1px solid #e5e7eb;
z-index: 20;
box-shadow: 0 -1px 3px 0 rgb(0 0 0 / 0.1);
}
.dark .bottom-nav {
background-color: #1e293b;
border-top-color: #374151;
}
.bottom-nav-btn {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 4px;
color: #6b7280;
transition: all 0.2s;
border: none;
background: none;
cursor: pointer;
width: 100%;
height: 100%;
}
.bottom-nav-btn:active {
transform: scale(0.95);
background-color: #f3f4f6;
}
.dark .bottom-nav-btn:active {
background-color: #374151;
}
.bottom-nav-btn.active {
color: #f48b1c; /* seismo-orange */
}
.bottom-nav-btn svg {
width: 24px;
height: 24px;
}
.bottom-nav-btn span {
font-size: 11px;
font-weight: 500;
}
@media (min-width: 768px) {
.bottom-nav {
display: none;
}
}
/* ===== MAIN CONTENT ADJUSTMENTS ===== */
.main-content {
margin-left: 0;
padding-bottom: 5rem; /* 80px for bottom nav */
min-height: 100vh;
}
@media (min-width: 768px) {
.main-content {
margin-left: 16rem; /* 256px sidebar width */
padding-bottom: 0;
}
}
/* ===== MOBILE ROSTER CARDS ===== */
.unit-card {
background-color: white;
border-radius: 0.5rem;
box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1);
padding: 1rem;
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
-webkit-tap-highlight-color: transparent;
}
.unit-card:active {
transform: scale(0.98);
}
.dark .unit-card {
background-color: #1e293b;
}
.unit-card:hover {
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}
/* ===== UNIT DETAIL MODAL (BOTTOM SHEET) ===== */
.unit-modal {
position: fixed;
inset: 0;
z-index: 50;
display: flex;
align-items: flex-end;
justify-content: center;
pointer-events: none;
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
.unit-modal.show {
pointer-events: auto;
opacity: 1;
}
.unit-modal-backdrop {
position: absolute;
inset: 0;
background-color: rgba(0, 0, 0, 0.5);
}
.unit-modal-content {
position: relative;
width: 100%;
max-height: 85vh;
background-color: white;
border-top-left-radius: 1rem;
border-top-right-radius: 1rem;
box-shadow: 0 -4px 6px -1px rgb(0 0 0 / 0.1);
overflow-y: auto;
transform: translateY(100%);
transition: transform 0.3s ease-out;
}
.unit-modal.show .unit-modal-content {
transform: translateY(0);
}
.dark .unit-modal-content {
background-color: #1e293b;
}
@media (min-width: 768px) {
.unit-modal {
align-items: center;
}
.unit-modal-content {
max-width: 42rem; /* 672px */
border-radius: 0.75rem;
transform: translateY(20px);
opacity: 0;
}
.unit-modal.show .unit-modal-content {
transform: translateY(0);
opacity: 1;
}
}
/* Modal handle bar (mobile only) */
.modal-handle {
height: 4px;
width: 3rem;
background-color: #d1d5db;
border-radius: 9999px;
margin: 0.75rem auto 1rem;
}
@media (min-width: 768px) {
.modal-handle {
display: none;
}
}
/* ===== OFFLINE INDICATOR ===== */
.offline-indicator {
position: fixed;
top: 0;
left: 0;
right: 0;
background-color: #eab308; /* yellow-500 */
color: white;
text-align: center;
padding: 0.5rem;
font-size: 0.875rem;
font-weight: 500;
z-index: 50;
transform: translateY(-100%);
transition: transform 0.3s ease-in-out;
}
.offline-indicator.show {
transform: translateY(0);
}
/* ===== SYNC TOAST ===== */
.sync-toast {
position: fixed;
bottom: 6rem; /* Above bottom nav */
left: 1rem;
right: 1rem;
background-color: #22c55e; /* green-500 */
color: white;
padding: 0.75rem 1rem;
border-radius: 0.5rem;
box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
z-index: 50;
opacity: 0;
transform: translateY(20px);
transition: opacity 0.3s, transform 0.3s;
pointer-events: none;
}
.sync-toast.show {
opacity: 1;
transform: translateY(0);
pointer-events: auto;
}
@media (min-width: 768px) {
.sync-toast {
bottom: 1rem;
left: auto;
right: 1rem;
max-width: 20rem;
}
}
/* ===== MOBILE SEARCH BAR (STICKY) ===== */
@media (max-width: 767px) {
.mobile-search-sticky {
position: sticky;
top: 0;
z-index: 10;
background-color: #f3f4f6;
margin: -1rem -1rem 1rem -1rem;
padding: 0.5rem 1rem;
}
.dark .mobile-search-sticky {
background-color: #111827;
}
}
@media (min-width: 768px) {
.mobile-search-sticky {
position: static;
background-color: transparent;
margin: 0;
padding: 0;
}
}
/* ===== STATUS BADGES ===== */
.status-dot {
width: 1rem;
height: 1rem;
border-radius: 9999px;
flex-shrink: 0;
}
.status-badge {
padding: 0.25rem 0.75rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
/* ===== DEVICE TYPE BADGES ===== */
.device-badge {
padding: 0.25rem 0.5rem;
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
display: inline-block;
}
/* ===== MOBILE MAP HEIGHT ===== */
@media (max-width: 767px) {
#fleet-map {
height: 16rem !important; /* 256px on mobile */
}
#unit-map {
height: 16rem !important; /* 256px on mobile */
}
}
/* ===== MAP OVERLAP FIX ===== */
/* Prevent map and controls from overlapping UI elements on mobile */
@media (max-width: 767px) {
/* Constrain leaflet container to prevent overflow */
.leaflet-container {
max-width: 100%;
overflow: hidden;
}
/* Override Leaflet's default high z-index values */
/* Bottom nav is z-20, sidebar is z-40, so map must be below */
.leaflet-pane,
.leaflet-tile-pane,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
.leaflet-marker-pane,
.leaflet-tooltip-pane,
.leaflet-popup-pane {
z-index: 1 !important;
}
/* Map controls should also be below navigation elements */
.leaflet-control-container,
.leaflet-top,
.leaflet-bottom,
.leaflet-left,
.leaflet-right {
z-index: 1 !important;
}
.leaflet-control {
z-index: 1 !important;
}
/* When sidebar is open, hide all Leaflet controls (zoom, attribution, etc) */
body.menu-open .leaflet-control-container {
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease-in-out;
}
/* Ensure map tiles are non-interactive when sidebar is open */
body.menu-open #fleet-map,
body.menu-open #unit-map {
pointer-events: none;
}
}
/* ===== PENDING SYNC BADGE ===== */
.pending-sync-badge {
display: inline-flex;
align-items: center;
gap: 0.25rem;
padding: 0.125rem 0.5rem;
background-color: #fef3c7; /* amber-100 */
color: #92400e; /* amber-800 */
border-radius: 9999px;
font-size: 0.75rem;
font-weight: 500;
}
.dark .pending-sync-badge {
background-color: #78350f;
color: #fef3c7;
}
.pending-sync-badge::before {
content: "⏳";
font-size: 0.875rem;
}
/* ===== MOBILE-SPECIFIC UTILITY CLASSES ===== */
@media (max-width: 767px) {
.mobile-text-lg {
font-size: 1.125rem;
line-height: 1.75rem;
}
.mobile-text-xl {
font-size: 1.25rem;
line-height: 1.75rem;
}
.mobile-p-4 {
padding: 1rem;
}
.mobile-mb-4 {
margin-bottom: 1rem;
}
}
/* ===== ACCESSIBILITY ===== */
/* Improve focus visibility on mobile */
@media (max-width: 767px) {
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
outline: 2px solid #f48b1c;
outline-offset: 2px;
}
}
/* Prevent text selection on buttons (better mobile UX) */
button,
.btn,
.button {
-webkit-user-select: none;
user-select: none;
-webkit-tap-highlight-color: transparent;
}
/* ===== SMOOTH SCROLLING ===== */
html {
scroll-behavior: smooth;
}
/* Prevent overscroll bounce on iOS */
body {
overscroll-behavior-y: none;
}
/* ===== LOADING STATES ===== */
.loading-pulse {
animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}
@keyframes pulse {
0%, 100% {
opacity: 1;
}
50% {
opacity: 0.5;
}
}
/* ===== SAFE AREA SUPPORT (iOS notch) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
.bottom-nav {
padding-bottom: env(safe-area-inset-bottom);
height: calc(4rem + env(safe-area-inset-bottom));
}
.main-content {
padding-bottom: calc(5rem + env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
.main-content {
padding-bottom: 0;
}
}
}