/* === KineApp — AI Фитнес-тренер: Mobile-first CSS === */

/* --- CSS Variables --- */
:root {
    /* Colors — Nature + Health palette */
    --bg-primary: #f8faf8;
    --bg-secondary: #f0f5f1;
    --bg-card: #ffffff;
    --bg-input: #f0f5f1;
    --bg-hover: #e7f0e9;

    --text-primary: #1a2e1d;
    --text-secondary: #4a664d;
    --text-muted: #7d9a80;

    --accent: #22c55e;
    --accent-light: #4ade80;
    --accent-dark: #16a34a;
    --accent-glow: rgba(34, 197, 94, 0.25);

    --gradient-primary: linear-gradient(135deg, #22c55e 0%, #14b8a6 50%, #0ea5e9 100%);
    --gradient-soft: linear-gradient(135deg, #d4f5e9 0%, #c7f0ff 50%, #ede9fe 100%);
    --gradient-card: linear-gradient(135deg, #f0fdf4 0%, #f0fdfa 100%);

    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;

    --border: #dce8dd;
    --border-light: #e8f0e9;

    /* Trainers */
    --trainer-vika: #e84393;
    --trainer-max: #0984e3;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(26, 46, 29, 0.06);
    --shadow-card: 0 2px 12px rgba(26, 46, 29, 0.07);
    --shadow-elevated: 0 8px 32px rgba(26, 46, 29, 0.10);
    --shadow-glow: 0 0 40px rgba(34, 197, 94, 0.15);

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

    --tab-height: 64px;
    --header-height: 56px;

    /* Layout */
    --max-width: 480px;
    --landing-max-width: 1100px;

    /* Typography */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 20px;
    --font-size-xl: 28px;
    --font-size-2xl: 36px;
    --font-size-hero: 48px;

    /* Animation */
    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
    --transition-slow: 400ms ease;
}

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

html, body {
    height: 100dvh;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

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

a {
    color: var(--accent-dark);
    text-decoration: none;
}

/* --- Utility --- */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 16px;
}

.hidden {
    display: none !important;
}

/* ============================================
   LANDING PAGE
   ============================================ */

.landing-page {
    min-height: 100dvh;
    background: var(--bg-primary);
    overflow-x: hidden;
}

/* --- Decorative background blobs --- */
.landing-page::before {
    content: '';
    position: fixed;
    top: -30%;
    left: -20%;
    width: 80vw;
    height: 80vw;
    max-width: 800px;
    max-height: 800px;
    background: radial-gradient(circle, rgba(212, 245, 233, 0.6) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

.landing-page::after {
    content: '';
    position: fixed;
    bottom: -20%;
    right: -15%;
    width: 70vw;
    height: 70vw;
    max-width: 700px;
    max-height: 700px;
    background: radial-gradient(circle, rgba(237, 233, 254, 0.5) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* --- Site Header (shared) --- */
.site-header {
    display: flex;
    justify-content: center;
    min-height: var(--header-height);
    padding-top: env(safe-area-inset-top, 0px);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-light);
}

.site-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: var(--landing-max-width);
    padding: 0 20px;
}

.site-logo {
    font-size: 24px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.5px;
    text-decoration: none;
}

.site-logo:hover {
    opacity: 0.85;
}

/* --- Hero Section --- */
.landing-hero {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 48px;
    padding: 80px 32px;
    max-width: var(--landing-max-width);
    margin: 0 auto;
    min-height: 85dvh;
}

.hero-content {
    flex: 1 1 55%;
    max-width: 580px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-full);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 28px;
    animation: fadeInUp 0.6s ease;
}

.hero-badge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero-title {
    font-size: var(--font-size-hero);
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: 20px;
    letter-spacing: -1.5px;
    animation: fadeInUp 0.6s ease 0.1s both;
}

.hero-title-gradient {
    background: linear-gradient(135deg, #16a34a 0%, #0d9488 40%, #0284c7 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 36px;
    animation: fadeInUp 0.6s ease 0.2s both;
}

.hero-cta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    animation: fadeInUp 0.6s ease 0.3s both;
}

/* Hero image */
.hero-image {
    flex: 1 1 45%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeInUp 0.6s ease 0.4s both;
}

.hero-img {
    width: 100%;
    max-width: 500px;
    height: auto;
    border-radius: var(--radius-xl);
}

/* Placeholder на случай отсутствия картинки */
.hero-image:has(img[src=""]) .hero-img,
.hero-image .hero-img[src="/static/hero.png"]:not([src]) {
    display: none;
}

.hero-image:has(img[src=""])::after,
.hero-image:has(img:not([src]))::after {
    content: '';
    width: 100%;
    max-width: 500px;
    aspect-ratio: 4/3;
    background: var(--gradient-soft);
    border-radius: var(--radius-xl);
    border: 2px dashed var(--border);
}

/* --- Section common --- */
.landing-section {
    position: relative;
    z-index: 1;
    padding: 80px 24px;
    max-width: var(--landing-max-width);
    margin: 0 auto;
}

.landing-section-alt {
    background: var(--bg-secondary);
}

.section-label {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--accent-dark);
    margin-bottom: 12px;
}

.section-title {
    font-size: var(--font-size-2xl);
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 40px;
}

/* --- Trainers Section --- */
.trainer-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.trainer-card {
    display: flex;
    align-items: stretch;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
    transition: all var(--transition-normal);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    min-height: 160px;
}

.trainer-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-elevated);
    border-color: transparent;
}

.trainer-card.vika:hover {
    border-color: rgba(232, 67, 147, 0.3);
}

.trainer-card.max:hover {
    border-color: rgba(9, 132, 227, 0.3);
}

.trainer-photo {
    width: 40%;
    min-width: 130px;
    object-fit: cover;
    flex-shrink: 0;
}

.trainer-info {
    padding: 24px 24px 24px 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.trainer-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 4px;
}

.trainer-bio {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- How It Works Section --- */
.steps-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.step-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    text-align: center;
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.step-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-card);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 16px;
}

