:root {
    --bg-primary: #FAF9F6;
    --bg-secondary: #FFFFFF;
    --text-primary: #2C2C2C;
    --text-secondary: #6B6B6B;
    --border-color: #E8E4DC;
    --gold-start: #D4AF37;
    --gold-end: #FFD700;
    --accent-negative: #5F7161;
    --accent-positive: #C65D3B;
    --shadow-light: rgba(0,0,0,0.08);
    --shadow-medium: rgba(0,0,0,0.1);
}

[data-theme="midnight"] {
    --bg-primary: #1a1a2e;
    --bg-secondary: #16213e;
    --text-primary: #eaeaea;
    --text-secondary: #a8a8a8;
    --border-color: #2d3561;
    --gold-start: #8b7355;
    --gold-end: #c9a961;
    --accent-negative: #7a9d7a;
    --accent-positive: #d4805f;
    --shadow-light: rgba(0,0,0,0.3);
    --shadow-medium: rgba(0,0,0,0.4);
}

/* Golden Hour - Warm evening light theme */
[data-theme="golden-hour"] {
    --bg-primary: #F5E6D3;
    --bg-secondary: #E6CCB2;
    --text-primary: #4A3B32;
    --text-secondary: #8C7B6C;
    --border-color: #D4B499;
    --gold-start: #CC5500;
    --gold-end: #E6895F;
    --accent-negative: #6b8e6b;
    --accent-positive: #c65d3b;
    --shadow-light: rgba(74,59,50,0.08);
    --shadow-medium: rgba(74,59,50,0.12);
}



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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    position: relative;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Headings use Fraunces */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Fraunces', Georgia, serif;
    font-weight: 400;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, transparent 0%, var(--shadow-light) 100%);
    pointer-events: none;
}

.hidden {
    display: none !important;
}

/* Premium Badge */
.premium-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--gold-start);
    border: 1px solid var(--gold-start);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-family: 'Inter', sans-serif;
}

.unlocked-badge {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--accent-negative);
    border: 1px solid var(--accent-negative);
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 0.5rem;
    font-family: 'Inter', sans-serif;
}

/* ===== SUN ICONS - BASE STYLES ===== */

/* Shared base styling for sun icon */
.sun-icon {
    position: fixed;
    width: 50px;
    height: 50px;
    max-width: 50px;
    max-height: 50px;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

/* AI Navigation Button - no glow animation (uses .ai-thinking instead) */
#ai-nav-btn.glow,
#ai-nav-btn-mobile.glow {
    /* Disabled: AI button uses .ai-thinking for sun-flare animation only */
}

#ai-nav-btn.glow .sidebar-icon,
#ai-nav-btn-mobile.glow .tab-icon {
    /* Disabled: No glow animation for AI button */
}

@keyframes navGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 12px rgba(212, 175, 55, 1));
        transform: scale(1.1);
    }
}

/* Pulse glow animation for unused features */
.pulse-glow {
    animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
        opacity: 0.9;
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(212, 175, 55, 1));
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Sun flare animation - rays bob outward when AI is thinking */
@keyframes sun-flare {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.3);
    }
}

/* Apply animation to sun rays when .ai-thinking class is present */
.ai-thinking .sun-ray {
    animation: sun-flare 1.5s infinite alternate ease-in-out;
    transform-origin: center;
}

/* Stagger the animation for each ray using nth-child */
.ai-thinking .sun-ray:nth-child(2) { animation-delay: 0.1s; }
.ai-thinking .sun-ray:nth-child(3) { animation-delay: 0.2s; }
.ai-thinking .sun-ray:nth-child(4) { animation-delay: 0.3s; }
.ai-thinking .sun-ray:nth-child(5) { animation-delay: 0.4s; }
.ai-thinking .sun-ray:nth-child(6) { animation-delay: 0.5s; }
.ai-thinking .sun-ray:nth-child(7) { animation-delay: 0.6s; }
.ai-thinking .sun-ray:nth-child(8) { animation-delay: 0.7s; }
.ai-thinking .sun-ray:nth-child(9) { animation-delay: 0.8s; }

/* Commitment Sun (Gold AI Button) - Bottom Right */
#commitment-sun {
    bottom: 30px;
    right: 30px;
    stroke: var(--gold-start);
    color: var(--gold-start);
    opacity: 0.9;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
}

/* Mobile/Tablet: Position at top right */
@media (max-width: 1024px) {
    #commitment-sun {
        bottom: 100px;
        right: 30px;
    }
}

#commitment-sun:hover {
    opacity: 0.8;
}

/* Commitment Sun States */
#commitment-sun.glow {
    opacity: 1;
    animation: sunGlow 2s ease-in-out infinite;
}

/* Shared Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

@keyframes sunGlow {
    0%, 100% { 
        filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
    }
    50% { 
        filter: drop-shadow(0 0 12px rgba(212, 175, 55, 0.9));
    }
}

/* Sync Prompt Banner */
.sync-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-top: 2px solid var(--gold-start);
    box-shadow: 0 -4px 20px var(--shadow-medium);
    z-index: 50;
    animation: slideUp 0.4s ease-out;
}

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

.sync-prompt-content {
    max-width: 48rem;
    margin: 0 auto;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.sync-prompt-text strong {
    display: block;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.sync-prompt-text p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin: 0;
}

.sync-prompt-buttons {
    display: flex;
    gap: 0.75rem;
    flex-shrink: 0;
}

.btn-sync {
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
}

.btn-dismiss {
    padding: 0.5rem 1rem;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    white-space: nowrap;
}

@media (max-width: 640px) {
    .sync-prompt-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Onboarding */
#onboarding-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

/* Desktop: account for sidebar */
@media (min-width: 769px) {
    #onboarding-screen {
        margin-left: 240px; /* Sidebar width */
    }
}


.onboarding-container {
    width: 100%;
    max-width: 28rem;
}

.onboarding-title {
    text-align: center;
    font-size: 4rem;
    font-weight: normal;
    margin-bottom: 1rem;
    filter: drop-shadow(0 0 20px rgba(212,175,55,0.3));
}

.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    font-size: 1.125rem;
    font-style: italic;
}

