/* ==========================================================================
   Dex Health Hub: Patient Companion Mobile App Stylesheet
   ========================================================================== */

:root {
    --bg-mobile-root: #090d16;
    --bg-mobile-card: #151c2e;
    --bg-mobile-card-hover: #1e263d;
    --border-mobile: rgba(255, 255, 255, 0.06);
    
    --primary: #10b981;           /* Patient Emerald Green */
    --primary-hover: #059669;
    --primary-light: rgba(16, 185, 129, 0.1);
    
    --warning: #f59e0b;
    --danger: #ef4444;
    --success: #10b981;
    
    --text-main: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --font-family: 'Inter', -apple-system, sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: radial-gradient(circle at top, #1e293b 0%, #0f172a 100%);
    color: #f8fafc;
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 40px 20px;
}

/* ==========================================================================
   Smartphone Device Frame Mockup
   ========================================================================== */
.phone-frame {
    width: 375px;
    height: 812px;
    background: #000000;
    border: 12px solid #1e293b;
    border-radius: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 
                0 0 0 4px rgba(255, 255, 255, 0.03),
                inset 0 0 2px 2px rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* iPhone Notch / Dynamic Island */
.phone-notch {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 30px;
    background: #000000;
    border-bottom-left-radius: 18px;
    border-bottom-right-radius: 18px;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.phone-camera {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #0f172a;
    position: absolute;
    right: 24px;
    top: 11px;
}

.phone-speaker {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: #334155;
    position: absolute;
    top: 4px;
    left: 50%;
    transform: translateX(-50%);
}

/* iPhone Home Indicator */
.phone-home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    z-index: 1000;
}

/* Screen Wrapper */
.phone-screen {
    flex-grow: 1;
    background: var(--bg-mobile-root);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    padding-top: 36px; /* Space for Notch & Status Bar */
}

/* Status Bar */
.phone-status-bar {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 36px;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    z-index: 999;
}

.status-icons {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* ==========================================================================
   Mobile Core Layout & Panels
   ========================================================================== */
.app-header {
    padding: 16px 20px 8px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-mobile);
}

.app-title-wrap h1 {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
}

.app-title-wrap p {
    font-size: 11px;
    color: var(--text-secondary);
}

.screen-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px 16px 80px 16px; /* extra bottom padding for bottom nav */
}

/* Hide scrollbar for mobile screens */
.screen-content::-webkit-scrollbar {
    display: none;
}

/* Bottom Navigation Bar */
.bottom-nav {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 68px;
    background: rgba(15, 23, 42, 0.95);
    border-top: 1px solid var(--border-mobile);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    z-index: 900;
    padding-bottom: 10px; /* Space above home indicator */
}

.nav-tab-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition-fast);
    gap: 4px;
}

.nav-tab-btn i {
    font-size: 18px;
}

.nav-tab-btn span {
    font-size: 10px;
    font-weight: 600;
}

.nav-tab-btn.active {
    color: var(--primary);
}

/* Cards */
.mobile-card {
    background: var(--bg-mobile-card);
    border: 1px solid var(--border-mobile);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    transition: var(--transition-fast);
}

.mobile-card.interactive:active {
    background: var(--bg-mobile-card-hover);
    transform: scale(0.98);
}

.card-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.card-title-text {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Badges & Indicators */
.badge-mobile {
    padding: 2px 6px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.badge-mobile.online { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-mobile.offline { background: rgba(100, 116, 139, 0.15); color: var(--text-muted); }

/* Vitals Cards Grid */
.vitals-mobile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.vital-mobile-card {
    background: var(--bg-mobile-card);
    border: 1px solid var(--border-mobile);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 96px;
    position: relative;
    overflow: hidden;
}

.vital-mobile-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.vital-mobile-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-main);
    margin-top: 8px;
}

.vital-mobile-unit {
    font-size: 10px;
    color: var(--text-muted);
    font-weight: 500;
}

.vital-mobile-status {
    font-size: 10px;
    font-weight: 700;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
}

/* Form Controls */
.mobile-form-group {
    margin-bottom: 14px;
}

.mobile-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    margin-bottom: 6px;
}

.mobile-input {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-mobile);
    border-radius: 8px;
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    transition: var(--transition-fast);
}