.step-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    margin-bottom: 8px;
}

.step-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- Advantages Section --- */
.advantages-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.advantage-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.advantage-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.advantage-icon {
    font-size: 32px;
    margin-bottom: 12px;
}

.advantage-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    margin-bottom: 6px;
}

.advantage-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.5;
}

/* --- SEO Section --- */
.seo-text {
    max-width: 720px;
    margin: 0 auto;
    font-size: var(--font-size-md);
    color: var(--text-secondary);
    line-height: 1.8;
}

.seo-text h3 {
    font-size: var(--font-size-lg);
    font-weight: 700;
    color: var(--text-primary);
    margin: 24px 0 12px;
}

.seo-text h3:first-child {
    margin-top: 0;
}

.seo-text p {
    margin-bottom: 12px;
}

/* --- Landing CTA --- */
.landing-cta-section {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 80px 24px;
    max-width: 700px;
    margin: 0 auto;
}

.cta-card {
    background: var(--gradient-primary);
    border-radius: var(--radius-xl);
    padding: 48px 32px;
    color: #fff;
    box-shadow: 0 16px 48px rgba(34, 197, 94, 0.3);
}

.cta-card .section-title {
    color: #fff;
}

.cta-card .section-subtitle {
    color: rgba(255, 255, 255, 0.85);
}

/* --- Landing Footer --- */
.landing-footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 24px;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    border-top: 1px solid var(--border);
}

/* --- Animation keyframes --- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

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

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
    box-shadow: 0 6px 28px rgba(34, 197, 94, 0.35);
    transform: translateY(-1px);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 10px 20px;
    font-size: var(--font-size-sm);
}

.btn-lg {
    padding: 18px 36px;
    font-size: var(--font-size-md);
}

.btn-outline {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
    border-color: var(--accent);
    background: var(--bg-hover);
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

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

/* ============================================
   APP SHELL (основное приложение — светлая тема)
   ============================================ */

.app-shell {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    max-width: var(--max-width);
    margin: 0 auto;
    width: 100%;
    position: relative;
    background: var(--bg-primary);
}

.app-header-trainer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.app-header-trainer .trainer-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

/* --- Update Banner (PWA) --- */
.update-banner {
    padding: 8px 16px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    animation: fadeIn 0.3s ease;
    box-shadow: 0 2px 12px var(--accent-glow);
    transition: all var(--transition-fast);
}

.update-banner:active {
    transform: scale(0.95);
}

.app-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: calc(var(--tab-height) + env(safe-area-inset-bottom, 0px) + 16px);
}

/* Чат сам управляет своей высотой — отступ под таб-бар не нужен */
.app-content--chat {
    padding-bottom: 0;
    overflow-y: hidden;
    display: flex;
    flex-direction: column;
}

/* --- Tab Bar --- */
.tab-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: var(--max-width);
    height: var(--tab-height);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border-light);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    cursor: pointer;
    transition: color var(--transition-fast);
    padding: 8px 0;
}

