/* =========================================
   1. СИСТЕМА ЦВЕТОВ (Futuristic & High-Contrast)
   ========================================= */
:root {
    /* Фон: Ультра-черный для OLED и темно-графитовый */
    --bg-dark: #050505;
    --bg-card: #0f1117;
    --bg-elevated: #1a1d26;
    
    /* Акцент: Электрический оранжевый */
    --accent: #ff8c00;
    --accent-glow: rgba(255, 140, 0, 0.4);
    
    /* Макросы: Яркие, светящиеся цвета */
    --protein: #ff2d55; /* Розовый неон */
    --fat: #ffcc00;     /* Золотой неон */
    --carb: #00ff88;    /* Мятный неон */

    /* Текст */
    --text-main: #ffffff;
    --text-dim: #94a3b8;
    --text-muted: #475569;

    /* Геометрия */
    --radius: 18px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   2. ГЛОБАЛЬНЫЕ НАСТРОЙКИ (App-Feel)
   ========================================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
    /* Запрещаем выделение текста и системные синие рамки */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", sans-serif;
    /* Убираем лишние отступы, добавляем мягкий градиент на фон */
    background: radial-gradient(circle at top, #1a1d26 0%, #050505 100%);
    overflow-x: hidden;
}

/* Контейнер приложения */
.container {
    width: 100%;
    max-width: 400px; /* Идеально для Telegram WebApp */
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* =========================================
   3. СПИДОМЕТР (Dashboard Style)
   ========================================= */
.progress-bg.gauge {
    --p: 0;
    position: relative;
    width: 260px;
    height: 130px;
    margin: 10px auto;
    overflow: hidden;
    background: none;
}

/* Фоновая дуга */
.progress-bg.gauge::before {
    content: "";
    position: absolute;
    top: 0; left: 0;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: radial-gradient(circle, transparent 55%, var(--bg-elevated) 56%);
    z-index: 1;
}

/* Активная дуга (Прогресс) */
.progress-bg.gauge .progress-fill {
    position: absolute;
    top: 0; left: 0;
    width: 260px; height: 260px;
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--p) * 0.5%), transparent 0);
    transform: rotate(-90deg);
    z-index: 2;
    transition: var(--transition);
    filter: drop-shadow(0 0 8px var(--accent-glow));
}

/* Вырез внутри (делает дугу тонкой) */
.progress-bg.gauge::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 20px;
    width: 220px;
    height: 110px;
    background: var(--bg-dark);
    border-radius: 130px 130px 0 0;
    z-index: 3;
}

/* Текст внутри спидометра */
.label-group {
    position: absolute;
    bottom: 5px;
    left: 0; right: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}

.label-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--text-dim);
    font-weight: 600;
}

.label-values {
    font-size: 24px;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -1px;
}

/* =========================================
   4. МАКРОНУТРИЕНТЫ (Neon Bars)
   ========================================= */
.macros-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    background: var(--bg-card);
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.macro-item {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.macro-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.macro-info span:first-child {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--text-dim);
    font-weight: 700;
}

.macro-info span:last-child {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.macro-progress {
    background: rgba(255, 255, 255, 0.05);
    height: 6px;
    border-radius: 10px;
    overflow: hidden;
}

.macro-fill {
    height: 100%;
    border-radius: 10px;
    transition: width 0.8s ease-out;
}

.protein { background: var(--protein); box-shadow: 0 0 10px rgba(255, 45, 85, 0.4); }
.fat { background: var(--fat); box-shadow: 0 0 10px rgba(255, 204, 0, 0.4); }
.carb { background: var(--carb); box-shadow: 0 0 10px rgba(0, 255, 136, 0.4); }

/* =========================================
   5. ВЫБОР ЦЕЛИ (Cyber Segmented Control)
   ========================================= */
.goal-selector {
    background: var(--bg-card);
    padding: 5px;
    border-radius: 14px;
    display: flex;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.custom-radio {
    flex: 1;
}

.custom-radio input { display: none; }

.custom-radio .radio-btn {
    display: block;
    padding: 12px 5px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
}

.custom-radio input:checked + .radio-btn {
    background: var(--bg-elevated);
    color: var(--accent);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* =========================================
   6. КНОПКИ И ССЫЛКИ (Glass Buttons)
   ========================================= */
.btn, .editor a {
    display: block;
    width: 100%;
    background: var(--accent);
    color: white;
    text-align: center;
    padding: 16px;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    box-shadow: 0 8px 20px var(--accent-glow);
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.1);
}

.btn:active {
    transform: translateY(1px);
}

/* =========================================
   7. УВЕДОМЛЕНИЯ
   ========================================= */
.toast-success {
    background: rgba(0, 255, 136, 0.1);
    border: 1px solid var(--carb);
    color: var(--carb);
    padding: 12px;
    border-radius: 12px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    animation: slideIn 0.3s ease-out;
}

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

.btn-nav {
    text-decoration: none;
    padding: 5px 15px;
    background-color: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 4px;
    color: black;
    font-weight: bold;
}
.btn-nav:hover {
    background-color: #e0e0e0;
}

.choosing-date {
    display: flex;          /* Включаем гибкий контейнер */
    align-items: center;    /* Центрируем элементы по вертикали */
    justify-content: center; /* Центрируем всю группу по горизонтали */
    gap: 20px;              /* Расстояние между стрелками и формой */
    text-align: center;     /* Центрируем текст внутри элементов */
}

.choosing-date form {
    display: flex;
    flex-direction: column; /* Заголовок и инпут внутри формы будут друг под другом */
    align-items: center;
}

.choosing-date h3 {
    margin: 0 0 5px 0;      /* Убираем лишние отступы у заголовка */
}

.choosing-date {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-card);
    padding: 10px 20px;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-nav {
    text-decoration: none;
    color: var(--accent);
    font-size: 20px;
    font-weight: bold;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 140, 0, 0.1);
    transition: var(--transition);
}

.btn-nav:hover {
    background: var(--accent);
    color: white;
    box-shadow: 0 0 15px var(--accent-glow);
}

.choosing-date form {
    position: relative;
}

.choosing-date h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
}

/* Красивый скрытый инпут даты */
.choosing-date input[type="date"] {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    opacity: 0; /* Делаем невидимым, но кликабельным */
    cursor: pointer;
}

/* --- УЛУЧШЕННЫЙ СПИДОМЕТР --- */
.progress-bg.gauge::after {
    background: #0a0c10; /* Чуть светлее фона для глубины */
    box-shadow: inset 0 10px 20px rgba(0,0,0,0.5);
}

.label-values {
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

/* --- КНОПКИ (Glassmorphism) --- */
.btn, .editor a {
    background: linear-gradient(135deg, var(--accent), #ff5f00);
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Добавим легкую анимацию появления карточек */
.stats-container, .macros-container, .goal-selector, .editor {
    animation: fadeIn 0.6s ease-out forwards;
}

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