.info-text {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.75rem;
    margin-top: 1rem;
}

/* Onboarding mobile header (logo + description) */
.onboarding-mobile-header {
    display: block;
    margin-bottom: 3rem;
}

.onboarding-mobile-header .sidebar-logo {
    font-size: 2rem;
    font-weight: 300;
    letter-spacing: 0.1em;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    color: var(--text-primary);
    text-align: center;
}

.onboarding-mobile-header .subtitle {
    margin-bottom: 2rem;
}

/* Desktop tagline (hidden on mobile) */
.onboarding-desktop-tagline {
    display: none;
}

/* Sidebar app description (hidden by default, shown during onboarding) */
.sidebar-app-description {
    padding: 1.5rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

/* Desktop layout */
@media (min-width: 769px) {
    .onboarding-mobile-header {
        display: none;
    }
    
    .onboarding-desktop-tagline {
        display: block;
    }
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

/* Checkbox label for terms and conditions */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    cursor: pointer;
    line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
    width: auto;
    margin-top: 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
}

.checkbox-label span {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label a {
    color: var(--gold-start);
    text-decoration: underline;
    transition: color 0.2s;
}

.checkbox-label a:hover {
    color: var(--gold-end);
}

/* Terms and Privacy Policy modal scrollable content */
.terms-scroll-content {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 1rem;
    text-align: left;
    line-height: 1.6;
}

.terms-scroll-content::-webkit-scrollbar {
    width: 8px;
}

.terms-scroll-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 4px;
}

.terms-scroll-content::-webkit-scrollbar-thumb {
    background: var(--gold-start);
    border-radius: 4px;
}

.terms-scroll-content::-webkit-scrollbar-thumb:hover {
    background: var(--gold-end);
}

input, select, textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-primary);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.3s ease;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--gold-start);
    box-shadow: 0 0 0 3px rgba(212,175,55,0.1);
}

.btn-primary {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 0.25rem;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.4s ease;
    box-shadow: 0 4px 12px rgba(212,175,55,0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(212,175,55,0.3);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-outlined {
    width: 100%;
    padding: 1rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 2px solid var(--gold-start);
    border-radius: 0.25rem;
    font-weight: bold;
    cursor: pointer;
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.4s ease;
}

.btn-outlined:hover {
    background: var(--bg-secondary);
    box-shadow: 0 4px 12px rgba(212,175,55,0.15);
    transform: translateY(-1px);
}

/* Main App */
#app-screen {
    min-height: 100vh;
    padding: 2rem 1rem 0rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.user-info {
    position: fixed;
    top: 1.5rem;
    right: 5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.user-info.auth-resolved {
    opacity: 1;
}

.btn-signin-small {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.4s ease;
    letter-spacing: 0.05em;
}

.btn-signin-small:hover {
    border-color: var(--gold-start);
    box-shadow: 0 4px 12px rgba(212,175,55,0.15);
    transform: translateY(-1px);
}

.btn-synced {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: bold;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.4s ease;
    letter-spacing: 0.05em;
}

.btn-synced:hover {
    border-color: var(--gold-start);
    box-shadow: 0 4px 12px rgba(212,175,55,0.15);
    transform: translateY(-1px);
}

.btn-synced.collapsed {
    padding: 0;
    width: 2rem;
    height: 2rem;
    min-width: 2rem;
    border-radius: 50%;
    font-size: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.btn-synced.collapsed::after {
    content: "✓";
    font-size: 1rem;
    color: var(--text-primary);
}

.app-title {
    font-size: clamp(1.5rem, 4vw, 4rem);
    font-weight: normal;
    margin: 3rem;
    text-align: center;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    width: 100vw;
    position: relative;
}

/* Hourglass */
/* Primary View Container - Always Visible Above Fold */
.primary-view-container {
    min-height: 70vh;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
}

.hourglass-container {
    display: flex;
    justify-content: center;
    align-items: center;
}

.hourglass-wrapper {
    max-width: 350px;
    width: 85vw;
    filter: drop-shadow(0 8px 24px var(--shadow-light));
}

@media (min-width: 768px) {
    .hourglass-wrapper {
        max-width: 400px;
        width: 90vw;
    }
}

.hourglass-bulb {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    margin: 0 auto;
}

.hourglass-label {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    text-align: center;
}

.hourglass-label > div {
    background: rgba(250, 249, 246, 0.85);
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
}

[data-theme="midnight"] .hourglass-label > div {
    background: rgba(22, 33, 62, 0.85);
}

[data-theme="golden-hour"] .hourglass-label > div {
    background: rgba(245, 243, 237, 0.85);
}

.hourglass-label-top {
    margin-top: 30px;
}

.hourglass-label-bottom {
    margin-top: 90px;
}

.label-value {
    font-size: 1.75rem;
    font-weight: normal;
    color: var(--text-primary);
}

.label-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    letter-spacing: 0.05em;
}

.sand-transition {
    transition: all 0.6s ease-out;
}

/* ===== FASTING MODE =====  */
/* Blue droplets instead of gold grains when fasting */
.hourglass-container.fasting #sandTexture rect,
.hourglass-container.fasting #sandTextureBottom rect {
    transition: fill 0.3s ease;
}

.hourglass-container.fasting #sandTexture rect:nth-child(1),
.hourglass-container.fasting #sandTextureBottom rect:nth-child(1) {
    fill: #4A90E2 !important;
    opacity: 0.95 !important;
}

.hourglass-container.fasting #sandTexture rect:nth-child(2),
.hourglass-container.fasting #sandTextureBottom rect:nth-child(2) {
    fill: #4A90E2 !important;
    opacity: 0.95 !important;
}

.hourglass-container.fasting #sandTexture rect:nth-child(3),
.hourglass-container.fasting #sandTextureBottom rect:nth-child(3) {
    fill: #357ABD !important;
    opacity: 0.9 !important;
}

