/* =========================================
   Modern Health & Fitness Tracker v3.0
   Clean, Mobile-First Design
   ========================================= */

/* Import Modern Fonts */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Sans:wght@400;500;600;700&display=swap');

/* CSS Variables - Light Theme */
:root {
    /* Primary Colors */
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.2);
    
    /* Accent Colors */
    --accent-green: #10b981;
    --accent-green-light: #34d399;
    --accent-blue: #0ea5e9;
    --accent-orange: #f97316;
    --accent-pink: #ec4899;
    --accent-purple: #a855f7;
    --accent-red: #ef4444;
    --accent-yellow: #eab308;
    
    /* Surfaces */
    --bg-base: #f8fafc;
    --bg-elevated: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.6);
    --bg-input: #f1f5f9;
    
    /* Text */
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;
    
    /* Borders */
    --border: rgba(148, 163, 184, 0.2);
    --border-strong: rgba(148, 163, 184, 0.3);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.07), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.15);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warning: linear-gradient(135deg, #f97316 0%, #fb923c 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
    --gradient-blue: linear-gradient(135deg, #0ea5e9 0%, #38bdf8 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, rgba(99, 102, 241, 0.08) 0px, transparent 50%), 
                     radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.06) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.05) 0px, transparent 50%);
    
    /* Sizing */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    
    /* Spacing */
    --nav-height: 70px;
    --bottom-nav-height: 72px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-bounce: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Dark Theme */
[data-theme="dark"] {
    --primary: #818cf8;
    --primary-light: #a5b4fc;
    --primary-dark: #6366f1;
    --primary-glow: rgba(129, 140, 248, 0.25);
    
    --bg-base: #0f172a;
    --bg-elevated: #1e293b;
    --bg-card: rgba(30, 41, 59, 0.8);
    --bg-glass: rgba(30, 41, 59, 0.6);
    --bg-input: #1e293b;
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #64748b;
    
    --border: rgba(71, 85, 105, 0.3);
    --border-strong: rgba(71, 85, 105, 0.5);
    
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 40px rgba(129, 140, 248, 0.2);
    
    --gradient-mesh: radial-gradient(at 40% 20%, rgba(129, 140, 248, 0.1) 0px, transparent 50%), 
                     radial-gradient(at 80% 0%, rgba(236, 72, 153, 0.08) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, rgba(16, 185, 129, 0.06) 0px, transparent 50%);
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Plus Jakarta Sans', 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-base);
    background-image: var(--gradient-mesh);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: calc(var(--bottom-nav-height) + 20px);
    transition: background var(--transition-base), color var(--transition-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px;
}

/* =========================================
   Header / Top Navigation
   ========================================= */
.top-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    margin-bottom: 16px;
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.top-bar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    box-shadow: var(--shadow-md);
}

.top-bar h1 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.top-bar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: transform var(--transition-fast);
    text-decoration: none;
}

.user-avatar:hover {
    transform: scale(1.05);
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all var(--transition-fast);
}

.icon-btn:hover {
    background: var(--primary);
    color: white;
    transform: scale(1.05);
}

/* =========================================
   Date Picker Section
   ========================================= */
.date-section {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: var(--shadow-sm);
}

.date-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.date-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.date-nav-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.date-display {
    text-align: center;
    flex: 1;
}

.date-display .day-name {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px;
}

.date-display .date-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.date-picker-wrap {
    position: relative;
}

.date-picker-wrap input[type="date"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    top: 0;
    left: 0;
}

.today-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: var(--gradient-primary);
    color: white;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.today-badge:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-md);
}

/* =========================================
   Bottom Navigation (Mobile)
   ========================================= */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    padding: 8px 12px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-radius: var(--radius-lg);
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    min-width: 56px;
}

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

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

.nav-item .nav-icon {
    font-size: 22px;
    transition: transform var(--transition-bounce);
}

.nav-item.active .nav-icon {
    transform: scale(1.1);
}

