/* === FitFocus — Тёмно-фиолетовая тема === */

:root {
    --bg-primary: #0f0e1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #252547;
    --bg-card-hover: #2e2e5a;
    --accent: #7c3aed;
    --accent-light: #a78bfa;
    --accent-gradient: linear-gradient(135deg, #7c3aed, #ec4899);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-hint: #6b6b8a;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --border-radius: 16px;
    --border-radius-sm: 12px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* === Экраны === */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    max-width: 480px;
    margin: 0 auto;
}
.screen.active { display: block; }

/* === Лендинг === */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 40px 0;
}
.landing-logo {
    font-size: 42px;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
}
.landing-title {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 32px;
}
.landing-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 40px;
    width: 100%;
}
.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-card);
    padding: 16px 20px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
}
.feature-icon { font-size: 24px; }
.landing-note {
    margin-top: 16px;
    color: var(--text-hint);
    font-size: 14px;
}

/* === Кнопки === */
.btn-primary {
    background: var(--accent-gradient);
    color: white;
    border: none;
    padding: 16px 32px;
    border-radius: var(--border-radius-sm);
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    transition: opacity 0.2s, transform 0.1s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}
.btn-lg { padding: 18px 32px; font-size: 18px; }
.btn-secondary {
    background: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid rgba(124, 58, 237, 0.3);
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
}
.btn-secondary:active { background: var(--bg-card-hover); }
.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid var(--danger);
    padding: 14px 24px;
    border-radius: var(--border-radius-sm);
    font-size: 16px;
    cursor: pointer;
    width: 100%;
}
.btn-back {
    background: var(--bg-card);
    color: var(--text-primary);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* === Прогресс-бар === */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-card);
    border-radius: 3px;
    margin-bottom: 8px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: var(--accent-gradient);
    border-radius: 3px;
    transition: width 0.3s ease;
    width: 10%;
}
.step-counter {
    color: var(--text-hint);
    font-size: 14px;
    margin-bottom: 24px;
}

/* === Шаги анкеты === */
.step { animation: fadeIn 0.3s ease; }
.step h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}
.step-desc {
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}
.option-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.option-card:active,
.option-card.selected {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.option-icon { font-size: 36px; }

.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}
.option-card-wide {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}
.option-card-wide:active,
.option-card-wide.selected {
    border-color: var(--accent);
    background: var(--bg-card-hover);
}
.option-card-wide .option-icon { font-size: 28px; }
.option-card-wide strong { font-size: 16px; }
.option-desc {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 2px;
}

/* === Поля ввода === */
.input-group { margin-bottom: 24px; }
.input-field {
    width: 100%;
    background: var(--bg-card);
    border: 2px solid rgba(124, 58, 237, 0.2);
    border-radius: var(--border-radius-sm);
    padding: 16px 20px;
    font-size: 20px;
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}
.input-field:focus { border-color: var(--accent); }
.input-field::placeholder { color: var(--text-hint); }
.input-hint {
    display: block;
    color: var(--text-hint);
    font-size: 13px;
    margin-top: 8px;
}

/* === Чекбокс === */
.checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 20px 0;
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
}
.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    min-width: 20px;
    margin-top: 2px;
    accent-color: var(--accent);
}
.checkbox-label a {
    color: var(--accent-light);
    text-decoration: underline;
}

/* === Результаты === */
.results {
    padding-top: 40px;
    animation: fadeIn 0.5s ease;
}
.results-title {
    text-align: center;
    font-size: 22px;
    margin-bottom: 24px;
}
.calories-card {
    background: var(--accent-gradient);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.calories-number {
    font-size: 56px;
    font-weight: 800;
}
.calories-label {
    font-size: 16px;
    opacity: 0.9;
    margin-top: 4px;
}
.macros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}
.macro-card {
    background: var(--bg-card);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    text-align: center;
}
.macro-value {
    font-size: 28px;
    font-weight: 700;
}
.macro-label {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* === ИМТ === */
.bmi-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
}
.bmi-card h3 {
    font-size: 16px;
    margin-bottom: 16px;
    color: var(--text-secondary);
}
.bmi-scale {
    position: relative;
    margin-bottom: 12px;
}
.bmi-bar {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    height: 28px;
}
.bmi-segment {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    color: rgba(255,255,255,0.8);
}
.bmi-segment.deficit { background: #3b82f6; }
.bmi-segment.normal { background: #10b981; }
.bmi-segment.overweight { background: #f59e0b; }
.bmi-segment.obese { background: #ef4444; }
.bmi-marker {
    position: absolute;
    top: -6px;
    width: 4px;
    height: 40px;
    background: white;
    border-radius: 2px;
    transition: left 0.5s ease;
    box-shadow: 0 0 8px rgba(255,255,255,0.5);
}
.bmi-value {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

/* === Прогноз === */
.forecast-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
}
.forecast-card h3 {
    color: var(--text-secondary);
    font-size: 16px;
    margin-bottom: 8px;
}
.forecast-card p {
    font-size: 16px;
    line-height: 1.5;
}

/* === Меню === */
.menu-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}
.menu-header h1 { font-size: 22px; }

.meal-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 12px;
}
.meal-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}
.meal-type {
    font-size: 14px;
    color: var(--accent-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.meal-kcal {
    font-size: 14px;
    color: var(--text-secondary);
}
.meal-name {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
}
.meal-ingredients {
    list-style: none;
    margin-bottom: 12px;
}
.meal-ingredients li {
    padding: 6px 0;
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.meal-ingredients li:last-child { border-bottom: none; }
.ing-name { flex: 1; }
.ing-grams { color: var(--text-primary); font-weight: 500; }
.meal-macros {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: var(--text-hint);
    margin-bottom: 12px;
}
.meal-cooking {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 12px;
    background: rgba(124, 58, 237, 0.1);
    border-radius: 8px;
    margin-bottom: 12px;
}
.btn-replace {
    background: transparent;
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: var(--accent-light);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
}
.btn-replace:active { background: rgba(124, 58, 237, 0.15); }

.menu-totals {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
}
.totals-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}
.totals-row.target { color: var(--text-hint); }

/* === Главная === */
.home-page { padding-top: 20px; }
.home-header { margin-bottom: 20px; }
.home-greeting {
    font-size: 24px;
    font-weight: 700;
}
.home-kbzu-card {
    background: var(--accent-gradient);
    border-radius: var(--border-radius);
    padding: 24px;
    text-align: center;
    margin-bottom: 16px;
}
.home-calories {
    font-size: 36px;
    font-weight: 800;
}
.home-macros {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 8px;
    font-size: 15px;
    opacity: 0.9;
}
.tip-card {
    background: var(--bg-card);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
}
.tip-label {
    color: var(--accent-light);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.tip-card p {
    font-size: 15px;
    line-height: 1.5;
    color: var(--text-secondary);
}
.home-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.home-actions .btn-secondary { width: 50%; }

/* === Профиль === */
.profile-page { padding-top: 20px; }
.profile-row {
    display: flex;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 15px;
}
.profile-row .label { color: var(--text-secondary); }
.profile-row .value { font-weight: 500; }
.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

/* === Модалка === */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    padding: 20px;
}
.modal-content {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 24px;
    width: 100%;
    max-width: 360px;
}
.modal-content h3 {
    margin-bottom: 16px;
    font-size: 20px;
}
.modal-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}
.modal-actions .btn-secondary,
.modal-actions .btn-primary { width: 50%; }

/* === Анимации === */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* === Загрузка === */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-card);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