.hourglass-container.fasting #sandTexture rect:nth-child(4),
.hourglass-container.fasting #sandTextureBottom rect:nth-child(4) {
    fill: #5BA3F5 !important;
    opacity: 0.9 !important;
}

/* Net Calories Display */
.net-display {
    text-align: center;
}

.net-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
    
    /* New styles for alignment */
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none; /* Prevents text selection when clicking */
}

.net-toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    padding: 0.25rem 0.75rem;
    transition: color 0.3s ease;
}

.net-toggle-btn:hover {
    color: var(--gold-start);
}

#net-label-text {
    /* Ensures the label text doesn't jump around */
    display: inline-block;
    width: 9rem; /* Adjust as needed */
    text-align: center;
}

.net-value {
    font-size: 2rem;
    font-weight: normal;
    margin-bottom: 0.5rem;
    transition: color 0.5s ease;
}

.net-value.positive {
    color: var(--accent-positive);
}

.net-value.negative {
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Mode Toggle Slider (FOOD/FAST) - iOS Style */
.mode-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.mode-label {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    transition: all 0.3s ease;
    color: var(--text-primary);
    user-select: none;
}

.mode-label-inactive {
    font-weight: 400;
    color: var(--text-secondary);
    opacity: 0.4;
    font-size: 0.7rem;
}

.mode-toggle-switch {
    position: relative;
    width: 48px;
    height: 26px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.mode-toggle-switch:hover {
    border-color: var(--gold-start);
}

.mode-toggle-switch.active {
    background: rgba(74, 144, 226, 0.1);
    border-color: #4A90E2;
}

.mode-toggle-switch.active:hover {
    border-color: #5BA3F5;
}

.mode-toggle-slider {
    position: absolute;
    top: 50%;
    left: 3px;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    background: var(--gold-start);
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08);
}

.mode-toggle-switch.active .mode-toggle-slider {
    left: 25px;
    background: #4A90E2;
}

/* Grey out Log Food button when fasting */
#log-food-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/* Menu option button */
.menu-option-btn {
    width: 100%;
    padding: 0.75rem 1rem;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.2s ease;
    border-radius: 4px;
}

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

.net-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    margin: 0 0 2rem;
}

/* Larger screens get more margin */
@media (min-width: 1024px) {
    .action-buttons {
        margin: 0 0 3rem;
    }
}

.btn-action {
    padding: 0.75rem 2rem;
    border: 1px solid var(--border-color);
    border-radius: 2rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.4s ease;
    letter-spacing: 0.05em;
}

.btn-action:hover {
    border-color: var(--gold-start);
    box-shadow: 0 4px 12px rgba(212,175,55,0.15);
    transform: translateY(-1px);
}

/* Details Section */
.details-section {
    max-width: 48rem;
    width: 100%;
    margin: 20vh auto 2rem;
    padding: 0 1rem;
}

.detail-panel {
    background: var(--bg-secondary);
    padding: 2rem;
    margin-bottom: 2rem;
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.detail-title {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-weight: normal;
    font-size: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.breakdown-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    text-align: center;
    font-size: 0.875rem;
}

.breakdown-label {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.breakdown-value {
    font-weight: normal;
    font-size: 1.125rem;
}

.timeline-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    font-size: 0.875rem;
}

.timeline-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border-color);
}

.timeline-row:last-child {
    border-bottom: none;
}

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

.detail-value {
    font-weight: normal;
    color: var(--gold-start);
    font-size: 1rem;
}

.entry-item {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.entry-info {
    flex: 1;
}

.entry-name {
    font-weight: normal;
    color: var(--text-primary);
}

.entry-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.entry-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.entry-macros {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.autocomplete-dropdown {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.2s ease;
}

.autocomplete-item:hover {
    background: var(--bg-primary);
}

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

.autocomplete-item-name {
    margin-bottom: 0.25rem;
}

.autocomplete-item-macros {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.entry-right {
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: flex-end;
    margin: 0;
    padding: 0;
}

.btn-redo {
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: var(--text-primary);
    border: none;
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    flex-shrink: 0;
}

.btn-redo:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(212,175,55,0.3);
}

.btn-edit {
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.btn-edit:hover {
    background: var(--bg-tertiary);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.btn-delete {
    padding: 0.375rem 0.75rem;
    background: var(--accent-positive);
    color: white;
    border: none;
    border-radius: 0.25rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    margin-right: 0.5rem;
}

.btn-delete:hover {
    opacity: 0.8;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(198,93,59,0.3);
}

.btn-view-more {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-view-more:hover {
    border-color: var(--gold-start);
    color: var(--gold-start);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(250, 249, 246, 0.95);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.4s ease;
    padding: 2rem;
    padding-top: 4rem;
}

[data-theme="midnight"] .modal-overlay {
    background: rgba(26, 26, 46, 0.95);
}

[data-theme="golden-hour"] .modal-overlay {
    background: rgba(245, 243, 237, 0.95);
}

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

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    align-items: flex-end;
    justify-content: center;
     overflow: visible !important;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 0;
    padding: 30px;
    border: 1px solid var(--border-color);
    border-radius: 20px 20px 0 0;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
    overflow: visible !important;
}

/* Ensure dropdown appears above modal and input fields */
#food-suggestions-container,
#exercise-suggestions-container {
    position: relative;
    z-index: 10001;
}

.modal-content.large {
    max-width: 48rem;
    max-height: 90vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.modal-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
    font-weight: normal;
    letter-spacing: 0.05em;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.modal-header .modal-title {
    margin-bottom: 0;
    flex: 1;
}

.modal-header .ai-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.modal-header .ai-close-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* Auto-resize textareas */
textarea.auto-resize {
    overflow: hidden;
    resize: none !important;
}

.modal-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color) 50%, transparent);
    margin: 1.5rem 0;
}

.modal-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.modal-form input {
    text-align: center;
    font-size: 1.125rem;
}

.input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

/* Make both input container divs equal width */
.input-row > div {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.input-row input,
.input-row select {
    width: 100%;
}

/* Specific styling for new food modal inputs */
.quantity-group {
    flex: 0 0 30%;
}

.serving-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.serving-group select,
.serving-group input {
    width: 100%;
}

.calories-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

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

.modal-buttons button {
    flex: 1;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.modal-buttons button:last-child {
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: white;
    border-color: var(--gold-start);
}

.modal-buttons button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212,175,55,0.2);
}

/* AI button in modal-buttons should match modal button styling */
.modal-buttons .ai-btn {
    padding: 0.875rem;
    font-size: 1rem;
    border-radius: 0.25rem;
    border: 1px solid var(--border-color);
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: white;
    box-shadow: none;
}

.modal-buttons .ai-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212,175,55,0.2);
}