.nav-item .nav-label {
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Desktop Tab Navigation */
.tabs {
    display: none;
    gap: 6px;
    margin-bottom: 20px;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    padding: 8px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    flex-wrap: wrap;
}

.tab-btn {
    padding: 12px 20px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    font-weight: 600;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-btn:hover {
    background: var(--bg-input);
    color: var(--text-primary);
}

.tab-btn.active {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeSlideIn 0.3s ease-out;
}

.tab-content.active {
    display: block;
}

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

/* =========================================
   Cards Grid
   ========================================= */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
}

.metric-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-fast);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--card-accent, var(--gradient-primary));
}

.metric-card.calories { --card-accent: var(--accent-orange); }
.metric-card.calories::before { background: var(--gradient-warning); }
.metric-card.water { --card-accent: var(--accent-blue); }
.metric-card.water::before { background: var(--gradient-blue); }
.metric-card.protein { --card-accent: var(--accent-green); }
.metric-card.protein::before { background: var(--gradient-success); }
.metric-card.exercise { --card-accent: var(--accent-red); }
.metric-card.exercise::before { background: var(--gradient-danger); }
.metric-card.supplement { --card-accent: var(--accent-purple); }
.metric-card.supplement::before { background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%); }
.metric-card.weight { --card-accent: var(--accent-pink); }
.metric-card.weight::before { background: linear-gradient(135deg, #ec4899 0%, #f472b6 100%); }

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

.metric-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    background: var(--bg-input);
}

.metric-card.calories .metric-icon { background: rgba(249, 115, 22, 0.1); }
.metric-card.water .metric-icon { background: rgba(14, 165, 233, 0.1); }
.metric-card.protein .metric-icon { background: rgba(16, 185, 129, 0.1); }
.metric-card.exercise .metric-icon { background: rgba(239, 68, 68, 0.1); }
.metric-card.supplement .metric-icon { background: rgba(168, 85, 247, 0.1); }
.metric-card.weight .metric-icon { background: rgba(236, 72, 153, 0.1); }

.metric-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.2;
    margin-bottom: 2px;
}

.metric-value .unit {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

.metric-target {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.metric-remaining {
    font-size: 0.75rem;
    font-weight: 600;
}

.metric-remaining.ok { color: var(--accent-green); }
.metric-remaining.over { color: var(--accent-red); }

/* Progress Ring */
.progress-ring-wrap {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 44px;
    height: 44px;
}

.progress-ring {
    transform: rotate(-90deg);
}

.progress-ring-bg {
    fill: none;
    stroke: var(--border-strong);
    stroke-width: 4;
}

.progress-ring-fill {
    fill: none;
    stroke: var(--card-accent, var(--primary));
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset var(--transition-slow);
}

.progress-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Progress Bar (Linear) */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: var(--radius-full);
    overflow: hidden;
}

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

.progress-fill.over {
    background: var(--gradient-danger);
}

.progress-fill.success {
    background: var(--gradient-success);
}

.metric-card.calories .progress-fill { background: var(--gradient-warning); }
.metric-card.water .progress-fill { background: var(--gradient-blue); }
.metric-card.protein .progress-fill { background: var(--gradient-success); }
.metric-card.exercise .progress-fill { background: var(--gradient-danger); }
.metric-card.supplement .progress-fill { background: linear-gradient(135deg, #a855f7 0%, #d946ef 100%); }

/* =========================================
   Stats Row
   ========================================= */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.stat-pill {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 12px 8px;
    text-align: center;
}

.stat-pill .stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-pill .stat-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* =========================================
   Form Cards
   ========================================= */
.form-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.form-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.form-card h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-card h3 .form-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

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

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

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--transition-fast);
}

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

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

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

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.form-row-3 {
    grid-template-columns: repeat(3, 1fr);
}

/* Quick Add Buttons */
.quick-add-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.quick-btn {
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    background: var(--bg-elevated);
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    flex: 1;
    min-width: 70px;
    text-align: center;
}

.quick-btn:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: scale(1.02);
}

.quick-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Submit Button */
.btn-submit {
    width: 100%;
    padding: 14px 20px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--gradient-primary);
    color: white;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.btn-submit:active {
    transform: translateY(0);
}

/* Secondary Button */
.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--primary);
    color: var(--primary);
    box-shadow: var(--shadow-md);
}

/* =========================================
   Entry Lists
   ========================================= */
