/* ================================================================
   PHB — Personal Health Board
   Premium Dark Theme with Glassmorphism
   ================================================================ */

/* ---- CSS Variables / Design Tokens ---- */
:root {
    /* Background */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --bg-glass: rgba(255, 255, 255, 0.05);
    --bg-glass-border: rgba(255, 255, 255, 0.1);
    --bg-input: rgba(15, 23, 42, 0.8);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-inverse: #0f172a;

    /* Accent Colors */
    --accent-primary: #06b6d4;
    --accent-primary-glow: rgba(6, 182, 212, 0.3);
    --accent-secondary: #8b5cf6;
    --accent-secondary-glow: rgba(139, 92, 246, 0.3);
    --accent-gradient: linear-gradient(135deg, #06b6d4, #8b5cf6);

    /* BP Classification Colors */
    --bp-normal: #10b981;
    --bp-elevated: #f59e0b;
    --bp-stage1: #f97316;
    --bp-stage2: #ef4444;
    --bp-crisis: #dc2626;

    /* Semantic */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Spacing */
    --nav-height: 68px;
    --header-height: 56px;
    --radius: 16px;
    --radius-sm: 10px;
    --radius-xs: 6px;

    /* Shadows */
    --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 20px var(--accent-primary-glow);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Base Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(6, 182, 212, 0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

#app {
    position: relative;
    z-index: 1;
    height: 100vh;
    height: 100dvh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
    width: 4px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

/* ================================================================
   LOGIN SCREEN
   ================================================================ */
.screen {
    height: 100vh;
    height: 100dvh;
}

#login-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    padding: 24px;
}

.login-container {
    width: 100%;
    max-width: 380px;
    animation: fadeInUp 0.6s var(--transition-slow);
}

.login-logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: var(--bg-glass);
    border: 1px solid var(--bg-glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin-bottom: 16px;
    box-shadow: var(--shadow-glow);
}

.login-title {
    font-size: 2rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.login-form {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius);
    padding: 28px;
    box-shadow: var(--shadow-card);
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.error-msg {
    margin-top: 12px;
    padding: 10px 14px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius-xs);
    color: #fca5a5;
    font-size: 0.85rem;
}

.disclaimer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 20px;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    outline: none;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
    box-shadow: 0 4px 15px var(--accent-primary-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 25px var(--accent-primary-glow);
}

.btn-secondary {
    background: var(--bg-glass);
    border: 1px solid var(--bg-glass-border);
    color: var(--text-primary);
}

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

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px;
}

.btn-ghost:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-xs);
}

.btn-full {
    width: 100%;
}

.btn-fab {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--accent-gradient);
    color: white;
    font-size: 1.5rem;
    box-shadow: 0 6px 25px var(--accent-primary-glow);
    z-index: 50;
    padding: 0;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-fab:active {
    transform: scale(0.9);
}

/* ================================================================
   HEADER
   ================================================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--bg-glass-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo-small {
    display: flex;
}

.header-title {
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-user {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ================================================================
   BOTTOM NAVIGATION
   ================================================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-height);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--bg-glass-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding-bottom: env(safe-area-inset-bottom, 0);
    z-index: 100;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 500;
    cursor: pointer;
    transition: color var(--transition-fast);
    min-width: 56px;
    position: relative;
    -webkit-user-select: none;
    user-select: none;
}

.nav-item.active {
    color: var(--accent-primary);
}

.nav-item.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.nav-item svg {
    transition: transform var(--transition-fast);
}

.nav-item:active svg {
    transform: scale(0.85);
}

/* ================================================================
   TAB CONTENT
   ================================================================ */
.tab-content {
    position: fixed;
    top: var(--header-height);
    bottom: var(--nav-height);
    left: 0;
    right: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    padding-bottom: 80px;
    -webkit-overflow-scrolling: touch;
}

.tab-page {
    animation: fadeIn 0.25s ease;
}