/* Remove spinner arrows from number inputs */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
}

/* AI Estimate button styling */
.btn-ai {
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%) !important;
    color: var(--bg-primary) !important;
    border-color: var(--gold-start) !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3) !important;
}

.btn-ai:hover {
    box-shadow: 0 4px 14px rgba(212, 175, 55, 0.4) !important;
}

.btn-ai:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2) !important;
}

.settings-content {
    max-height: 80vh;
    overflow-y: auto;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.settings-form label {
    display: block;
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.05em;
}

.settings-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.settings-section:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.settings-section h3, .settings-section h4 {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: normal;
}

/* Subscription Section */
.subscription-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.subscription-status {
    padding: 1.25rem;
    border-radius: 8px;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
    text-align: center;
}

.subscription-status.free {
    background: rgba(100, 100, 100, 0.05);
}

.subscription-status.active {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.subscription-status.cancelled {
    background: rgba(255, 100, 100, 0.1);
    border: 1px solid rgba(255, 100, 100, 0.3);
}

.subscription-status p {
    margin: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.subscription-status strong {
    color: var(--gold-start);
    font-size: 1rem;
}

/* Danger/Cancel Button */
.danger-btn {
    background: rgba(255, 50, 50, 0.8);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    width: 100%;
}

.danger-btn:hover {
    background: rgba(255, 50, 50, 1);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 50, 50, 0.3);
}

.danger-btn:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
}

.btn-cancel {
    background: var(--bg-primary);
    color: var(--text-secondary);
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    width: 100%;
}

.btn-cancel:hover {
    border-color: var(--text-secondary);
    opacity: 0.8;
}

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

.settings-section h3 {
    display: inline-flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
    margin-right: 1rem;
}

.sync-status {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
}

.sync-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: grey;
}

.sync-indicator.synced {
    background: var(--gold-start);
    box-shadow: 0 0 8px var(--gold-start);
}


.sync-indicator.syncing {
    background: #ffcc00;
    animation: pulse 1s ease-in-out infinite;
}

.sync-indicator.offline {
    background: #ff3333;
}

.sync-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.radio-option input[type="radio"] {
    width: auto;
    cursor: pointer;
}

.reset-section {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

.reset-section p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.btn-reset {
    background: var(--accent-positive);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 0.5rem;
}

.btn-reset:hover {
    opacity: 0.8;
}

.btn-signout {
    background: var(--text-secondary);
    color: white;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-signout:hover {
    opacity: 0.8;
}

/* Entry Memory Modal */
.search-box {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.tab {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab.active {
    color: var(--gold-start);
    border-bottom-color: var(--gold-start);
}

.sort-control {
    margin-bottom: 1rem;
}

.sort-control select {
    font-size: 0.875rem;
    padding: 0.5rem;
}

.entry-history-list {
    max-height: 50vh;
    overflow-y: auto;
}

.entry-history-item {
    padding: 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
}

.entry-history-info {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.entry-history-name {
    font-weight: normal;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    overflow-wrap: break-word;
    word-break: break-word;
}

.entry-history-meta {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    padding: 2rem;
    font-style: italic;
}

/* Commitment Modal */
.commitment-content {
    text-align: center;
}

.commitment-header {
    position: relative;
    margin-bottom: 1.5rem;
    height: 60px; /* Give the container a fixed height */
    display: flex;
    align-items: center;
    justify-content: center;
}

.commitment-icon {
    font-size: 4rem;
    line-height: 1;
    opacity: 0.5;
    color: var(--gold-start);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.4));
}

.commitment-header {
    position: relative;
    text-align: center;
    margin-bottom: 2rem;
}

.commitment-header .ai-close-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.commitment-header .ai-close-btn:hover {
    color: var(--text-primary);
}

.commitment-header .modal-title {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    margin-bottom: 0;
    width: 100%;
    text-shadow: 0 0 10px var(--bg-secondary);
}

.commitment-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.amount-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.amount-button {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
}

.amount-button.selected {
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    border-color: var(--gold-start);
}

.custom-amount {
    margin-top: 0.5rem;
    display: flex;
    justify-content: center;
}

.custom-amount input {
    width: 100%;
    max-width: calc(3 * (0.75rem + 3rem + 0.75rem) + 2 * 0.5rem);
}

.recurring-option {
    margin: 1rem 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.recurring-option input[type="checkbox"] {
    width: auto;
}

/* Commitment placeholder fade animation */
.commitment-placeholder-fade::placeholder {
    transition: opacity 3s ease-in-out;
}

.commitment-placeholder-hidden::placeholder {
    opacity: 0;
}

.commitment-placeholder-visible::placeholder {
    opacity: 0.6;
}

.gratitude-message {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    padding: 2rem;
}

/* Upgrade Prompt Modal */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 1.5rem 0;
}

.feature-list li {
    padding: 0.5rem 0;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.feature-list li::before {
    content: "• ";
    color: var(--gold-start);
    font-weight: bold;
    margin-right: 0.5rem;
}

.pricing {
    text-align: center;
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 1rem 0;
}

/* Feedback Toast */
.feedback-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 3rem;
    border-radius: 0.5rem;
    font-weight: normal;
    font-size: 1.5rem;
    box-shadow: 0 20px 60px var(--shadow-medium);
    z-index: 150;
    animation: pulseIn 0.6s ease-out;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
}

@keyframes pulseIn {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

/* App Footer */
.app-footer {
    width: 100%;
    margin-top: auto;
    padding: 3rem 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

.footer-title {
    font-size: 2rem;
    font-weight: normal;
    color: var(--text-secondary);
    letter-spacing: 0.1em;
    text-align: center;
}

.input-with-ai {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.input-with-ai input {
    flex: 1;
}

.ai-sparkle-btn {
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    border: none;
    border-radius: 0.25rem;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
    min-width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-sparkle-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.4);
}

.ai-sparkle-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: var(--bg-secondary);
    box-shadow: none;
}

.ai-sparkle-btn.loading {
    animation: sparkle-pulse 1s ease-in-out infinite;
}

@keyframes sparkle-pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Food and Exercise Modal Sizing */
#food-modal .modal-content,
#exercise-modal .modal-content {
    width: 90vw;
    max-width: 90vw;
    max-height: 90vh;
    padding: 1.5rem;
}

/* Position sparkle button to span both inputs */
#food-modal .modal-form,
#exercise-modal .modal-form {
    position: relative;
    padding-right: 60px;
}

#food-modal .input-with-ai,
#exercise-modal .input-with-ai {
    display: block;
}

#food-modal .input-with-ai input,
#exercise-modal .input-with-ai input {
    width: 100%;
}

