/* ============================================
   KB SmartShape - Design System
   Premium Health & Fitness App
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Prompt:wght@300;400;500;600;700&display=swap');

/* ============================================
   CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* Primary - Fresh Green Gradient */
    --primary-50: #e8f5e9;
    --primary-100: #c8e6c9;
    --primary-200: #a5d6a7;
    --primary-300: #81c784;
    --primary-400: #66bb6a;
    --primary-500: #4caf50;
    --primary-600: #43a047;
    --primary-700: #388e3c;
    --primary-800: #2e7d32;
    --primary-900: #1b5e20;

    /* Accent - Vibrant Teal */
    --accent-50: #e0f7fa;
    --accent-100: #b2ebf2;
    --accent-200: #80deea;
    --accent-300: #4dd0e1;
    --accent-400: #26c6da;
    --accent-500: #00bcd4;
    --accent-600: #00acc1;
    --accent-700: #0097a7;
    --accent-800: #00838f;
    --accent-900: #006064;

    /* Warning - Warm Orange */
    --warning-50: #fff3e0;
    --warning-400: #ffa726;
    --warning-500: #ff9800;
    --warning-600: #fb8c00;

    /* Danger - Soft Red */
    --danger-50: #ffebee;
    --danger-400: #ef5350;
    --danger-500: #f44336;
    --danger-600: #e53935;

    /* Info - Cool Blue */
    --info-50: #e3f2fd;
    --info-400: #42a5f5;
    --info-500: #2196f3;
    --info-600: #1e88e5;

    /* Fasting Blue */
    --fasting-blue: #2196f3;
    --eating-green: #4caf50;

    /* Neutral / Dark Mode Base */
    --bg-primary: #0a0e17;
    --bg-secondary: #111827;
    --bg-card: #1a1f2e;
    --bg-card-hover: #222839;
    --bg-input: #1e2433;
    --bg-modal: rgba(0, 0, 0, 0.7);

    /* Glass Effect */
    --glass-bg: rgba(26, 31, 46, 0.8);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);

    /* Text */
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #4dd0e1;
    --text-on-primary: #ffffff;

    /* Borders */
    --border-color: rgba(255, 255, 255, 0.06);
    --border-light: rgba(255, 255, 255, 0.1);
    --border-active: rgba(76, 175, 80, 0.4);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.4);
    --shadow-glow-green: 0 0 20px rgba(76, 175, 80, 0.3);
    --shadow-glow-blue: 0 0 20px rgba(33, 150, 243, 0.3);
    --shadow-glow-teal: 0 0 20px rgba(0, 188, 212, 0.3);

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #43a047 0%, #1b5e20 100%);
    --gradient-accent: linear-gradient(135deg, #00bcd4 0%, #0097a7 100%);
    --gradient-warm: linear-gradient(135deg, #ff9800 0%, #f44336 100%);
    --gradient-cool: linear-gradient(135deg, #2196f3 0%, #9c27b0 100%);
    --gradient-dark: linear-gradient(135deg, #1a1f2e 0%, #0a0e17 100%);
    --gradient-card: linear-gradient(145deg, rgba(26, 31, 46, 0.9) 0%, rgba(17, 24, 39, 0.9) 100%);
    --gradient-glass: linear-gradient(145deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0.02) 100%);

    /* Typography */
    --font-thai: 'Prompt', sans-serif;
    --font-en: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;
    --space-2xl: 48px;
    --space-3xl: 64px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
    --transition-bounce: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);

    /* Z-index */
    --z-dropdown: 100;
    --z-modal: 1000;
    --z-toast: 2000;
    --z-tooltip: 3000;

    /* Bottom nav height */
    --nav-height: 70px;
    --header-height: 60px;
}

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

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

body {
    font-family: var(--font-thai);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Pattern */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: 
        radial-gradient(ellipse at 20% 50%, rgba(76, 175, 80, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 188, 212, 0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 80%, rgba(33, 150, 243, 0.04) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
}

a {
    color: var(--accent-400);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--accent-300);
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input, button, select, textarea {
    font-family: inherit;
    font-size: inherit;
}

/* ============================================
   App Shell
   ============================================ */
.app-container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    position: relative;
    padding-bottom: calc(var(--nav-height) + 20px);
}

/* ============================================
   Header
   ============================================ */
.app-header {
    position: sticky;
    top: 0;
    z-index: var(--z-dropdown);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(10, 14, 23, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.app-header .logo {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.app-header .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: var(--shadow-glow-green);
}

.app-header .logo-text {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 1.1rem;
    background: linear-gradient(135deg, var(--primary-400), var(--accent-400));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-header .header-actions {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.header-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 16px;
}

.header-btn:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.header-avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    border: 2px solid var(--primary-500);
    object-fit: cover;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.header-avatar:hover {
    border-color: var(--accent-400);
    box-shadow: var(--shadow-glow-teal);
}

/* ============================================
   Page Title
   ============================================ */
.page-title {
    padding: var(--space-lg);
    padding-bottom: var(--space-sm);
}

.page-title h1 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-xs);
}

.page-title .subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 300;
}

/* ============================================
   Bottom Navigation
   ============================================ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    height: var(--nav-height);
    background: rgba(10, 14, 23, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: var(--z-dropdown);
    padding: 0 var(--space-sm);
    padding-bottom: env(safe-area-inset-bottom);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-md);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    position: relative;
    min-width: 56px;
}

.nav-item i {
    font-size: 20px;
    transition: all var(--transition-fast);
}

.nav-item span {
    font-size: 0.65rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

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

.nav-item.active::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

/* Center Add Button */
.nav-item--add {
    position: relative;
    top: -15px;
}

.nav-item--add .add-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-full);
    background: var(--gradient-primary);
    border: 3px solid var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 22px;
    box-shadow: var(--shadow-glow-green);
    transition: all var(--transition-bounce);
}