.list-section {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.list-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.list-header {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-elevated);
}

.list-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.list-count {
    font-size: 0.7rem;
    padding: 4px 10px;
    background: var(--primary-glow);
    color: var(--primary);
    border-radius: var(--radius-full);
    font-weight: 600;
}

.list-body {
    max-height: 350px;
    overflow-y: auto;
}

.entry-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--transition-fast);
}

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

.entry-item:hover {
    background: var(--bg-input);
}

.entry-info {
    flex: 1;
    min-width: 0;
}

.entry-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.entry-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.entry-value {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}

.entry-delete {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    border: none;
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.entry-delete:hover {
    background: var(--accent-red);
    color: white;
    transform: scale(1.1);
}

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

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

.empty-state p {
    font-size: 0.9rem;
}

/* =========================================
   Tables (for detailed views)
   ========================================= */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

thead {
    background: var(--bg-input);
}

th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
}

tbody tr:hover {
    background: var(--bg-input);
}

/* =========================================
   Badges
   ========================================= */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-success { background: rgba(16, 185, 129, 0.15); color: var(--accent-green); }
.badge-warning { background: rgba(249, 115, 22, 0.15); color: var(--accent-orange); }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: var(--accent-red); }
.badge-info { background: rgba(14, 165, 233, 0.15); color: var(--accent-blue); }
.badge-primary { background: var(--primary-glow); color: var(--primary); }
.badge-purple { background: rgba(168, 85, 247, 0.15); color: var(--accent-purple); }

/* =========================================
   Supplement Checklist
   ========================================= */
.supplement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.supplement-item {
    background: var(--bg-input);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    position: relative;
}

.supplement-item:hover {
    border-color: var(--primary);
    background: var(--primary-glow);
}

.supplement-item.taken {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--accent-green);
}

.supplement-item .supp-icon {
    font-size: 24px;
    margin-bottom: 6px;
}

.supplement-item .supp-name {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}

.supplement-item .supp-dose {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.supplement-item .supp-check {
    position: absolute;
    top: 6px;
    right: 6px;
    font-size: 14px;
    color: var(--accent-green);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.supplement-item.taken .supp-check {
    opacity: 1;
}

/* =========================================
   Charts & Analytics
   ========================================= */
.chart-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px;
    margin-bottom: 20px;
}

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

.chart-header h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.chart-container {
    height: 220px;
    position: relative;
}

/* =========================================
   Alerts & Messages
   ========================================= */
.alert {
    padding: 14px 18px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.alert-success {
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
}

.alert-error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.alert-warning {
    background: rgba(249, 115, 22, 0.1);
    border: 1px solid rgba(249, 115, 22, 0.2);
    color: var(--accent-orange);
}

.alert-info {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.2);
    color: var(--accent-blue);
}

/* =========================================
   Search
   ========================================= */
.search-wrap {
    position: relative;
    margin-bottom: 16px;
    z-index: 10;
}

.search-input {
    width: 100%;
    padding: 14px 18px 14px 48px;
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.search-icon {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 18px;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xl);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    margin-top: 4px;
}

.search-result-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition-fast);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--primary-glow);
}

/* =========================================
   Footer
   ========================================= */
footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
    margin-top: 40px;
}

footer a {
    color: var(--primary);
    text-decoration: none;
}

/* =========================================
   Login Page
   ========================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    padding-bottom: 20px;
}

.login-page body,
body.login-body {
    padding-bottom: 20px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border);
    padding: 40px 28px;
    box-shadow: var(--shadow-xl);
}

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

.login-logo .logo-icon {
    width: 64px;
    height: 64px;
    background: var(--gradient-primary);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 16px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
}

.login-logo h1 {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
}

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

/* =========================================
   Utilities
   ========================================= */
.text-success { color: var(--accent-green) !important; }
.text-danger { color: var(--accent-red) !important; }
.text-warning { color: var(--accent-orange) !important; }
.text-info { color: var(--accent-blue) !important; }
.text-muted { color: var(--text-muted) !important; }

.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px !important; }
.mb-2 { margin-bottom: 16px !important; }
.mb-3 { margin-bottom: 24px !important; }

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px !important; }
.mt-2 { margin-top: 16px !important; }