/* ================================================================
   CARDS
   ================================================================ */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-card);
    transition: transform var(--transition-fast);
}

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

.card-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-accent {
    border-left: 3px solid;
    border-image: var(--accent-gradient) 1;
}

/* Hero Card (Dashboard) */
.hero-card {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
    border: 1px solid rgba(6, 182, 212, 0.2);
    text-align: center;
    padding: 28px 20px;
}

.hero-bp {
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 6px;
    margin: 12px 0;
}

.hero-bp-value {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
}

.hero-bp-separator {
    font-size: 1.8rem;
    color: var(--text-muted);
    font-weight: 300;
}

.hero-bp-unit {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ================================================================
   BADGES & PILLS
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-normal { background: rgba(16, 185, 129, 0.15); color: var(--bp-normal); }
.badge-elevated { background: rgba(245, 158, 11, 0.15); color: var(--bp-elevated); }
.badge-stage1 { background: rgba(249, 115, 22, 0.15); color: var(--bp-stage1); }
.badge-stage2 { background: rgba(239, 68, 68, 0.15); color: var(--bp-stage2); }
.badge-crisis { background: rgba(220, 38, 38, 0.2); color: var(--bp-crisis); }

.badge-phase {
    background: var(--accent-primary-glow);
    color: var(--accent-primary);
}

.badge-active { background: rgba(16, 185, 129, 0.15); color: var(--success); }
.badge-completed { background: rgba(59, 130, 246, 0.15); color: var(--info); }
.badge-abandoned { background: rgba(239, 68, 68, 0.15); color: var(--danger); }
.badge-planned { background: rgba(245, 158, 11, 0.15); color: var(--warning); }

/* ================================================================
   STAT ITEMS
   ================================================================ */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stats-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.stat-item {
    text-align: center;
    padding: 14px 8px;
    background: var(--bg-glass);
    border-radius: var(--radius-sm);
    border: 1px solid var(--bg-glass-border);
}

.stat-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 4px;
}

.stat-value.positive { color: var(--success); }
.stat-value.negative { color: var(--danger); }

/* ================================================================
   PROGRESS BARS
   ================================================================ */
.progress-item {
    margin-bottom: 14px;
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.progress-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.progress-value {
    font-size: 0.8rem;
    color: var(--text-primary);
    font-weight: 600;
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width var(--transition-slow);
    background: var(--accent-gradient);
}

.progress-fill.warning {
    background: linear-gradient(90deg, var(--bp-elevated), var(--bp-stage1));
}

.progress-fill.danger {
    background: linear-gradient(90deg, var(--bp-stage1), var(--bp-stage2));
}

/* ================================================================
   LIST ITEMS (BP Readings, Diet Entries)
   ================================================================ */
.list-group {
    margin-bottom: 20px;
}

.list-date-header {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 6px;
    border-bottom: 1px solid var(--bg-glass-border);
    margin-bottom: 8px;
}

.list-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--bg-glass);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    transition: background var(--transition-fast);
    cursor: pointer;
}

.list-item:active {
    background: rgba(255, 255, 255, 0.08);
}

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

.list-item-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.list-item-icon.morning { background: rgba(245, 158, 11, 0.15); }
.list-item-icon.evening { background: rgba(139, 92, 246, 0.15); }
.list-item-icon.breakfast { background: rgba(251, 191, 36, 0.15); }
.list-item-icon.lunch { background: rgba(52, 211, 153, 0.15); }
.list-item-icon.dinner { background: rgba(139, 92, 246, 0.15); }
.list-item-icon.snack { background: rgba(244, 114, 182, 0.15); }

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