.nav-item--add:hover .add-btn {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
}

.nav-item--add span {
    margin-top: 4px;
}

/* ============================================
   Cards
   ============================================ */
.card {
    background: var(--gradient-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin: 0 var(--space-lg) var(--space-md);
    backdrop-filter: blur(10px);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

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

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.card-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.card-header h3 i {
    font-size: 14px;
    color: var(--primary-400);
}

.card-badge {
    font-size: 0.7rem;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.card-badge--green {
    background: rgba(76, 175, 80, 0.15);
    color: var(--primary-400);
}

.card-badge--blue {
    background: rgba(33, 150, 243, 0.15);
    color: var(--info-400);
}

.card-badge--orange {
    background: rgba(255, 152, 0, 0.15);
    color: var(--warning-400);
}

/* ============================================
   Stat Cards (mini)
   ============================================ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-md);
}

.stat-card {
    background: var(--gradient-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: all var(--transition-normal);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.stat-card--cal::after { background: var(--gradient-warm); }
.stat-card--protein::after { background: var(--gradient-accent); }
.stat-card--fat::after { background: linear-gradient(135deg, #ffd54f, #ff8f00); }
.stat-card--carbs::after { background: var(--gradient-cool); }
.stat-card--water::after { background: linear-gradient(135deg, #42a5f5, #0d47a1); }

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto var(--space-sm);
    font-size: 16px;
}

.stat-card--cal .stat-icon { background: rgba(255, 87, 34, 0.15); color: #ff5722; }
.stat-card--protein .stat-icon { background: rgba(0, 188, 212, 0.15); color: #00bcd4; }
.stat-card--fat .stat-icon { background: rgba(255, 193, 7, 0.15); color: #ffc107; }
.stat-card--carbs .stat-icon { background: rgba(33, 150, 243, 0.15); color: #2196f3; }
.stat-card--water .stat-icon { background: rgba(33, 150, 243, 0.15); color: #2196f3; }

.stat-card .stat-value {
    font-family: var(--font-en);
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 2px;
}

.stat-card .stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.stat-card .stat-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ============================================
   Progress Bars
   ============================================ */
.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.progress-bar__fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-bar__fill::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 20px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
    border-radius: var(--radius-full);
}

.progress-bar--green .progress-bar__fill { background: var(--gradient-primary); }
.progress-bar--blue .progress-bar__fill { background: var(--gradient-accent); }
.progress-bar--orange .progress-bar__fill { background: var(--gradient-warm); }
.progress-bar--cool .progress-bar__fill { background: var(--gradient-cool); }

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xs);
    font-size: 0.8rem;
}

