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

:root {
    /* Базовые цвета под стиль на скрине */
    --villa-bg: #ffffff;
    --villa-surface: #ffffff;
    --villa-accent: #c89a5b;
    --villa-accent-soft: #f3e3cf;
    --villa-accent-dark: #a97c3c;
    --villa-header-bg: #0a2641;
    --villa-header-text: #ffffff;
    --villa-text-main: #1e1e1e;
    --villa-text-muted: #9b9b9b;
    --villa-border: #e0d6c7;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--villa-header-bg);
    color: var(--villa-text-main);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
}

.container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: var(--villa-bg);
}

/* Header with tabs (как в макете) */
.header {
    background: var(--villa-header-bg);
    border-radius: 0;
}

 .tabs {
    display: flex;
    gap: 0;
}

.tab {
    flex: 1;
    padding: 14px 0;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.tab.active {
    color: var(--villa-header-text);
    border-bottom-color: var(--villa-accent);
}

.tab-content {
    display: none;
    padding: 20px 16px 24px;
    animation: fadeIn 0.3s;
}

.tab-content.active {
    display: block;
}

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

/* Form styles */
.form-section {
    max-width: 100%;
    background: var(--villa-bg);
    padding: 16px 16px 20px;
}

.form-section h2 {
    display: none; /* заголовок "Знакомство Villa SPA" скрыт */
}

.form-section h3 {
    font-size: 18px;
    margin-bottom: 18px;
    color: var(--villa-text-main);
}

.form-step {
    display: none;
}

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

.calendar-container {
    margin-bottom: 16px;
}

.date-input {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--villa-border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--villa-surface);
    color: var(--villa-text-main);
}

/* Calendar Widget Styles */
.calendar-widget {
    background: var(--villa-surface);
    border: none;             /* без внешней рамки */
    border-radius: 0;
    padding: 0 0 12px;
    box-shadow: none;         /* без тени */
}

.calendar-range-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
}

.calendar-range-button {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #e0e4ec;
    background: #f7f9fc;
    font-size: 13px;
    color: var(--villa-text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: default;
}

.calendar-range-button span {
    font-weight: 500;
}

.calendar-range-button-label {
    display: none;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--villa-border);
}

.calendar-nav-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: #f0ece5;
    border-radius: 10px;
    font-size: 24px;
    color: var(--villa-text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-weight: bold;
}