#food-modal .ai-sparkle-btn,
#exercise-modal .ai-sparkle-btn {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    height: 100%;
    min-height: unset;
    width: 52px;
}

/* Desktop Footer */
@media (min-width: 769px) {
    .app-footer {
        flex-grow: 1;
        padding: 4rem 1rem;
    }
    #food-modal .modal-content,
    #exercise-modal .modal-content {
        max-width: 48rem;
        width: 100%;
    }

    /* Form row layout for desktop */
    .form-row {
        display: flex;
        gap: 1rem;
        margin-bottom: 1rem;
    }

    .form-row .form-group {
        flex: 1;
        margin-bottom: 0;
    }
}

/* Sticky Back Button for Commitment and Account Modals */
.modal-back-btn {
    position: sticky;
    bottom: 0;
    width: 100%;
    padding: 1rem;
    background: var(--bg-secondary);
    border: none;
    border-top: 1px solid var(--border-color);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 -4px 12px var(--shadow-light);
    margin-top: 2rem;
}

.modal-back-btn:hover {
    background: var(--bg-primary);
}

.modal-back-btn:active {
    transform: scale(0.98);
}

/* Remove bottom padding from modals with sticky back button */
#commitment-modal .modal-content,
#account-modal .modal-content {
    padding-bottom: 0;
}

/* Entry items adopt mobile layout at 1080px */
@media (max-width: 1080px) {
    .entry-item {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .entry-top {
        display: contents;
    }
    
    .entry-info {
        order: 1;
    }
    
    .entry-macros {
        order: 2;
        margin-left: 0;
    }
    
    .entry-right {
        order: 3;
        width: 100%;
        justify-content: flex-start;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    /* Hide panel titles on mobile */
    .panel-title {
        display: none;
    }

    /* Hide exercise mode explanation text on mobile */
    .modal-overlay {
        padding: 0;
        padding-top: 0;
    }

    .modal-content {
        width: 100vw;
        max-width: 100vw;
        border-radius: 0;
        max-height: 100vh;
    }

    /* Food and Exercise modals should take full screen on mobile */
    #food-modal .modal-content,
    #exercise-modal .modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
        padding: 20px;
        padding-bottom: 20px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        overflow-y: auto;
    }

    /* Keep buttons fixed at bottom */
    #food-modal .modal-buttons,
    #exercise-modal .modal-buttons {
        margin-top: auto;
        padding-top: 15px;
        flex-shrink: 0;
        position: sticky;
        bottom: 0;
        background: var(--bg-secondary);
    }

    /* Prevent header from shrinking */
    #food-modal .modal-header,
    #exercise-modal .modal-header {
        flex-shrink: 0;
        position: sticky;
        top: 0;
        background: var(--bg-secondary);
        padding-bottom: 10px;
        z-index: 10;
    }

    /* Form fields can scroll in the middle */
    #food-modal label,
    #food-modal input:not([type="button"]),
    #food-modal select,
    #exercise-modal label,
    #exercise-modal input:not([type="button"]),
    #exercise-modal select {
        flex-shrink: 0;
    }

    #food-modal .input-row,
    #exercise-modal .input-row {
        flex-shrink: 0;
    }

    /* Make suggestions containers expand downward on mobile */
    #food-modal #food-suggestions-container,
    #food-modal #exercise-suggestions-container,
    #exercise-modal #food-suggestions-container,
    #exercise-modal #exercise-suggestions-container {
        position: static;
        display: block;
        max-height: none;
    }

    /* Limit dropdown height on mobile to prevent pushing buttons off screen */
    /* Calculate: modal height minus header, inputs, and buttons = ~35vh max */
    #food-modal .autocomplete-dropdown,
    #exercise-modal .autocomplete-dropdown {
        position: static;
        max-height: 35vh;
        overflow-y: auto;
        margin-top: 0.5rem;
        flex-shrink: 0;
    }

    /* Both sun icons get same mobile treatment */
    .sun-icon {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        max-height: 40px !important;
    }
    
    #account-sun {
        top: 15px !important;
        left: 15px !important;
    }
    
    #commitment-sun {
        top: 30px !important;
        right: 30px !important;
        bottom: auto !important;
    }
    
    /* Hide user-info button on mobile when signed in */
    .user-info.auth-resolved {
        display: none !important;
    }
    
    .details-section {
        max-width: 100vw;
        width: 100vw;
        margin-left: calc(-50vw + 50%);
        margin-right: calc(-50vw + 50%);
        padding: 0;
    }
}

/* ===== PANEL SYSTEM ===== */

.app-panel {
    display: none;
    min-height: 100vh;
    padding-bottom: 80px; /* Space for mobile tab bar */
}

.app-panel.active {
    display: block;
}

.panel-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