.progress-info .label {
    color: var(--text-secondary);
}

.progress-info .value {
    font-family: var(--font-en);
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Circular Progress (for IF Timer)
   ============================================ */
.circle-progress {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
}

.circle-progress svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.circle-progress .track {
    fill: none;
    stroke: rgba(255,255,255,0.06);
    stroke-width: 8;
}

.circle-progress .fill {
    fill: none;
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.circle-progress .fill--fasting {
    stroke: url(#gradientBlue);
}

.circle-progress .fill--eating {
    stroke: url(#gradientGreen);
}

.circle-progress__center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.circle-progress__time {
    font-family: var(--font-en);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.circle-progress__label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: var(--space-xs);
}

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: all var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

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

.btn--primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-glow-green);
}

.btn--primary:hover {
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.5);
    transform: translateY(-1px);
}

.btn--accent {
    background: var(--gradient-accent);
    color: white;
    box-shadow: var(--shadow-glow-teal);
}

.btn--outline {
    background: transparent;
    border: 1px solid var(--border-light);
    color: var(--text-primary);
}

.btn--outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: var(--primary-400);
}

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

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

.btn--danger {
    background: linear-gradient(135deg, #ef5350, #e53935);
    color: white;
}

.btn--block {
    width: 100%;
}

.btn--sm {
    padding: 8px 16px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

.btn--lg {
    padding: 16px 32px;
    font-size: 1rem;
    border-radius: var(--radius-lg);
}

.btn--icon {
    width: 44px;
    height: 44px;
    padding: 0;
    border-radius: var(--radius-full);
}

/* Social Login Buttons */
.btn--google {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.btn--google:hover {
    background: #f5f5f5;
}

.btn--facebook {
    background: #1877f2;
    color: white;
}

.btn--facebook:hover {
    background: #166fe5;
}

/* ============================================
   Forms
   ============================================ */
.form-group {
    margin-bottom: var(--space-lg);
}

.form-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.15);
}

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

.form-control--icon {
    padding-left: 44px;
}

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

.form-group--icon {
    position: relative;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.825L.35 3.175 1.175 2.35 6 7.175 10.825 2.35l.825.825z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}

.form-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: var(--space-xs);
}

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

/* ============================================
   Quick Action Buttons (Hydration, etc.)
   ============================================ */
.quick-actions {
    display: flex;
    gap: var(--space-md);
    justify-content: center;
    flex-wrap: wrap;
}

.quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-bounce);
    min-width: 80px;
    color: var(--text-primary);
}

.quick-btn:hover {
    transform: scale(1.05);
    border-color: var(--primary-400);
    box-shadow: var(--shadow-glow-green);
}

.quick-btn:active {
    transform: scale(0.95);
}

.quick-btn i {
    font-size: 24px;
    color: var(--accent-400);
}

.quick-btn span {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============================================
   Water Level Animation
   ============================================ */
.water-level {
    position: relative;
    width: 120px;
    height: 200px;
    margin: 0 auto;
    background: rgba(255,255,255,0.03);
    border-radius: 0 0 30px 30px;
    border: 2px solid var(--border-light);
    border-top: none;
    overflow: hidden;
}

.water-level::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    height: 20px;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: 5px;
}

.water-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(180deg, rgba(33, 150, 243, 0.4) 0%, rgba(13, 71, 161, 0.6) 100%);
    transition: height 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 0 0 28px 28px;
}