.calendar-nav-btn:active {
    background: var(--tg-theme-button-color, #3390ec);
    color: var(--tg-theme-button-text-color, #ffffff);
    transform: scale(0.95);
}

.calendar-month-year {
    display: flex;
    align-items: center;
    gap: 8px;
}

.calendar-month {
    font-size: 14px;
    font-weight: 500;
    text-transform: lowercase;
    color: var(--villa-text-main);
}

.calendar-year {
    font-size: 14px;
    color: var(--villa-text-main);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;                  /* будние дни почти вплотную друг к другу */
    margin-bottom: 8px;
}

.calendar-weekday {
    text-align: center;
    font-size: 13px;           /* крупнее подписи дней недели */
    font-weight: 600;
    color: var(--villa-text-muted);
    padding: 8px 4px;
    text-transform: uppercase;
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0;                    /* почти вплотную друг к другу */
}

.calendar-day {
    width: 32px;               /* чуть крупнее бокс */
    height: 32px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 13px;           /* числа покрупнее */
    font-weight: 500;
    color: var(--villa-text-main);
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
    border: 1px solid transparent;
}

.calendar-day:not(.empty):not(.past):hover {
    background: var(--villa-accent-soft);
    border-color: var(--villa-accent);
}

.calendar-day:not(.empty):not(.past):active {
    background: var(--villa-accent);
    color: #ffffff;
    transform: scale(0.9);
    transition: all 0.15s ease;
}

.calendar-day.empty {
    cursor: default;
    visibility: hidden;
}

.calendar-day.past {
    color: #c9c5c0;
    cursor: not-allowed;
    opacity: 0.4;
}

.calendar-day.today {
    background: var(--villa-accent-soft);
    border-color: var(--villa-accent);
    font-weight: 600;
}

.calendar-day.selected {
    background: var(--villa-accent);
    color: #ffffff;
    font-weight: 600;
    border-color: var(--villa-accent);
    border-radius: 999px;      /* одиночная выбранная дата – более округлая */
}

@keyframes selectPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.calendar-day.selected.today {
    background: var(--villa-accent);
    color: #ffffff;
}

/* Range selection styles */
.calendar-day.range-start {
    background: var(--villa-accent);
    color: #ffffff;
    font-weight: 600;
    width: 100%;                     /* растягиваем капсулу по всей ширине ячейки */
    border-radius: 999px 0 0 999px;  /* капсульная форма слева */
    border-color: var(--villa-accent);
    position: relative;
}

.calendar-day.range-end {
    background: var(--villa-accent);
    color: #ffffff;
    font-weight: 600;
    width: 100%;                     /* растягиваем капсулу по всей ширине ячейки */
    border-radius: 0 999px 999px 0;  /* капсульная форма справа */
    border-color: var(--villa-accent);
    position: relative;
}

.calendar-day.range-middle {
    background: rgba(200, 154, 91, 0.18);
    color: var(--villa-text-main);
    border-radius: 0;
    position: relative;
    font-weight: 500;
    width: 100%;                     /* середина диапазона тоже заполняет всё пространство */
}

/* Подсветка для дат в середине диапазона */
.calendar-day.range-middle:hover {
    background: rgba(200, 154, 91, 0.26);
}

/* Если диапазон в одной строке (одна дата) */
.calendar-day.range-start.range-end {
    width: 100%;
    border-radius: 999px;   /* одна выбранная дата – полностью круглая капсула */
}

/* Если диапазон начинается в начале недели */
.calendar-day.range-start:first-child,
.calendar-day.range-start:nth-child(7n+1) {
    /* сохраняем такое же скругление, как у обычного начала диапазона */
    border-radius: 999px 0 0 999px;
}

/* Если диапазон заканчивается в конце недели */
.calendar-day.range-end:nth-child(7n) {
    /* сохраняем такое же скругление, как у обычного конца диапазона */
    border-radius: 0 999px 999px 0;
}

.calendar-selected {
    margin-top: 12px;
    padding: 12px;
    background: var(--villa-accent-soft);
    border-radius: 10px;
    text-align: center;
    font-size: 13px;
    font-weight: 500;
    color: var(--villa-text-main);
    border-left: 4px solid var(--villa-accent);
}

.calendar-selected small {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: var(--villa-text-muted);
    font-weight: normal;
}

/* Calendar responsive improvements */
@media (max-width: 480px) {
    .calendar-widget {
        padding: 10px;
    }
    
    .calendar-nav-btn {
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
    
    .calendar-month {
        font-size: 16px;
    }
    
    .calendar-year {
        font-size: 12px;
    }
    
    .calendar-day {
        font-size: 14px;
    }
    
    .calendar-weekday {
        font-size: 11px;
        padding: 6px 2px;
    }
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--villa-text-main);
}

/* Группа с плавающим заголовком для дропдаунов */
.floating-label-group {
    position: relative;
}

.floating-label-group label {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%);
    margin: 0;
    font-size: 16px;
    font-weight: 500;
    color: var(--villa-text-main);
    pointer-events: none;
    transition: none; /* без анимации */
    opacity: 0; /* по умолчанию заголовок скрыт */
    z-index: 2; /* поверх самой кнопки */
}

.floating-label-group .dropdown-btn {
    position: relative;
    z-index: 1;
    padding-top: 18px;
    padding-bottom: 18px;
}

.floating-label-group.has-value label {
    top: 0;
    transform: translateY(-50%); /* текст сидит прямо на обводке */
    font-size: 14px;
    color: var(--villa-accent);
    background: var(--villa-bg); /* фон как у формы, по бокам создаёт зазор от рамки */
    padding: 0 10px;            /* отступы слева и справа от текста */
    border-radius: 4px;
    opacity: 1;
}

.input-field,
.textarea-field {
    width: 100%;
    padding: 14px;
    border: 1px solid var(--villa-border);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: var(--villa-surface);
    color: var(--villa-text-main);
}

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

.dropdown-btn {
    width: 100%;
    padding: 14px 48px 14px 16px;
    border: 1px solid var(--villa-border);
    border-radius: 12px;
    font-size: 16px;
    background: var(--villa-surface);
    color: var(--villa-text-main);
    text-align: left;
    cursor: pointer;
    position: relative;
    display: flex;
    align-items: center;
}

/* Серый текст-плейсхолдер до выбора значения */
.floating-label-group:not(.has-value) .dropdown-btn {
    color: var(--villa-text-muted);
}

.dropdown-btn::after {
    content: '▼';
    position: absolute;
    right: 18px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: var(--villa-text-muted);
}

.dropdown-menu {
    position: absolute;
    width: 100%;
    max-width: calc(100vw - 40px);
    background: var(--villa-surface);
    border: 1px solid var(--villa-border);
    border-radius: 12px;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 10;
    max-height: 300px;
    overflow-y: auto;
}

.dropdown-menu.hidden {
    display: none;
}

/* Универсальный класс для скрытия любых блоков (в т.ч. SPA-товаров, форм и т.д.) */
.hidden {
    display: none !important;
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 15px;
    color: var(--villa-text-main);
    cursor: pointer;
    transition: background 0.2s;
}

.dropdown-item:hover {
    background: #f5efe6;
}

.dropdown-item:first-child {
    border-top-left-radius: 8px;
    border-top-right-radius: 8px;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
}

.checkbox-label {
    display: inline-flex;      /* в строку, а не на всю ширину */
    align-items: center;       /* КЛЮЧЕВОЕ: центр по вертикали */
    gap: 1px;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
}



.checkbox-label input[type="checkbox"] {
    width: 22px;
    height: 22px;
    cursor: pointer;
    accent-color: var(--villa-accent);
    border-radius: 8px;        /* красивое мягкое скругление */
    border: 2px solid #8d8d8d; /* видимая рамка как в макете */
    margin: 0;                 /* убираем возможные системные отступы */
}

.checkbox-label span {
    font-size: 16px;
    line-height: 1.1;
    display: inline-block;
    margin: 0;
    position: relative;
    top: -4px;                 /* небольшой сдвиг вверх для визуального выравнивания */
}
.checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.notification {
    padding: 12px;
    background: #f5efe6;
    border-left: 4px solid var(--villa-accent);
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 13px;
    color: var(--villa-text-main);
}

.notification.hidden {
    display: none;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    background: var(--villa-accent);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-top: 20px;
}

.btn-primary:active {
    background: var(--villa-accent-dark);
}

/* Villa SPA section */
.villa-spa-section h2 {
    font-size: 24px;
    margin-bottom: 24px;
    color: var(--villa-text-main);
}

.button-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.spa-btn {
    padding: 16px;
    background: #f5efe6;
    color: var(--villa-text-main);
    border: 1px solid var(--villa-border);
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.spa-btn:active {
    background: var(--villa-accent);
    color: #ffffff;
}

.products-section {
    margin-top: 24px;
}

.products-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.product-item {
    padding: 16px;
    background: #f5efe6;
    border-radius: 12px;
    font-size: 16px;
    color: var(--tg-theme-text-color, #000000);
}

/* Dynamic fields */
.dynamic-field-group {
    margin-bottom: 20px;
    padding: 16px;
    background: #f5efe6;
    border-radius: 12px;
}

.dynamic-field-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
}

.dynamic-field-group .input-field,
.dynamic-field-group .dropdown-btn {
    margin-bottom: 12px;
}

.dynamic-field-group .checkbox-list {
    margin-top: 12px;
}

/* Overlay for messages */
.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: 1000;
    padding: 20px;
}

.overlay.hidden {
    display: none;
}

.message-box {
    background: var(--villa-surface);
    border-radius: 14px;
    padding: 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.message-box p {
    margin-bottom: 20px;
    font-size: 16px;
    color: var(--villa-text-main);
}

/* Responsive */
@media (min-width: 768px) {
    .container {
        max-width: 600px;
        margin: 0 auto;
    }
    
    .button-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