.tab-btn.active {
    color: var(--accent-dark);
}

.tab-btn .tab-icon {
    font-size: 22px;
    line-height: 1;
}

.tab-btn .tab-label {
    font-size: 10px;
    font-weight: 500;
}

/* --- Auth Page --- */
.auth-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 24px 48px;
    background: var(--bg-primary);
}

.auth-card {
    width: 100%;
    max-width: 360px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-card);
}

.auth-logo {
    font-size: 32px;
    font-weight: 800;
    text-align: center;
    margin-bottom: 8px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
}

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

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

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.form-error {
    color: var(--danger);
    font-size: var(--font-size-xs);
    margin-top: 4px;
    min-height: 18px;
}

.form-hint {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    margin-top: 4px;
}

/* --- Onboarding --- */
.onboarding-page {
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
}

.onboarding-title {
    text-align: center;
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text-primary);
}

.onboarding-progress {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-bottom: 32px;
}

.progress-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: all var(--transition-normal);
}

.progress-dot.completed {
    background: var(--success);
}

.progress-dot.active {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent-glow);
    transform: scale(1.3);
}

.onboarding-step {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.onboarding-step-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: 8px;
}

.onboarding-step-desc {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    margin-bottom: 24px;
    line-height: 1.5;
}

.onboarding-textarea {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-md);
    resize: vertical;
    outline: none;
    transition: border-color var(--transition-fast);
    line-height: 1.6;
}

.onboarding-textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.onboarding-textarea::placeholder {
    color: var(--text-muted);
}

.onboarding-nav {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 24px;
}

/* Trainer Selection */
.trainer-select {
    display: flex;
    gap: 16px;
    margin-bottom: 24px;
}

.trainer-option {
    flex: 1;
    background: var(--bg-card);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-xl);
    padding: 24px 16px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.trainer-option:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.trainer-option.selected {
    border-color: var(--accent);
    background: var(--gradient-card);
    box-shadow: 0 0 20px var(--accent-glow);
}

.trainer-option-img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
}

.trainer-option-name {
    font-size: var(--font-size-md);
    font-weight: 700;
    margin-bottom: 4px;
}

.trainer-option-desc {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    line-height: 1.4;
}

.onboarding-loader {
    text-align: center;
    padding: 48px 24px;
}

.loader-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

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

.loader-text {
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
}

/* --- Chat --- */
.chat-wrapper {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    position: relative;
    background-size: cover;
    background-position: center top;
    background-repeat: no-repeat;
    background-color: var(--bg-primary);
}

/* Полупрозрачный оверлей поверх фона для читаемости */
.chat-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

.chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 1;
    background: transparent;
}

.chat-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.chat-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.chat-empty-text {
    font-size: var(--font-size-sm);
    line-height: 1.5;
}

.message {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
}

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

.message.user {
    align-self: flex-end;
}

.message.trainer {
    align-self: flex-start;
}

.message-bubble {
    padding: 12px 16px;
    border-radius: var(--radius-lg);
    font-size: var(--font-size-sm);
    line-height: 1.5;
    word-break: break-word;
    white-space: pre-wrap;
    position: relative;
}

.message-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    opacity: 0.9;
    z-index: -1;
}

.message.user .message-bubble {
    color: #fff;
    border-bottom-right-radius: 4px;
}

.message.user .message-bubble::before {
    background: var(--gradient-primary);
    border-bottom-right-radius: 4px;
}

.message.trainer .message-bubble {
    border-bottom-left-radius: 4px;
}

.message.trainer .message-bubble::before {
    background: var(--bg-secondary);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    padding: 0 4px;
}

.message.user .message-time {
    text-align: right;
}

.chat-input-area {
    flex-shrink: 0;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    margin-bottom: var(--tab-height);
    background: var(--bg-primary);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 8px;
    position: relative;
    z-index: 1;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
    outline: none;
    transition: border-color var(--transition-fast);
    resize: none;
    max-height: 120px;
    line-height: 1.4;
}

.chat-input:focus {
    border-color: var(--accent);
}

.chat-send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all var(--transition-fast);
    box-shadow: 0 2px 12px var(--accent-glow);
}

.chat-send-btn:active {
    transform: scale(0.92);
}

.chat-send-btn:disabled {
    opacity: 0.5;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 8px 16px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-6px); opacity: 1; }
}

.chat-load-more {
    text-align: center;
    padding: 12px;
}

/* --- Diet --- */
.diet-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-light);
    margin: 16px;
}