@media (min-width: 768px) {
    .app-panel {
        margin-left: 240px;
        padding-bottom: 2rem;
    }
    
    .panel-content {
        padding: 2rem;
    }
}

.panel-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.panel-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}


.panel-section h3 {
    font-size: 1.5rem;
    font-weight: normal;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-description {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* ===== MOBILE LOGO ===== */

.mobile-logo {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: bold;
    letter-spacing: 2px;
    z-index: 100;
    font-family: 'Montserrat', sans-serif;
}

.mobile-account-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: all 0.3s ease;
    padding: 0;
}

.mobile-account-btn:hover {
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    border-color: var(--gold-start);
    transform: translateY(-50%) scale(1.05);
}

.mobile-account-btn:active {
    transform: translateY(-50%) scale(0.95);
}

#mobile-account-icon {
    line-height: 1;
    display: block;
}

.app-panel .panel-content {
    padding-top: 60px; /* Space for mobile logo */
}

@media (min-width: 768px) {
    .mobile-logo {
        display: none !important;
    }
    
    .app-panel .panel-content {
        padding-top: 2rem;
    }
}

/* ===== MOBILE TAB BAR ===== */

.mobile-tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
    box-shadow: 0 -2px 10px var(--shadow-light);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.tab-btn.active {
    color: var(--gold-start);
}

.tab-icon {
    font-size: 1.5rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 36px;
}

.tab-label {
    font-size: 0.75rem;
    font-family: 'Inter', sans-serif;
}

@media (min-width: 768px) {
    .mobile-tab-bar {
        display: none !important;
    }
    
    .app-panel {
        padding-bottom: 2rem;
    }
}

/* ===== DESKTOP SIDEBAR ===== */

.desktop-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 240px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    z-index: 100;
    transition: filter 0.2s ease;
}

/* Make body non-scrollable when mobile tab bar is open */
body.mobile-tab-open {
    overflow: hidden;
}

/* Darken contents when modal is open */
body:has(.modal-overlay:not(.hidden)) .desktop-sidebar,
body:has(#ai-chat-modal:not(.hidden)) .desktop-sidebar,
body:has(.modal-overlay:not(.hidden)) .app-panel,
body:has(#ai-chat-modal:not(.hidden)) .app-panel {
    filter: brightness(0.5);
    pointer-events: none;
}

@media (min-width: 768px) {
    .desktop-sidebar {
        display: flex !important;
    }
}

.sidebar-header {
    padding: 2rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    font-size: 1.5rem;
    font-weight: bold;
    letter-spacing: 2px;
    margin: 0;
    color: var(--text-primary);
    line-height: 1.2;
    font-family: 'Montserrat', sans-serif;
}

.sidebar-nav {
    flex: 1;
    padding: 1.5rem 0;
}

.sidebar-btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    text-align: left;
}

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

.sidebar-btn.active {
    background: linear-gradient(90deg, var(--gold-start), transparent);
    color: var(--gold-start);
    border-left: 3px solid var(--gold-start);
}

.sidebar-icon {
    font-size: 1.25rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
}

/* AI text label positioned on sun center */
.sun-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.5rem;
    font-weight: 700;
    color: var(--bg-primary);
    pointer-events: none;
    z-index: 1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: opacity 0.2s ease;
}

/* Hide sun label when modal is open */
.sun-label.hidden {
    opacity: 0;
}

.sidebar-label {
    flex: 1;
}

/* ===== TREE EDITOR IN SIDEBAR ===== */

.desktop-sidebar.editor-mode {
    background: var(--bg-primary);
    border-right: 2px solid var(--gold-start);
}

.tree-editor-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1rem;
    overflow: hidden;
}

.tree-editor-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid var(--gold-start);
    display: flex;
    align-items: center;
}

.editor-icon {
    margin-right: 0.5rem;
    font-size: 1.3rem;
}

.tree-undo-redo-buttons {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.undo-redo-btn {
    flex: 1;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s;
}

.undo-redo-btn:hover:not(:disabled) {
    border-color: var(--gold-start);
    background: var(--bg-tertiary);
}

.undo-redo-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.tree-editor-search {
    margin-bottom: 1rem;
}

.node-search-sidebar-input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: 'Inter', sans-serif;
}

.node-search-sidebar-input:focus {
    outline: none;
    border-color: var(--gold-start);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.tree-editor-nodes {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 1rem;
    padding-right: 0.25rem;
}

.sidebar-node-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.sidebar-node-item:hover {
    border-color: var(--gold-start);
    background: var(--bg-tertiary);
    transform: translateX(2px);
}

.sidebar-node-item.selected {
    background: var(--gold-start);
    color: white;
    border-color: var(--gold-start);
}

.sidebar-node-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.sidebar-node-item.drag-over {
    border-color: var(--gold-start);
    background: var(--bg-tertiary);
    border-style: dashed;
    border-width: 2px;
    transform: scale(1.02);
}

.sidebar-node-item {
    cursor: grab;
}

.sidebar-node-item:active {
    cursor: grabbing;
}

.node-icon {
    font-size: 1.1rem;
    min-width: 1.5rem;
    text-align: center;
}

.node-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tree-editor-add-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--gold-start);
    color: white;
    border: none;
    border-radius: 0.375rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.tree-editor-add-btn:hover {
    background: var(--gold-end);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.3);
}

.sidebar-edit-panel {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    background: var(--bg-secondary);
    border-radius: 0.375rem;
    padding: 1rem;
    margin-top: auto;
}