.water-fill::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10%;
    width: 120%;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1440 320'%3E%3Cpath fill='rgba(33,150,243,0.3)' d='M0,224L48,213.3C96,203,192,181,288,181.3C384,181,480,203,576,218.7C672,235,768,245,864,234.7C960,224,1056,192,1152,181.3C1248,171,1344,181,1392,186.7L1440,192L1440,320L0,320Z'%3E%3C/path%3E%3C/svg%3E") repeat-x;
    animation: wave 3s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: translateX(0); }
    50% { transform: translateX(-10px); }
}

.water-percentage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: var(--font-en);
    font-size: 1.8rem;
    font-weight: 700;
    color: white;
    text-shadow: 0 2px 10px rgba(0,0,0,0.5);
    z-index: 2;
}

/* ============================================
   BMI Gauge
   ============================================ */
.bmi-gauge {
    position: relative;
    width: 200px;
    height: 110px;
    margin: 0 auto;
    overflow: hidden;
}

.bmi-gauge__arc {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: conic-gradient(
        from 180deg,
        #2196f3 0deg,      /* Underweight - Blue */
        #4caf50 60deg,      /* Normal - Green */
        #ff9800 120deg,     /* Overweight - Orange */
        #f44336 180deg      /* Obese - Red */
    );
    mask: radial-gradient(circle at center, transparent 60%, black 61%);
    -webkit-mask: radial-gradient(circle at center, transparent 60%, black 61%);
}

.bmi-gauge__needle {
    position: absolute;
    bottom: 10px;
    left: 50%;
    width: 3px;
    height: 65px;
    background: white;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 2px;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
}

.bmi-gauge__value {
    position: absolute;
    bottom: 5px;
    left: 50%;
    transform: translateX(-50%);
    font-family: var(--font-en);
    font-size: 1.5rem;
    font-weight: 700;
}

.bmi-gauge__labels {
    display: flex;
    justify-content: space-between;
    padding: 0 10px;
    margin-top: var(--space-xs);
}

.bmi-gauge__labels span {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* ============================================
   Meal Sections
   ============================================ */
.meal-section {
    margin: 0 var(--space-lg) var(--space-md);
}

.meal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) 0;
}

.meal-header h4 {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.9rem;
    font-weight: 600;
}

.meal-header h4 i {
    color: var(--warning-400);
    font-size: 16px;
}

.meal-add-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    background: rgba(76, 175, 80, 0.1);
    border: 1px solid rgba(76, 175, 80, 0.2);
    color: var(--primary-400);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 14px;
}

.meal-add-btn:hover {
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.1);
}

.food-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-sm);
    transition: all var(--transition-fast);
}

.food-item:hover {
    border-color: var(--border-light);
}

.food-item__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: rgba(255, 152, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.food-item__info {
    flex: 1;
    min-width: 0;
}

.food-item__name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.food-item__detail {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 2px;
}

.food-item__cal {
    font-family: var(--font-en);
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--warning-400);
    white-space: nowrap;
}

/* ============================================
   Modal
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-modal);
    z-index: var(--z-modal);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    padding: var(--space-lg);
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-content {
    transform: translateY(0);
}

.modal-handle {
    width: 40px;
    height: 4px;
    background: var(--border-light);
    border-radius: var(--radius-full);
    margin: 0 auto var(--space-lg);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: rgba(255,255,255,0.05);
    color: var(--danger-400);
}

/* ============================================
   Charts Container
   ============================================ */
.chart-container {
    position: relative;
    width: 100%;
    height: 200px;
    margin: var(--space-md) 0;
}

/* ============================================
   Badges Grid
   ============================================ */
.badges-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    padding: 0 var(--space-lg);
}

.badge-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-md);
    text-align: center;
}

.badge-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all var(--transition-bounce);
}

.badge-icon--earned {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2), rgba(255, 152, 0, 0.2));
    color: #FFD700;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.badge-icon--locked {
    background: rgba(255,255,255,0.03);
    color: var(--text-muted);
    border: 2px solid var(--border-color);
    opacity: 0.5;
}

.badge-item:hover .badge-icon--earned {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.4);
}

.badge-name {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.3;
}

/* ============================================
   Toast Notifications
   ============================================ */