.diet-tab {
    flex: 1;
    padding: 12px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
}

.diet-tab.active {
    color: var(--accent-dark);
    border-bottom-color: var(--accent);
}

/* --- Recipe Blocks --- */
.recipe-block {
    margin: 0 16px 24px;
}

.recipe-block-title {
    font-size: var(--font-size-md);
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 10px;
    padding-left: 4px;
}

.recipe-block-empty {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-style: italic;
    padding: 8px 4px;
}

/* --- Recipe Card --- */
.recipe-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    overflow: hidden;
}

.recipe-card:active {
    background: var(--bg-hover);
}

.recipe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
}

.recipe-card-name {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

.recipe-card-arrow {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
    margin-left: 8px;
}

.recipe-card.expanded .recipe-card-arrow {
    transform: rotate(90deg);
}

/* --- Recipe Card Body (hidden by default) --- */
.recipe-card-body {
    display: none;
    padding: 0 16px 14px;
    border-top: 1px solid var(--border-light);
}

.recipe-card.expanded .recipe-card-body {
    display: block;
}

.recipe-card-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 12px 0;
    border-bottom: 1px dashed var(--border-light);
    margin-bottom: 8px;
}

.recipe-card-empty {
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    font-style: italic;
    padding: 10px 0;
}

.recipe-items {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px 0;
}

.recipe-item {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    padding: 6px 8px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
}

/* --- Food Lists --- */
.food-list {
    margin: 0 16px;
}

.food-list-section {
    margin-bottom: 20px;
}

.food-list-title {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.food-list-title .icon-allowed { color: var(--success); }
.food-list-title .icon-forbidden { color: var(--danger); }

.food-tag {
    display: inline-block;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    margin: 3px;
}

.food-tag.allowed { border-color: var(--success); color: var(--success); background: rgba(34, 197, 94, 0.05); }
.food-tag.forbidden { border-color: var(--danger); color: var(--danger); background: rgba(239, 68, 68, 0.05); }

.diet-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
    line-height: 1.6;
}

/* --- Training --- */
.training-date-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 16px;
}

.date-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    color: var(--text-primary);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.date-nav-btn:active {
    background: var(--bg-hover);
}

.date-nav-current {
    font-size: var(--font-size-md);
    font-weight: 600;
    min-width: 120px;
    text-align: center;
}

.training-session {
    margin: 0 16px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-light);
}

.session-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.session-start-btn {
    padding: 6px 14px;
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

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

.exercise-group {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
}

.exercise-group:last-child {
    border-bottom: none;
}

.exercise-group-title {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.exercise-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

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

.exercise-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.exercise-params {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.exercise-play {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--accent-dark);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.training-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.training-empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

/* Warmup section */
.warmup-section {
    margin: 0 16px 16px;
}

.warmup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.warmup-title {
    font-size: var(--font-size-md);
    font-weight: 600;
}

.warmup-frequency {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.warmup-exercise {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 8px;
    box-shadow: var(--shadow-sm);
}

.warmup-exercise-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.warmup-exercise-info {
    flex: 1;
}

.warmup-exercise-name {
    font-size: var(--font-size-sm);
    font-weight: 500;
}

.warmup-exercise-duration {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

/* --- Timer Modal --- */
.timer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 46, 29, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.timer-modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    padding: 28px 24px;
    text-align: center;
    width: 90%;
    max-width: 360px;
    max-height: 85dvh;
    overflow-y: auto;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-elevated);
}

.timer-phase {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 6px;
}

.timer-exercise-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 8px;
}

.timer-params {
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 12px;
}

.timer-desc {
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    line-height: 1.5;
    text-align: left;
    margin-bottom: 12px;
    white-space: pre-line;
}

.timer-coach {
    font-size: var(--font-size-xs);
    color: var(--text-primary);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    text-align: left;
    line-height: 1.5;
    margin-bottom: 16px;
}

.timer-display {
    font-size: 64px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 8px;
}

/* Подготовка — оранжевый */
.timer-display.prepare {
    color: var(--warning);
    -webkit-text-fill-color: var(--warning);
}

/* Выполнение с таймером — зелёный градиент */
.timer-display.work {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Отдых — зелёный */
.timer-display.rest {
    color: var(--success);
    -webkit-text-fill-color: var(--success);
}

.timer-next {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
    margin-bottom: 20px;
    min-height: 18px;
}

.timer-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.timer-btn {
    padding: 12px 24px;
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: var(--font-size-sm);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.timer-btn.skip {
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.timer-btn.complete {
    background: var(--warning);
    color: #fff;
}

.timer-btn.done {
    background: var(--gradient-primary);
    color: #fff;
}

/* --- Exercise Detail Modal --- */
.exercise-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 46, 29, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: flex-end;
    z-index: 200;
    animation: fadeIn 0.2s ease;
}

.exercise-detail-modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: 24px;
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    max-height: 80dvh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

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

.exercise-detail-close {
    float: right;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-hover);
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-detail-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
    margin-bottom: 12px;
}

.exercise-detail-params {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--accent-dark);
    margin-bottom: 16px;
}

.exercise-detail-desc {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: 1.6;
    white-space: pre-line;
}

.exercise-detail-coach {
    margin-top: 16px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
}

.exercise-detail-coach-label {
    font-size: var(--font-size-xs);
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.exercise-detail-coach-text {
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    line-height: 1.5;
}

/* --- App Footer --- */
.app-footer {
    display: flex;
    justify-content: center;
    padding: 16px;
    color: var(--text-muted);
    font-size: var(--font-size-xs);
    border-top: 1px solid var(--border-light);
    background: var(--bg-primary);
}

.app-footer span {
    max-width: var(--max-width);
    width: 100%;
    text-align: center;
    padding: 0 16px;
}
.profile-section {
    padding: 16px;
}

.profile-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.profile-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.profile-avatar-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}

.profile-name {
    font-size: var(--font-size-lg);
    font-weight: 700;
}

.profile-email {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.profile-field {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-light);
}

.profile-field:last-child {
    border-bottom: none;
}

.profile-field-label {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
}

.profile-field-value {
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-align: right;
    max-width: 60%;
}

.profile-trainer {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
    margin-bottom: 16px;
}

.profile-trainer-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent);
}