.edit-panel-header {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

.edit-panel-node-name {
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.edit-action-btn {
    width: 100%;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.edit-action-btn:hover {
    border-color: var(--gold-start);
    background: var(--bg-tertiary);
    transform: translateX(2px);
}

.edit-danger {
    color: #e74c3c;
}

.edit-danger:hover {
    background: rgba(231, 76, 60, 0.1);
    border-color: #e74c3c;
}

/* ===== FOOD PLAN - SANCTUARY AESTHETIC ===== */

.food-plan-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.plan-card {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    transition: border-color 0.3s ease;
}

.plan-card:hover {
    border-color: var(--gold-start);
}

.plan-header {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

/* CHIPS (Capsule Tags) */
.chip {
    display: inline-block;
    padding: 0.35rem 0.85rem;
    margin: 0.25rem;
    border-radius: 20px;
    font-size: 0.85rem;
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
}

/* Contextual Colors for Chips */
.plan-card.never .chip {
    color: var(--accent-positive);
    border-color: rgba(198, 93, 59, 0.2);
    background: rgba(198, 93, 59, 0.05);
}

.plan-card.always .chip {
    color: var(--accent-negative);
    border-color: rgba(95, 113, 97, 0.2);
    background: rgba(95, 113, 97, 0.05);
}

.food-items-list {
    min-height: 100px;
    margin-bottom: 0.75rem;
}

.food-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.food-item-content {
    flex: 1;
}

.food-item-name {
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.food-item-condition {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-style: italic;
}

.food-item-actions {
    display: flex;
    gap: 0.25rem;
}

.food-item-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.food-item-btn:hover {
    color: var(--text-primary);
}

.btn-add-item {
    width: 100%;
    padding: 0.5rem;
    background: none;
    border: 1px dashed var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.btn-add-item:hover {
    border-color: var(--gold-start);
    color: var(--gold-start);
    background: rgba(212, 175, 55, 0.05);
}

/* ===== THE EXCHANGE GRID (Formerly Deprivation Worksheets) ===== */

.exchange-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 1px;
    background: var(--border-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
    border-radius: 8px;
    margin-top: 1.5rem;
}

.exchange-quadrant {
    background: var(--bg-secondary);
    padding: 2rem;
    min-height: 180px;
}

.exchange-quadrant h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .exchange-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .exchange-quadrant {
        padding: 1.5rem;
        min-height: 150px;
    }
}

.deprivation-list {
    min-height: 150px;
    margin-bottom: 0.75rem;
}

.deprivation-item {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
}

.deprivation-text {
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.4;
}

.deprivation-actions {
    display: flex;
}

.deprivation-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.deprivation-btn:hover {
    color: var(--text-primary);
}

/* ===== PLEDGE CARD - SANCTUARY AESTHETIC ===== */

.pledge-card {
    background: var(--bg-secondary);
    border: 1px solid rgba(212, 175, 55, 0.3);
    padding: 3rem 2rem;
    margin: 0 0 3rem 0;
    text-align: center;
    position: relative;
    border-radius: 8px;
    box-shadow: 0 10px 30px -10px var(--shadow-light);
}

.pledge-card blockquote {
    font-family: 'Fraunces', Georgia, serif;
    font-size: 1.5rem;
    line-height: 1.6;
    color: var(--text-primary);
    border: none;
    margin: 0;
}

.pledge-card blockquote:empty::before {
    content: "Click 'Edit Pledge' to set your commitment...";
    color: var(--text-secondary);
    font-size: 1.125rem;
}

/* ===== PRICING/SUBSCRIPTION STYLES ===== */

.pricing-tiers {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

@media (min-width: 768px) {
    .pricing-tiers {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.5rem;
    }

    /* In modal, make cards 2x2 grid */
    .modal-body .pricing-tiers .pricing-card {
        flex: 1 1 calc(50% - 0.75rem);
        min-width: 280px;
    }

    /* In account panel, keep cards in a row */
    .panel-section .pricing-tiers .pricing-card {
        flex: 1;
        min-width: 200px;
    }
}

.pricing-card {
    flex: 1;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    position: relative;
    transition: all 0.3s ease;
}

.pricing-card:hover {
    box-shadow: 0 4px 12px var(--shadow-light);
    transform: translateY(-2px);
}

.pricing-card.premium {
    border-color: var(--gold-start);
    border-width: 2px;
}

.pricing-card.current-tier {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.05), rgba(255, 215, 0, 0.05));
    border-color: var(--gold-start);
    border-width: 2px;
}

.pricing-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(90deg, var(--gold-start), var(--gold-end));
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.pricing-header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.pricing-header h4 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    font-weight: normal;
}

.pricing-amount {
    font-size: 2rem;
    font-weight: bold;
    color: var(--gold-start);
}

.pricing-amount span {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: normal;
}

.pricing-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.pricing-features li {
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.pricing-features li::before {
    content: '';
    display: inline-block;
    width: 0.5rem;
    margin-right: 0.5rem;
}

.subscription-status {
    text-align: center;
    padding: 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
}

.subscription-status.free {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
}

.subscription-status.premium {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(255, 215, 0, 0.1));
    border: 1px solid var(--gold-start);
}

/* ===== SETTINGS GROUPS ===== */

.settings-group {
    margin-bottom: 2rem;
}

.settings-group h4 {
    font-size: 1.125rem;
    margin-bottom: 1rem;
    font-weight: normal;
}

.form-group {
    margin-bottom: 1rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
}

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

.toggle-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.4s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 4px;
    bottom: 4px;
    background-color: var(--bg-primary);
    transition: 0.4s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--gold-start);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.danger-section {
    border-color: #ff6b6b;
}

.danger-section h3 {
    color: #ff6b6b;
}

/* ===== BUTTONS ===== */

.btn-primary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(90deg, var(--gold-start), var(--gold-end));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: none;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    border-color: var(--gold-start);
    color: var(--gold-start);
}

.btn-danger {
    padding: 0.75rem 1.5rem;
    background: #dc3545;
    color: white;
    border: 1px solid #dc3545;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
    border-color: #c82333;
}

.btn-danger:disabled {
    cursor: not-allowed;
}

.btn-reset {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background: none;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
}

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

.tree-option-card:hover {
    border-color: var(--gold-start) !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.btn-signin-large {
    width: 100%;
    padding: 1rem 1.5rem;
    background: linear-gradient(90deg, var(--gold-start), var(--gold-end));
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 1.125rem;
    transition: all 0.3s ease;
}

.btn-signin-large:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px var(--shadow-medium);
}

/* ===== AI BUTTONS ===== */

/* AI sparkle button (for food/exercise estimation) */
.ai-btn {
    padding: 0.5rem 0.75rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: white;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 1.25rem;
    line-height: 1;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
    flex-shrink: 0;
}

.ai-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
}

