/* =========================================
   Zyra A.I Diet Planner - Custom Styles
   Premium Dark Theme, Mobile-First
========================================= */

:root {
    --bg-main: #ffffff;
    --card-bg: #f8fafc;
    --primary: #064e3b; /* Dark Green */
    --primary-hover: #047857;
    --secondary: #10b981; /* Bright Green */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border-color: #e2e8f0;
    --nav-bg: rgba(255, 255, 255, 0.95);
    --error: #ef4444;
    --success: #10b981;
    --app-desktop-bg: #f1f5f9;
}

body.dark-theme {
    --bg-main: #0f172a;
    --card-bg: #1e293b;
    --primary: #10b981; /* Lighter green for visibility */
    --primary-hover: #059669;
    --secondary: #34d399;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --nav-bg: rgba(30, 41, 59, 0.95);
    --app-desktop-bg: #000000;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--app-desktop-bg);
    color: var(--text-main);
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

/* Desktop Background */
.desktop-bg {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: radial-gradient(circle at center, #1e1b4b 0%, #000000 100%);
    z-index: -1;
    display: none;
}

@media (min-width: 600px) {
    .desktop-bg { display: block; }
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
    }
}

/* Mobile Wrapper */
.mobile-wrapper {
    background-color: var(--bg-main);
    width: 100%;
    max-width: 480px;
    height: 100vh; /* Fallback for older browsers */
    height: 100dvh; /* Modern dynamic viewport height */
    position: relative;
    overflow: hidden; /* Hide outer scroll to let app-content scroll */
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
}

@media (min-width: 600px) {
    .mobile-wrapper {
        min-height: 850px;
        height: 90vh;
        border-radius: 40px;
        border: 8px solid #334155;
        overflow-y: scroll;
        /* Hide scrollbar for cleaner look */
        scrollbar-width: none; 
    }
    .mobile-wrapper::-webkit-scrollbar { display: none; }
}

/* Header */
.app-header {
    padding: 1.5rem 1.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(128,128,128,0.1);
    position: absolute;
    top: 0; left: 0; width: 100%;
    z-index: 100;
    background: var(--bg-main);
}

.logo-container img {
    height: 40px;
    border-radius: 10px;
}

.header-text h1 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.header-text p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Steps System */
.app-content {
    height: 100%;
    overflow-y: auto;
    padding: 1.5rem;
    padding-top: 100px; /* Make room for absolute header */
    padding-bottom: 100px; /* Make room for absolute nav */
    /* Hide scrollbar for cleaner look */
    scrollbar-width: none;
}
.app-content::-webkit-scrollbar { display: none; }

.step-view {
    display: none;
    animation: slideUpFade 0.4s ease forwards;
}

.step-view.active {
    display: block;
}

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

.step-icon {
    width: 60px;
    height: 60px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--primary);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
}

