/* ═══════════════════════════════════════════════════════
   Форма записи на приём — Gutenberg Block
   Файл: css/appointment-block.css
   ═══════════════════════════════════════════════════════ */

.appt-form-block {
    max-width: 560px;
    margin: 0 auto;
    padding: var(--section-py, 40px) var(--container-px, 16px);
}

.appt-form-block__card {
    background: #fff;
    border-radius: 16px;
    padding: 32px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

/* ── Заголовок ────────────────────────────────────────── */
.appt-form-block__header {
    margin-bottom: 24px;
}

.appt-form-block__title {
    font-size: 1.4rem;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.appt-form-block__subtitle {
    font-size: 0.95rem;
    color: #777;
    margin: 0;
    line-height: 1.5;
}

/* ── Поля формы ───────────────────────────────────────── */
.appt-form-block__field {
    margin-bottom: 16px;
}

.appt-form-block__field input[type="text"],
.appt-form-block__field input[type="tel"],
.appt-form-block__field select,
.appt-form-block__field textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #333;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}

.appt-form-block__field input::placeholder,
.appt-form-block__field textarea::placeholder {
    color: #aaa;
}

.appt-form-block__field input:focus,
.appt-form-block__field textarea:focus {
    border-color: #e31f26;
    box-shadow: 0 0 0 3px rgba(227, 31, 38, 0.1);
}

.appt-form-block__field select:focus {
    border-color: #e0e0e0;
    box-shadow: none;
    outline: none;
}

/* ── Кастомный выпадающий список услуг ── */
.appt-custom-select {
    position: relative;
    width: 100%;
    -webkit-tap-highlight-color: transparent;
}

.appt-custom-select__trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-family: inherit;
    color: #aaa;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.appt-custom-select--selected .appt-custom-select__trigger {
    color: #333;
}

.appt-custom-select--open .appt-custom-select__trigger {
    border-color: #e31f26;
    border-radius: 8px 8px 0 0;
}

.appt-custom-select__arrow {
    flex-shrink: 0;
    transition: transform 0.2s;
}

.appt-custom-select--open .appt-custom-select__arrow {
    transform: rotate(180deg);
}

.appt-custom-select__options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 280px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    -webkit-overflow-scrolling: touch;
}

.appt-custom-select--open .appt-custom-select__options {
    display: block;
}

.appt-custom-select__option {
    padding: 12px 16px;
    font-size: 0.9rem;
    color: #333;
    cursor: pointer;
    text-align: left;
    border-bottom: 1px solid #f0f0f0;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s;
}

.appt-custom-select__option:last-child {
    border-bottom: none;
}

.appt-custom-select__option:hover,
.appt-custom-select__option:active {
    background: #f5f5f5;
}

.appt-custom-select__option--category {
    font-weight: 700;
    color: #222;
    font-size: 0.95rem;
    background: #fafafa;
}

.appt-custom-select__option--active {
    background: #fef2f2;
    color: #e31f26;
}

.appt-form-block__field textarea {
    resize: vertical;
    min-height: 80px;
}

/* Подсветка обязательного поля при ошибке */
.appt-form-block__field--required input:invalid:not(:placeholder-shown) {
    border-color: #e31f26;
}

/* Стили для datepicker-input */
#appt-date-picker {
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='1.8'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

/* ── Чекбокс согласия ─────────────────────────────────── */
.appt-form-block__consent {
    margin-bottom: 20px;
}

.appt-form-block__checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    position: relative;
}

.appt-form-block__checkbox-label input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.appt-form-block__checkbox-custom {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #ccc;
    border-radius: 4px;
    margin-top: 2px;
    transition: all 0.15s;
    position: relative;
}

.appt-form-block__checkbox-label input:checked + .appt-form-block__checkbox-custom {
    background: #e31f26;
    border-color: #e31f26;
}

.appt-form-block__checkbox-label input:checked + .appt-form-block__checkbox-custom::after {
    content: '';
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.appt-form-block__consent-text {
    font-size: 0.8rem;
    color: #888;
    line-height: 1.5;
}

.appt-form-block__consent-text a {
    color: #e31f26;
    text-decoration: underline;
}

/* ── Кнопка отправки ──────────────────────────────────── */
.appt-form-block__submit {
    width: 100%;
    padding: 16px 24px;
    background: #e31f26;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.appt-form-block__submit:hover {
    background: #c7191f;
    transform: translateY(-1px);
}

.appt-form-block__submit:active {
    transform: translateY(0);
}

.appt-form-block__submit:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* ── Успешная отправка ────────────────────────────────── */
.appt-form-block__success {
    text-align: center;
    padding: 40px 20px;
}

.appt-form-block__success-icon {
    width: 56px;
    height: 56px;
    background: #2e7d32;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    margin: 0 auto 16px;
}

.appt-form-block__success-title {
    font-size: 1.2rem;
    color: #1a1a2e;
    margin: 0 0 8px;
}

.appt-form-block__success-text {
    color: #777;
    margin: 0;
}

/* ═══ Встроенный календарь ════════════════════════════ */
.appt-datepicker {
    position: absolute;
    z-index: 100;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 16px;
    width: 280px;
    user-select: none;
    display: none;
}

.appt-datepicker.is-visible {
    display: block;
}

.appt-datepicker__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.appt-datepicker__nav {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #555;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
}

.appt-datepicker__nav:hover {
    background: #f0f0f0;
}

.appt-datepicker__month-year {
    font-weight: 600;
    font-size: 0.95rem;
    color: #1a1a2e;
}

.appt-datepicker__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    text-align: center;
    margin-bottom: 4px;
}

.appt-datepicker__weekday {
    font-size: 0.75rem;
    font-weight: 600;
    color: #999;
    padding: 4px 0;
}

.appt-datepicker__days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.appt-datepicker__day {
    text-align: center;
    padding: 8px 4px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #333;
    transition: background 0.15s, color 0.15s;
    border: none;
    background: none;
}

.appt-datepicker__day:hover {
    background: #fee;
}

.appt-datepicker__day--today {
    font-weight: 700;
    color: #e31f26;
}

.appt-datepicker__day--selected {
    background: #e31f26;
    color: #fff;
    font-weight: 600;
}

.appt-datepicker__day--disabled {
    color: #ddd;
    pointer-events: none;
}

.appt-datepicker__day--empty {
    pointer-events: none;
}

/* ═══ Адаптив ═════════════════════════════════════════ */
@media (max-width: 599px) {
    .appt-form-block {
        padding: 20px var(--container-px, 16px);
    }

    .appt-form-block__card {
        padding: 20px 16px;
        border-radius: 12px;
    }

    .appt-form-block__title {
        font-size: 1.2rem;
    }

    .appt-form-block__field input,
    .appt-form-block__field select,
    .appt-form-block__field textarea {
        padding: 12px 14px;
        font-size: 0.9rem;
    }

    .appt-form-block__submit {
        padding: 14px 20px;
        font-size: 0.95rem;
    }

    .appt-datepicker {
        width: calc(100% - 64px);
        max-width: 300px;
    }
}

@media (min-width: 600px) and (max-width: 1200px) {
    .appt-form-block {
        max-width: 480px;
    }
}