.list-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.list-item-subtitle {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.list-item-right {
    text-align: right;
}

.list-item-value {
    font-size: 0.9rem;
    font-weight: 700;
}

.list-item-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* ================================================================
   PILL TOGGLE (arm, position, time)
   ================================================================ */
.pill-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.pill {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--bg-glass-border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-family: inherit;
}

.pill.active {
    background: var(--accent-primary-glow);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.pill:active {
    transform: scale(0.95);
}

/* ================================================================
   MODAL
   ================================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-container {
    width: 100%;
    max-width: 500px;
    max-height: 85vh;
    background: var(--bg-secondary);
    border: 1px solid var(--bg-glass-border);
    border-radius: var(--radius) var(--radius) 0 0;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--bg-glass-border);
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    z-index: 1;
}

.modal-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
}

/* ================================================================
   TOAST
   ================================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: 400px;
}

.toast {
    padding: 12px 18px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}

.toast.success {
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #6ee7b7;
}

.toast.error {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

.toast.info {
    background: rgba(59, 130, 246, 0.2);
    border: 1px solid rgba(59, 130, 246, 0.3);
    color: #93c5fd;
}

/* ================================================================
   CHART CONTAINERS
   ================================================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 250px;
    margin: 12px 0;
}

.chart-container-sm {
    height: 180px;
}

.chart-container-lg {
    height: 320px;
}

/* ================================================================
   SECTION HEADERS
   ================================================================ */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    margin-top: 8px;
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ================================================================
   EMPTY STATE
   ================================================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state-text {
    font-size: 0.85rem;
}

/* ================================================================
   COMPLIANCE CALENDAR
   ================================================================ */
.compliance-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
}

.compliance-day {
    aspect-ratio: 1;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.compliance-day.compliant { background: rgba(16, 185, 129, 0.3); color: var(--success); }
.compliance-day.non-compliant { background: rgba(239, 68, 68, 0.3); color: var(--danger); }
.compliance-day.future { background: var(--bg-glass); color: var(--text-muted); }
.compliance-day.today { border: 2px solid var(--accent-primary); }

/* ================================================================
   EXPERIMENT CARD
   ================================================================ */
.experiment-card {
    border-left: 3px solid var(--accent-primary);
}

.experiment-card .card-header {
    margin-bottom: 12px;
}

.experiment-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.experiment-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* ================================================================
   TAB-SPECIFIC: REPORT TABS
   ================================================================ */
.report-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    scrollbar-width: none;
}

.report-tabs::-webkit-scrollbar {
    display: none;
}

.report-tab {
    padding: 8px 16px;
    border-radius: 20px;
    background: var(--bg-glass);
    border: 1px solid var(--bg-glass-border);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: all var(--transition-fast);
}

.report-tab.active {
    background: var(--accent-primary-glow);
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* ================================================================
   LOADING SPINNER
   ================================================================ */
.spinner {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid var(--bg-glass-border);
    border-top-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    flex-direction: column;
    gap: 12px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ================================================================
   ANIMATIONS
   ================================================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (min-width: 600px) {
    .tab-content {
        max-width: 540px;
        margin: 0 auto;
    }

    .modal-container {
        border-radius: var(--radius);
        margin-bottom: 10vh;
    }

    .modal-overlay {
        align-items: center;
    }

    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Numeric input — bigger for mobile */
input[type="number"] {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Date/time inputs */
input[type="date"],
input[type="time"],
input[type="datetime-local"] {
    color-scheme: dark;
}

/* Select dropdown */
select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

/* ================================================================
   HEALTH METRIC ICONS
   ================================================================ */
.health-icon-weight { background: rgba(59, 130, 246, 0.15); }
.health-icon-blood_sugar { background: rgba(239, 68, 68, 0.15); }
.health-icon-spo2 { background: rgba(16, 185, 129, 0.15); }
.health-icon-temperature { background: rgba(245, 158, 11, 0.15); }

/* Adjust nav for 6 items */
.nav-item {
    min-width: 48px;
    font-size: 0.6rem;
    padding: 6px 2px;
}

.nav-item svg {
    width: 20px;
    height: 20px;
}

/* Hidden utility */
[hidden] {
    display: none !important;
}