.mobile-input:focus {
    border-color: var(--primary);
    background: rgba(15, 23, 42, 0.9);
}

/* Buttons */
.mobile-btn-primary {
    width: 100%;
    padding: 12px;
    background: var(--primary);
    color: #0b1329;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: var(--transition-fast);
}

.mobile-btn-primary:active {
    background: var(--primary-hover);
    transform: scale(0.99);
}

.mobile-btn-secondary {
    width: 100%;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--border-mobile);
    border-radius: 8px;
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.mobile-btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Simulator Modal & Scan Overlays
   ========================================================================== */
.mobile-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(9, 13, 22, 0.85);
    z-index: 1001;
    display: none;
    align-items: flex-end; /* Mobile bottom sheet style */
    transition: opacity 0.3s ease;
}

.mobile-bottom-sheet {
    width: 100%;
    background: #0f172a;
    border-top-left-radius: 24px;
    border-top-right-radius: 24px;
    border-top: 1px solid var(--border-mobile);
    padding: 24px 20px;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-modal-overlay.active {
    display: flex;
}

.mobile-modal-overlay.active .mobile-bottom-sheet {
    transform: translateY(0);
}

/* Radar Pulsating Animation */
.radar-container {
    width: 120px;
    height: 120px;
    margin: 20px auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.radar-circle {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 1.5px solid var(--primary);
    border-radius: 50%;
    animation: radar-pulse 2s infinite linear;
    opacity: 0;
}

.radar-circle:nth-child(2) {
    animation-delay: 0.6s;
}

.radar-circle:nth-child(3) {
    animation-delay: 1.2s;
}

.radar-center-icon {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--primary);
    color: #0b1329;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.5);
}

@keyframes radar-pulse {
    0% { transform: scale(0.3); opacity: 0; }
    50% { opacity: 0.4; }
    100% { transform: scale(1.1); opacity: 0; }
}

/* Progress bar */
.progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 16px 0;
}

.progress-bar-fill {
    width: 0%;
    height: 100%;
    background: var(--primary);
    transition: width 0.1s linear;
}

/* Toggles & Switched Elements */
.mobile-switch-track {
    width: 38px;
    height: 20px;
    background: #334155;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: var(--transition-fast);
}

.mobile-switch-track.active {
    background: var(--primary);
}

.mobile-switch-thumb {
    width: 14px;
    height: 14px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: var(--transition-fast);
}

.mobile-switch-track.active .mobile-switch-thumb {
    left: 21px;
}

/* Mobile List items */
.mobile-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-mobile);
}

.mobile-list-item:last-child {
    border-bottom: none;
}

.mobile-list-text {
    display: flex;
    flex-direction: column;
}

.mobile-list-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-main);
}

.mobile-list-desc {
    font-size: 11px;
    color: var(--text-secondary);
}

/* Tab Panels Visibility */
.mobile-tab-panel {
    display: none;
}

.mobile-tab-panel.active {
    display: block;
}

/* Floating mobile toast */
.mobile-toast {
    position: absolute;
    top: 48px;
    left: 12px;
    right: 12px;
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid var(--border-mobile);
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 12px;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.3);
    z-index: 1100;
    animation: slide-down-toast 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slide-down-toast {
    from { transform: translateY(-40px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Mobile Fullscreen Sub Page Slide-in */
.mobile-sub-page {
    position: absolute;
    top: 36px;
    left: 0;
    right: 0;
    bottom: 68px; /* Safe area above bottom navigation */
    background: var(--bg-mobile-root);
    z-index: 950;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-sub-page.active {
    transform: translateX(0);
}

.sub-page-header {
    padding: 12px 16px;
    background: var(--bg-mobile-card);
    border-bottom: 1px solid var(--border-mobile);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sub-page-title {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
}

.sub-page-content {
    flex-grow: 1;
    overflow-y: auto;
    padding: 16px;
}

.sub-page-content::-webkit-scrollbar {
    display: none;
}

.menu-list-btn {
    width: 100%;
    background: var(--bg-mobile-card);
    border: 1px solid var(--border-mobile);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-main);
    text-decoration: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
}

.menu-list-btn:active {
    background: var(--bg-mobile-card-hover);
    transform: scale(0.99);
}

.menu-list-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-list-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