.profile-trainer-info {
    flex: 1;
}

.profile-trainer-name {
    font-weight: 600;
    font-size: var(--font-size-sm);
}

.profile-trainer-bio {
    font-size: var(--font-size-xs);
    color: var(--text-muted);
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.change-trainer-section {
    margin-bottom: 16px;
}

.change-trainer-section h3 {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.trainer-change-list {
    display: flex;
    gap: 8px;
}

.trainer-change-card {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.trainer-change-card:hover {
    border-color: var(--accent);
}

.trainer-change-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 6px;
}

.trainer-change-name {
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.danger-zone {
    border-top: 1px solid var(--border-light);
    padding-top: 16px;
}

.danger-zone-title {
    font-size: var(--font-size-sm);
    color: var(--danger);
    margin-bottom: 8px;
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 90%;
    max-width: var(--max-width);
}

.toast {
    padding: 14px 16px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    animation: slideDown 0.3s ease;
    box-shadow: var(--shadow-elevated);
    display: flex;
    align-items: center;
    gap: 8px;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

.toast.error {
    background: var(--danger);
    color: #fff;
}

.toast.success {
    background: var(--success);
    color: #fff;
}

.toast.info {
    background: var(--accent);
    color: #fff;
}

/* --- Loading overlay --- */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(248, 250, 248, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 250;
}

/* ============================================
   RESPONSIVE: Desktop
   ============================================ */
@media (min-width: 768px) {
    :root {
        --font-size-hero: 56px;
    }

    .landing-hero {
        padding: 100px 24px 80px;
    }

    .hero-title {
        font-size: 56px;
    }

    .hero-subtitle {
        font-size: 22px;
    }

    .landing-section {
        padding: 100px 32px;
    }

    .app-shell {
        /* centered content, no borders — header/footer are full-width */
    }

    .tab-bar {
        border-left: 1px solid var(--border-light);
        border-right: 1px solid var(--border-light);
    }
}

@media (max-width: 600px) {
    .landing-hero {
        flex-direction: column;
        padding: 48px 20px 32px;
        min-height: auto;
        text-align: center;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-cta {
        justify-content: center;
    }

    .hero-subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .hero-image {
        order: -1;
    }

    .hero-img {
        max-width: 280px;
    }

    .steps-grid {
        grid-template-columns: 1fr;
    }

    .advantages-grid {
        grid-template-columns: 1fr;
    }

    .trainer-card {
        flex-direction: column;
        text-align: center;
        min-height: auto;
    }

    .trainer-photo {
        width: 100%;
        height: 160px;
        min-width: auto;
    }

    .trainer-info {
        padding: 16px 20px 20px;
    }

    .hero-title {
        font-size: var(--font-size-2xl);
    }
}