.ai-btn:active {
    transform: translateY(0) scale(1);
}

/* AI close button (for modal headers) */
.ai-close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s;
    flex-shrink: 0;
}

.ai-close-btn:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* AI new conversation button */
.ai-new-conversation-btn {
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.ai-new-conversation-btn:hover {
    border-color: var(--gold-start);
    color: var(--gold-start);
    background: var(--bg-primary);
}

.ai-new-conversation-btn:active {
    transform: scale(0.98);
}

/* AI send button */
.ai-send-btn {
    padding: 0.5rem 1.5rem;
    background: linear-gradient(135deg, var(--gold-start) 0%, var(--gold-end) 100%);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    font-size: 0.875rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.2);
}

.ai-send-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
}

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

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

/* AI input footer layout */
.ai-input-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.ai-char-count {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Inter', sans-serif;
}

/* ===== MODAL UPDATES ===== */

.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: 2000;
    padding: 1rem;
}

/* Only apply overflow to modal-overlay modals (not food/exercise modals) */
.modal-overlay .modal-content {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-title {
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    font-weight: normal;
}

.modal-body {
    margin-bottom: 1.5rem;
}

.modal-buttons {
    display: flex;
    gap: 0.75rem;
}

.modal-buttons button {
    flex: 1;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */

@media (max-width: 767px) {
    #app-screen .app-title {
        display: none;
    }

    #calorie-user-info {
        position: fixed;
        top: 50px;
        left: 0;
        right: 0;
        z-index: 99;
        padding: 0.5rem 1rem;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
    }

    /* Stack food item action buttons vertically on mobile for more space */
    .food-item-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
}


/* ===== RADIO GROUPS ===== */

.radio-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.radio-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.radio-option:hover {
    border-color: var(--gold-start);
    background: rgba(212, 175, 55, 0.05);
}

.radio-option input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.radio-option input[type="radio"]:checked + span {
    color: var(--gold-start);
    font-weight: bold;
}

.radio-option span {
    flex: 1;
    font-size: 0.875rem;
}
/* ===== LOADING ANIMATION ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease-out;
}

.loading-screen.fade-out {
    opacity: 0;
    pointer-events: none;
}

.loading-hourglass {
    width: calc((100vh + 100vw) / 2);
    height: calc((100vh + 100vw) / 2);
    animation: hourglass-flip 1s ease-in-out;
}

@keyframes hourglass-flip {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(180deg);
    }
}

/* Default/Classic Theme Loading Screen */
.loading-screen {
    background: var(--bg-primary, #FAF9F6);
}

/* Midnight Temple Theme Loading Screen */
[data-theme="midnight"] .loading-screen {
    background: var(--bg-primary);
}

[data-theme="midnight"] .loading-hourglass {
    /* Transform black parts of emoji to gold */
    filter: brightness(0) saturate(100%) invert(58%) sepia(78%) saturate(450%) hue-rotate(5deg) brightness(95%) contrast(95%);
}

/* Golden Hour Theme Loading Screen */
[data-theme="golden-hour"] .loading-screen {
    background: var(--bg-primary);
}

[data-theme="golden-hour"] .loading-hourglass {
    /* Keep warm golden tones */
    filter: brightness(1.1) saturate(1.2);
}

/* ===== DECISION TREE ZOOM & PAN ===== */

.tree-desktop-view {
    position: relative;
}

#tree-mermaid-container {
    transform-origin: top left;
    transition: transform 0.2s ease;
    display: inline-block;
    padding: 2rem;
}

/* Enable text wrapping in Mermaid nodes */
#tree-mermaid-container .node rect,
#tree-mermaid-container .node circle,
#tree-mermaid-container .node polygon,
#tree-mermaid-container .node ellipse {
    /* Allow nodes to expand as needed */
}

#tree-mermaid-container .node .nodeLabel,
#tree-mermaid-container .edgeLabel {
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    max-width: 200px;
    display: inline-block;
    text-align: center;
}

/* =============================================================================
   MULTI-TIER SUBSCRIPTION STYLES
   ============================================================================= */

/* Subscription Box */
.subscription-box {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.subscription-status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.subscription-status-text {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--gold-start);
    flex: 1;
}

.subscription-billing-info {
    color: var(--text-secondary);
    font-size: 0.875rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.subscription-account-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* Small Button */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Plan Selection Grid */
.plan-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

@media (max-width: 768px) {
    .plan-selection-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .plan-selection-grid {
        grid-template-columns: 1fr;
    }
}

/* Tier Card */
.tier-card {
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.tier-card:hover {
    border-color: var(--gold-start);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.2);
}

.tier-card.current {
    border-color: var(--gold-start);
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.1), rgba(255, 215, 0, 0.1));
}

.tier-card.popular {
    border-color: var(--gold-start);
}

.tier-badge {
    position: absolute;
    top: -10px;
    right: 10px;
    background: var(--gold-start);
    color: var(--bg-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.tier-header {
    text-align: center;
    margin-bottom: 1rem;
}

.tier-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.tier-price {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--gold-start);
}

.tier-price-period {
    font-size: 0.875rem;
    font-weight: 400;
    color: var(--text-secondary);
}

.tier-features {
    list-style: none;
    padding: 0;
    margin: 1rem 0;
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.8;
}

.tier-features li {
    margin-bottom: 0.5rem;
}

.tier-button {
    width: 100%;
    padding: 0.75rem;
    margin-top: 1rem;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .subscription-status-row,
    .subscription-account-row {
        flex-direction: column;
        align-items: stretch;
    }

    .subscription-status-row button,
    .subscription-account-row button {
        width: 100%;
    }

    .subscription-status-text {
        text-align: center;
    }

    #user-email-display {
        text-align: center;
    }
}

#plan-selection-modal .modal-body {
    overflow-y: auto;
    max-height: 70vh; /* 70% of the viewport height */
}