.toast-container {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    width: 100%;
    max-width: 440px;
    padding: 0 var(--space-lg);
    pointer-events: none;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow-lg);
    transform: translateY(-20px);
    opacity: 0;
    animation: toastIn 0.4s ease forwards;
    pointer-events: auto;
}

.toast--success { border-left: 3px solid var(--primary-500); }
.toast--error { border-left: 3px solid var(--danger-500); }
.toast--info { border-left: 3px solid var(--info-500); }

.toast i {
    font-size: 18px;
    flex-shrink: 0;
}

.toast--success i { color: var(--primary-400); }
.toast--error i { color: var(--danger-400); }
.toast--info i { color: var(--info-400); }

.toast-message {
    font-size: 0.85rem;
    flex: 1;
}

@keyframes toastIn {
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes toastOut {
    to {
        transform: translateY(-20px);
        opacity: 0;
    }
}

/* ============================================
   Loading Spinner
   ============================================ */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-400);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: var(--space-xl) auto;
}

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

/* ============================================
   Floating Action Sheet
   ============================================ */
.fab-menu {
    position: fixed;
    bottom: calc(var(--nav-height) + 20px);
    right: 20px;
    z-index: var(--z-dropdown);
}

.fab-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all var(--transition-normal);
}

.fab-menu.active .fab-actions {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.fab-action-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    justify-content: flex-end;
}

.fab-action-label {
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: var(--shadow-md);
}

.fab-action-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    color: white;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-fast);
}

.fab-action-btn:hover {
    transform: scale(1.1);
}

/* ============================================
   Responsive Utilities
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.align-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.px-lg { padding-left: var(--space-lg); padding-right: var(--space-lg); }

.w-full { width: 100%; }

.hidden { display: none !important; }

/* ============================================
   Login Page Specific
   ============================================ */
.login-container {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-xl);
    text-align: center;
}

.login-logo {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-xl);
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    margin-bottom: var(--space-lg);
    box-shadow: var(--shadow-glow-green);
    animation: logoPulse 2s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: var(--shadow-glow-green); }
    50% { box-shadow: 0 0 40px rgba(76, 175, 80, 0.5); }
}

.login-title {
    font-family: var(--font-en);
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary-300), var(--accent-300));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: var(--space-xs);
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: var(--space-2xl);
}

.login-divider {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin: var(--space-lg) 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in { animation: fadeIn 0.5s ease forwards; }
.animate-fade-up { animation: fadeInUp 0.5s ease forwards; }
.animate-slide-right { animation: slideInRight 0.5s ease forwards; }
.animate-scale { animation: scaleIn 0.3s ease forwards; }

.delay-1 { animation-delay: 0.1s; opacity: 0; }
.delay-2 { animation-delay: 0.2s; opacity: 0; }
.delay-3 { animation-delay: 0.3s; opacity: 0; }
.delay-4 { animation-delay: 0.4s; opacity: 0; }
.delay-5 { animation-delay: 0.5s; opacity: 0; }

/* ============================================
   Scrollbar
   ============================================ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.2);
}

/* ============================================
   Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: var(--space-3xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

/* ============================================
   Tab Navigation
   ============================================ */
.tabs {
    display: flex;
    gap: var(--space-xs);
    padding: 0 var(--space-lg);
    margin-bottom: var(--space-lg);
    overflow-x: auto;
    -ms-overflow-style: none;
    scrollbar-width: none;
}

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

.tab-item {
    padding: 8px 18px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: all var(--transition-fast);
}

.tab-item:hover {
    color: var(--text-secondary);
    background: rgba(255,255,255,0.03);
}

.tab-item.active {
    background: rgba(76, 175, 80, 0.1);
    color: var(--primary-400);
    border-color: rgba(76, 175, 80, 0.2);
}

/* ============================================
   Skeleton Loading
   ============================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-card-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

.skeleton--text {
    height: 14px;
    margin-bottom: var(--space-sm);
}

.skeleton--title {
    height: 20px;
    width: 60%;
    margin-bottom: var(--space-md);
}

.skeleton--avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
}

.skeleton--card {
    height: 120px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-md);
}