.step-card h2 {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

/* Forms & Inputs */
.premium-input {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0.8rem 1rem;
}

.premium-input:focus {
    background-color: var(--card-bg);
    border-color: var(--primary);
    color: var(--text-main);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.form-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.error-msg {
    color: var(--error);
    font-size: 0.8rem;
    margin-top: 5px;
    display: none;
}

/* Buttons */
.premium-btn {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 12px;
    font-weight: 600;
    padding: 1rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

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

.premium-btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 12px;
    font-weight: 600;
}

.premium-btn-outline:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
}

/* Custom Radio / Selection Cards */
.gender-card input, .diet-card input {
    display: none;
}

.gender-card .card-content, .diet-card .card-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.gender-card input:checked + .card-content,
.diet-card input:checked + .card-content {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}

.gender-card i {
    font-size: 1.5rem;
    color: var(--text-muted);
}

.gender-card input:checked + .card-content i {
    color: var(--primary);
}

.diet-card {
    display: block;
}

.diet-card .card-content {
    flex-direction: row;
    padding: 1rem;
    justify-content: flex-start;
}

/* Goal Buttons */
.premium-goal-btn {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    text-align: left;
    color: var(--text-main);
    width: 100%;
    transition: all 0.3s;
}

.premium-goal-btn:hover {
    border-color: rgba(255,255,255,0.2);
    background: #253347;
}

.goal-icon {
    width: 50px; height: 50px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem;
    margin-right: 1rem;
}

.goal-icon.lose { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.goal-icon.gain { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.goal-text h3 { font-size: 1.1rem; font-weight: 700; margin: 0; }
.goal-text p { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

/* Meal Grid (Checkbox Cards) */
.meal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.meal-item input { display: none; }
.meal-item .card-content {
    background: var(--card-bg);
    border: 2px solid var(--border-color);
    border-radius: 12px;
    padding: 1rem;
    cursor: pointer;
    text-align: center;
    transition: 0.2s;
    height: 100%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.meal-item input:checked + .card-content {
    border-color: var(--primary);
    background: rgba(16, 185, 129, 0.1);
}
.meal-img {
    font-size: 2rem;
    margin-bottom: 10px;
}
.meal-name {
    font-weight: 600;
    font-size: 0.9rem;
}

/* AI Loading Screen */
.ai-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 60vh;
    text-align: center;
}

.ai-orb {
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--secondary), var(--primary));
    border-radius: 50%;
    box-shadow: 0 0 50px var(--secondary);
    animation: orbFloat 3s ease-in-out infinite, pulseGlow 2s infinite;
    position: relative;
    z-index: 2;
}

.ai-pulse {
    position: absolute;
    width: 100px; height: 100px;
    background: rgba(16, 185, 129, 0.5);
    border-radius: 50%;
    animation: ripple 2s linear infinite;
    z-index: 1;
}

.delay-1 { animation-delay: 0.6s; }
.delay-2 { animation-delay: 1.2s; }

@keyframes orbFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 30px var(--secondary); }
    50% { box-shadow: 0 0 60px var(--secondary), 0 0 100px var(--primary); }
}

@keyframes ripple {
    0% { transform: scale(1); opacity: 1; }
    100% { transform: scale(3); opacity: 0; }
}

.gradient-text {
    background: linear-gradient(to right, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-weight: 700;
}

.ai-status-text {
    min-height: 24px;
}

.custom-progress {
    width: 80%;
    height: 8px;
    background-color: var(--card-bg);
    border-radius: 10px;
}

/* Result Screen */
.metric-summary {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 1.5rem;
    border: 1px solid var(--border-color);
}

.divider-vertical {
    width: 1px;
    background: var(--border-color);
}

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

/* Timeline */
.timeline {
    border-left: 2px solid var(--border-color);
    padding-left: 20px;
    margin-left: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 10px var(--primary);
}

.timeline-item .time {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
    margin-bottom: 5px;
}

.timeline-item h5 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 3px;
}

.timeline-item p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

/* Diet Plan Cards */
.meal-plan-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 10px;
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 15px;
}

.meal-plan-card .meal-time {
    background: rgba(255,255,255,0.05);
    padding: 10px;
    border-radius: 10px;
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    min-width: 70px;
}

.meal-plan-card h5 {
    font-size: 1rem;
    margin-bottom: 2px;
}
.meal-plan-card p {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0;
}

/* Bottom Nav */
.bottom-nav {
    position: absolute; /* Relative to mobile wrapper */
    bottom: 0;
    left: 0;
    width: 100%;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(128,128,128,0.1);
    display: flex;
    justify-content: space-around;
    padding: 10px 0 20px 0; /* extra padding for iPhone safe area could be added via env(safe-area-inset-bottom) */
    z-index: 100;
    border-bottom-left-radius: inherit;
    border-bottom-right-radius: inherit;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.75rem;
    gap: 4px;
    transition: color 0.3s;
}

.nav-item i {
    font-size: 1.4rem;
}

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

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

.ai-nav-btn {
    transform: translateY(-20px);
}

.ai-icon-wrapper {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--secondary), var(--primary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px rgba(16, 185, 129, 0.4);
    margin-bottom: 2px;
}

.ai-nav-btn i {
    color: white !important;
    font-size: 1.5rem;
}
.ai-nav-btn.active .ai-icon-wrapper {
    box-shadow: 0 5px 25px rgba(16, 185, 129, 0.8);
}