.text-center { text-align: center !important; }

.hidden { display: none !important; }

/* =========================================
   Loading & Animations
   ========================================= */
.spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

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

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

/* =========================================
   Responsive Design
   ========================================= */

/* Tablet and up */
@media (min-width: 768px) {
    body {
        padding-bottom: 20px;
    }
    
    .container {
        padding: 0 24px;
    }
    
    .bottom-nav {
        display: none;
    }
    
    .tabs {
        display: flex;
    }
    
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 16px;
    }
    
    .metric-card {
        padding: 20px;
    }
    
    .metric-value {
        font-size: 1.75rem;
    }
    
    .stats-row {
        grid-template-columns: repeat(6, 1fr);
    }
    
    .form-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .list-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container {
        height: 280px;
    }
    
    .supplement-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* Large screens */
@media (min-width: 1024px) {
    .cards-grid {
        grid-template-columns: repeat(5, 1fr);
    }
    
    .form-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .list-section {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .chart-container {
        height: 300px;
    }
}

/* Extra large screens */
@media (min-width: 1280px) {
    .container {
        padding: 0 32px;
    }
    
    .cards-grid {
        gap: 20px;
    }
    
    .cards-grid.six-cols {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Small mobile */
@media (max-width: 374px) {
    .cards-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .nav-item {
        min-width: 48px;
        padding: 8px;
    }
    
    .nav-item .nav-label {
        display: none;
    }
}

/* AI Calculator Button */
.btn-ai {
    width: 100%;
    padding: 10px 15px;
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
    color: white;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.btn-ai:hover {
    background: linear-gradient(135deg, #7c3aed, #4f46e5);
    transform: translateY(-1px);
}

.btn-ai:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ai-status {
    padding: 10px 15px;
    border-radius: 8px;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

.ai-status.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-green);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.ai-status.error {
    background: rgba(239, 68, 68, 0.1);
    color: var(--accent-red);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Time display in entries */
.entry-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Supplement time display */
.supp-time {
    font-size: 0.7rem;
    color: var(--primary);
    margin-top: 2px;
    font-weight: 500;
}

.supplement-item.taken .supp-time {
    color: var(--accent-green);
}

/* Modal styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 25px;
    max-width: 320px;
    width: 100%;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-content h3 {
    margin: 0 0 10px 0;
    color: var(--text-primary);
}

.modal-content .text-muted {
    margin-bottom: 20px;
}

.modal-content input[type="time"] {
    margin-bottom: 20px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
}

.modal-buttons button {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
}

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

.btn-secondary:hover {
    background: var(--bg-elevated);
}

/* User Management Styles */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.user-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: var(--bg-input);
    border-radius: 12px;
    border: 1px solid var(--border);
    gap: 15px;
    flex-wrap: wrap;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 200px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.user-details {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.user-email {
    font-size: 0.9rem;
    color: var(--text-muted);
    word-break: break-word;
}

.user-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.user-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.btn-edit, .btn-delete {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.btn-edit {
    background: var(--bg-card);
    color: var(--primary);
    border: 1px solid var(--primary);
}

.btn-edit:hover {
    background: var(--primary);
    color: white;
}

.btn-delete {
    background: var(--bg-card);
    color: var(--accent-red);
    border: 1px solid var(--accent-red);
}

.btn-delete:hover {
    background: var(--accent-red);
    color: white;
}

.badge-admin {
    background: var(--gradient-primary);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-you {
    background: var(--accent-green);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-success {
    background: rgba(16, 185, 129, 0.2);
    color: var(--accent-green);
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* Goal Preset Buttons */
.btn-preset {
    flex: 1;
    min-width: 100px;
    padding: 15px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.btn-preset:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-preset small {
    display: block;
    opacity: 0.7;
    margin-top: 4px;
}

.btn-preset:hover small {
    opacity: 1;
}

@media (max-width: 500px) {
    .user-item {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Print styles */
@media print {
    .top-bar,
    .bottom-nav,
    .tabs,
    .btn-submit,
    .entry-delete {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
        padding-bottom: 0;
    }
    
    .metric-card,
    .form-card,
    .list-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}
