:root {
    --primary-color: #06C755; /* LINE Green */
    --secondary-color: #2F2F2F;
    --bg-color: #F4F4F4;
    --card-bg: #FFFFFF;
    --text-color: #333333;
    --muted-text: #888888;
    --danger-color: #FF4D4D;
    --accent-blue: #007AFF;
    --accent-orange: #FF9500;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 70px; /* Space for bottom nav */
}

header {
    background-color: var(--card-bg);
    padding: 16px;
    border-bottom: 1px solid #E5E5E5;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: var(--muted-text);
}

#user-picture {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}

main {
    flex: 1;
    padding: 16px;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background-color: var(--card-bg);
    border-top: 1px solid #E5E5E5;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted-text);
    padding: 8px;
    min-height: 44px;
    cursor: pointer;
    flex: 1;
    transition: color 0.2s;
}

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

.nav-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.nav-text {
    font-size: 11px;
    font-weight: 500;
}

.placeholder {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
    color: var(--muted-text);
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 2px dashed #E5E5E5;
}

.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: var(--muted-text);
}

/* Card styles */
.card {
    background-color: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

/* Add Food / Log Tabs - horizontal scroll on mobile */
.tabs {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.tabs-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

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

.tab-btn {
    padding: 10px 18px;
    min-height: 44px;
    flex-shrink: 0;
    white-space: nowrap;
    border-radius: 20px;
    border: 1px solid #E5E5E5;
    background: none;
    font-weight: 500;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

/* Dashboard Specific */
.summary-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 24px 16px;
}

.main-ring-container {
    position: relative;
}

.macro-rings {
    display: flex;
    justify-content: space-around;
    width: 100%;
    gap: 12px;
}

.progress-ring-wrapper {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

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

.ring-content {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.ring-value {
    font-weight: 700;
    color: var(--text-color);
}

.ring-label {
    color: var(--muted-text);
}

.ring-name {
    color: var(--muted-text);
    text-transform: uppercase;
}

/* Health Stats */
.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.health-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.health-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
}

.health-icon {
    font-size: 20px;
}

.health-info {
    display: flex;
    flex-direction: column;
}

.health-value {
    font-weight: 600;
    font-size: 0.9rem;
}

.health-label {
    font-size: 0.75rem;
    color: var(--muted-text);
}

/* Food Entries */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.entry-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
}

.entry-info {
    display: flex;
    flex-direction: column;
}

.entry-name {
    font-weight: 500;
}

.entry-meta {
    font-size: 0.8rem;
    color: var(--muted-text);
}

.entry-stats {
    text-align: right;
}

.entry-calories {
    font-weight: 600;
    color: var(--primary-color);
}

.entry-macros {
    font-size: 0.75rem;
    color: var(--muted-text);
    display: flex;
    gap: 8px;
}

/* Settings Form */
.settings-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-top: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 1px solid #E5E5E5;
    border-radius: 8px;
    font-size: 1rem;
}

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

.btn {
    padding: 14px;
    min-height: 44px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

.btn-secondary {
    background-color: #E5E5E5;
    color: var(--text-color);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

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

.error-msg {
    color: var(--danger-color);
    text-align: center;
    padding: 20px;
}

/* Quiet Mode toggle - isolate from min-height inheritance, fix squished styling */
.quiet-toggle.switch {
    min-height: auto !important;
    height: 1.5rem;
    width: 2.75rem;
    flex-shrink: 0;
}

.quiet-toggle .slider {
    border-radius: 9999px;
}

.quiet-toggle .slider-knob {
    left: 2px;
    top: 2px;
    height: 20px;
    width: 20px;
}

.quiet-toggle input:checked ~ .slider-knob {
    transform: translateX(20px);
}

/* Phase 2: Mascot Personality toggles in Settings (mirrors quiet-toggle) */
.mascot-toggle.switch {
    min-height: auto !important;
    height: 1.5rem;
    width: 2.75rem;
    flex-shrink: 0;
}

.mascot-toggle .slider {
    border-radius: 9999px;
}

.mascot-toggle .slider-knob {
    left: 2px;
    top: 2px;
    height: 20px;
    width: 20px;
}

.mascot-toggle input:checked ~ .slider-knob {
    -webkit-transform: translateX(20px);
    transform: translateX(20px);
}

/* Coach Dashboard: Client list breathing room so selection ring isn't clipped */
#client-list {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    overflow: visible;
}

/* Tamago Mascot: Healthy Glow animation (soft pulsing golden border + shadow) */
/* Uses box-shadow only for max iOS WKWebView compatibility — no filter: drop-shadow */
@keyframes healthy-glow-pulse {
    0%, 100% {
        box-shadow: 0 0 6px 1px rgba(245, 193, 70, 0.35),
                    0 0 0 2px rgba(245, 193, 70, 0.18);
    }
    50% {
        box-shadow: 0 0 18px 5px rgba(245, 193, 70, 0.70),
                    0 0 0 3px rgba(245, 193, 70, 0.45);
    }
}

.animate-healthy-glow {
    animation: healthy-glow-pulse 2.5s ease-in-out infinite;
}

/* Tamago Mascot: Level 5+ Aura — breathing golden glow (iOS WKWebView safe) */
@-webkit-keyframes mascot-aura-breathe {
    0%, 100% {
        -webkit-box-shadow: 0 0 8px 2px rgba(243, 168, 71, 0.30),
                            0 0 0 2px rgba(243, 168, 71, 0.15);
        box-shadow: 0 0 8px 2px rgba(243, 168, 71, 0.30),
                    0 0 0 2px rgba(243, 168, 71, 0.15);
    }
    50% {
        -webkit-box-shadow: 0 0 22px 6px rgba(243, 168, 71, 0.60),
                            0 0 0 3px rgba(243, 168, 71, 0.35);
        box-shadow: 0 0 22px 6px rgba(243, 168, 71, 0.60),
                    0 0 0 3px rgba(243, 168, 71, 0.35);
    }
}
@keyframes mascot-aura-breathe {
    0%, 100% {
        box-shadow: 0 0 8px 2px rgba(243, 168, 71, 0.30),
                    0 0 0 2px rgba(243, 168, 71, 0.15);
    }
    50% {
        box-shadow: 0 0 22px 6px rgba(243, 168, 71, 0.60),
                    0 0 0 3px rgba(243, 168, 71, 0.35);
    }
}
.mascot-aura-glow {
    -webkit-animation: mascot-aura-breathe 3s ease-in-out infinite;
    animation: mascot-aura-breathe 3s ease-in-out infinite;
}

/* Sniff Report chat bubble — fade in from slightly above */
@keyframes sniff-bubble-in {
    from {
        opacity: 0;
        transform: translateY(-6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#sniff-report-bubble:not(.hidden) {
    animation: sniff-bubble-in 0.25s ease-out forwards;
}

/* Loading text pulse while AI is thinking */
#sniff-report-loading {
    animation: healthy-glow-pulse 1.8s ease-in-out infinite;
}

