/* ═══════════════════════════════════════════════════════════════════
   ФОРМА ОБРАЩЕНИЙ ГРАЖДАН — Premium Corporate Design
   ═══════════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700;800&display=swap');

:root {
    --tfb-primary: #1a1a2e;
    --tfb-primary-hover: #16213e;
    --tfb-accent: #0f3460;
    --tfb-accent-light: #e8edf5;
    --tfb-accent-glow: rgba(15, 52, 96, 0.12);
    --tfb-gold: #b8860b;
    --tfb-gold-light: #faf6ed;
    --tfb-success: #15803d;
    --tfb-success-light: #f0fdf4;
    --tfb-error: #dc2626;
    --tfb-error-light: #fef2f2;
    --tfb-text: #0f172a;
    --tfb-text-secondary: #475569;
    --tfb-text-muted: #94a3b8;
    --tfb-border: #e2e8f0;
    --tfb-bg: #f8fafc;
    --tfb-card-bg: #ffffff;
    --tfb-input-bg: #f8fafc;
    --tfb-radius: 16px;
    --tfb-radius-sm: 10px;
    --tfb-shadow: 0 1px 2px rgba(0,0,0,0.04);
    --tfb-shadow-card: 0 4px 24px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --tfb-shadow-hover: 0 8px 32px rgba(0,0,0,0.1);
    --tfb-transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Обёртка ─────────────────────────────────────────────────────── */
.tfb-wrap {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 16px;
    font-family: 'Montserrat', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--tfb-text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
.tfb-wrap *, .tfb-wrap *::before, .tfb-wrap *::after { box-sizing: border-box; }
.tfb-wrap a, .tfb-wrap button, .tfb-wrap label,
.tfb-wrap input, .tfb-wrap textarea, .tfb-wrap select {
    -webkit-tap-highlight-color: transparent;
}

/* ── Прогресс-бар ────────────────────────────────────────────────── */
.tfb-progress {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 36px;
    position: relative;
}
.tfb-progress-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    position: relative;
    z-index: 1;
}
.tfb-progress-num {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    background: var(--tfb-bg);
    color: var(--tfb-text-muted);
    transition: all var(--tfb-transition);
    position: relative;
    border: 2px solid var(--tfb-border);
}
.tfb-progress-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--tfb-text-muted);
    transition: color var(--tfb-transition);
    text-align: center;
    line-height: 1.3;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tfb-progress-step.active .tfb-progress-num {
    background: var(--tfb-primary);
    color: #fff;
    border-color: var(--tfb-primary);
    box-shadow: 0 0 0 6px rgba(26, 26, 46, 0.1);
}
.tfb-progress-step.active .tfb-progress-label {
    color: var(--tfb-primary);
}
.tfb-progress-step.done .tfb-progress-num {
    background: var(--tfb-success);
    color: #fff;
    border-color: var(--tfb-success);
}
.tfb-progress-step.done .tfb-progress-label {
    color: var(--tfb-success);
}
.tfb-progress-line {
    flex: 0 0 auto;
    width: 48px;
    height: 2px;
    background: var(--tfb-border);
    border-radius: 1px;
    transition: background var(--tfb-transition);
    margin-top: -22px;
}
.tfb-progress-line.done {
    background: var(--tfb-success);
}

/* ── Карточка шага ───────────────────────────────────────────────── */
.tfb-step {
    display: none;
    background: var(--tfb-card-bg);
    border-radius: var(--tfb-radius);
    padding: 40px 36px;
    box-shadow: var(--tfb-shadow-card);
    border: none;
}
.tfb-step.active {
    display: block;
    animation: tfbSlideIn 0.4s ease-out;
}
@keyframes tfbSlideIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
.tfb-step h2 {
    font-size: 1.5rem;
    margin: 0 0 4px;
    color: var(--tfb-text);
    font-weight: 800;
    letter-spacing: -0.3px;
}
.tfb-step-subtitle {
    font-size: 0.88rem;
    color: var(--tfb-text-muted);
    margin: 0 0 28px;
}

/* ── Категории (шаг 1) ──────────────────────────────────────────── */
.tfb-categories {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 28px;
}
.tfb-cat-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 20px;
    border: none;
    border-radius: var(--tfb-radius-sm);
    cursor: pointer;
    transition: all var(--tfb-transition);
    font-size: 0.92rem;
    background: var(--tfb-input-bg);
    position: relative;
    overflow: hidden;
}
.tfb-cat-option::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--tfb-radius-sm);
    border: 2px solid transparent;
    transition: border-color var(--tfb-transition);
    pointer-events: none;
}
.tfb-cat-option:hover {
    background: var(--tfb-accent-light);
}
.tfb-cat-option:hover::before {
    border-color: var(--tfb-accent);
}
.tfb-cat-option input[type="radio"] {
    width: 20px;
    height: 20px;
    accent-color: var(--tfb-primary);
    flex-shrink: 0;
}
.tfb-cat-option.selected {
    background: var(--tfb-accent-light);
}
.tfb-cat-option.selected::before {
    border-color: var(--tfb-accent);
}
.tfb-cat-option.selected span {
    font-weight: 700;
    color: var(--tfb-accent);
}

/* ── Поля ввода ──────────────────────────────────────────────────── */
.tfb-field {
    margin-bottom: 20px;
}
.tfb-field label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tfb-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.tfb-field .req {
    color: var(--tfb-error);
    margin-left: 2px;
}
.tfb-field input[type="text"],
.tfb-field input[type="email"],
.tfb-field input[type="tel"],
.tfb-field textarea,
.tfb-field select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid var(--tfb-border);
    border-radius: var(--tfb-radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--tfb-text);
    background: var(--tfb-card-bg);
    transition: border-color var(--tfb-transition);
    box-shadow: none;
}
.tfb-field input:focus,
.tfb-field textarea:focus,
.tfb-field select:focus {
    outline: none;
    border-color: var(--tfb-accent);
    box-shadow: none;
}
.tfb-field input::placeholder,
.tfb-field textarea::placeholder {
    color: #c1c8d4;
    font-weight: 400;
}
.tfb-field textarea {
    resize: vertical;
    min-height: 130px;
    line-height: 1.6;
}
.tfb-field input[type="file"] {
    font-size: 0.85rem;
    padding: 14px 18px;
    border: 1px dashed var(--tfb-border);
    border-radius: var(--tfb-radius-sm);
    cursor: pointer;
    background: var(--tfb-bg);
    box-shadow: none;
}
.tfb-field input[type="file"]:hover {
    border-color: var(--tfb-accent);
}
.tfb-field-hint {
    font-size: 0.78rem;
    color: var(--tfb-text-muted);
    margin-top: 6px;
}
.tfb-field.error input,
.tfb-field.error textarea {
    border-color: var(--tfb-error);
    box-shadow: none;
}

/* ── Чекбоксы (согласия) ─────────────────────────────────────────── */
.tfb-consent-block {
    margin: 24px 0;
    padding: 22px 24px;
    background: var(--tfb-bg);
    border-radius: var(--tfb-radius-sm);
    border: none;
}
.tfb-checkbox {
    margin-bottom: 14px;
}
.tfb-checkbox:last-child {
    margin-bottom: 0;
}
.tfb-checkbox label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 13px;
    cursor: pointer;
    line-height: 1.55;
    color: var(--tfb-text-secondary);
    user-select: none;
}
.tfb-checkbox input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    min-width: 22px;
    margin-top: 1px;
    flex-shrink: 0;
    cursor: pointer;
    border: 1.5px solid var(--tfb-border);
    border-radius: 6px;
    background: var(--tfb-card-bg);
    position: relative;
    transition: all 0.2s ease;
}
.tfb-checkbox input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 6px;
    width: 7px;
    height: 12px;
    border: solid #fff;
    border-width: 0 2.5px 2.5px 0;
    transform: rotate(45deg) scale(0);
    opacity: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.tfb-checkbox input[type="checkbox"]:checked {
    background: var(--tfb-accent);
    border-color: var(--tfb-accent);
    animation: tfbCheckPop 0.3s ease;
}
.tfb-checkbox input[type="checkbox"]:checked::after {
    transform: rotate(45deg) scale(1);
    opacity: 1;
}
@keyframes tfbCheckPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(0.85); }
    70%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}
.tfb-checkbox a {
    color: var(--tfb-accent);
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(15, 52, 96, 0.2);
    transition: border-color var(--tfb-transition);
}
.tfb-checkbox a:hover {
    border-color: var(--tfb-accent);
}

/* ── Кнопки ──────────────────────────────────────────────────────── */
.tfb-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--tfb-radius-sm);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--tfb-transition);
    font-family: inherit;
    line-height: 1.4;
    letter-spacing: 0.2px;
}
.tfb-btn:active {
    transform: scale(0.97);
}
.tfb-btn-primary, .tfb-btn-next {
    background: var(--tfb-primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.2);
}
.tfb-btn-primary:hover, .tfb-btn-next:hover {
    background: var(--tfb-primary-hover);
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.3);
    transform: translateY(-1px);
}
.tfb-btn-primary:disabled, .tfb-btn-next:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.tfb-btn-back {
    background: transparent;
    color: var(--tfb-text-secondary);
    padding: 14px 24px;
}
.tfb-btn-back:hover {
    background: var(--tfb-bg);
    color: var(--tfb-text);
}
.tfb-btn-send-code {
    background: var(--tfb-primary);
    color: #fff;
    padding: 14px 28px;
    box-shadow: 0 2px 8px rgba(26, 26, 46, 0.2);
}
.tfb-btn-send-code:hover {
    background: var(--tfb-primary-hover);
    box-shadow: 0 4px 16px rgba(26, 26, 46, 0.3);
    transform: translateY(-1px);
}
.tfb-btn-send-code:disabled {
    background: #e2e8f0;
    color: #94a3b8;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}
.tfb-step-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: none;
}

/* ── Email верификация (premium) ─────────────────────────────────── */
.tfb-verify-block {
    margin: 24px 0;
    padding: 36px 24px;
    background: var(--tfb-bg);
    border-radius: var(--tfb-radius);
    border: none;
}
.tfb-verify-center {
    text-align: center;
    max-width: 300px;
    margin: 0 auto;
}
.tfb-verify-title {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--tfb-text);
    margin: 0 0 8px;
    letter-spacing: -0.3px;
}
.tfb-verify-subtitle {
    font-size: 0.85rem;
    color: var(--tfb-text-muted);
    margin: 0 0 24px;
    line-height: 1.5;
}
.tfb-verify-subtitle strong {
    color: var(--tfb-text);
    font-weight: 600;
}
.tfb-otp-wrap {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}
.tfb-otp {
    width: 52px !important;
    height: 56px !important;
    text-align: center;
    font-size: 1.4rem !important;
    font-weight: 800;
    color: var(--tfb-text);
    border: 1px solid var(--tfb-border) !important;
    border-radius: var(--tfb-radius-sm) !important;
    background: var(--tfb-card-bg) !important;
    box-shadow: none;
    transition: border-color 0.2s;
    padding: 0 !important;
    caret-color: var(--tfb-accent);
}
.tfb-otp::placeholder {
    color: #d1d5db;
    font-size: 1.2rem;
}
.tfb-otp:focus {
    outline: none;
    border-color: var(--tfb-accent) !important;
    box-shadow: none;
}
.tfb-otp:disabled {
    opacity: 0.5;
}
.tfb-timer-text {
    font-size: 0.8rem;
    color: var(--tfb-text-muted);
    margin-top: 0;
}
.tfb-timer-text span {
    font-weight: 700;
    color: var(--tfb-text-secondary);
    font-variant-numeric: tabular-nums;
}
.tfb-btn-resend-link {
    display: inline-block;
    margin-top: 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--tfb-accent);
    background: none !important;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
    border-bottom: 1px dashed rgba(15, 52, 96, 0.3);
    transition: color var(--tfb-transition), border-color var(--tfb-transition);
}
.tfb-btn-resend-link:hover {
    color: var(--tfb-primary);
    border-bottom-color: var(--tfb-primary);
    background: none !important;
}
.tfb-verify-status {
    margin-top: 16px;
    font-size: 0.88rem;
    font-weight: 600;
    min-height: 24px;
}
.tfb-verify-status.error {
    color: var(--tfb-error);
}
.tfb-verify-status.success {
    color: var(--tfb-success);
}
.tfb-blocked-msg {
    padding: 16px 20px;
    background: var(--tfb-error-light);
    border-radius: var(--tfb-radius-sm);
    color: var(--tfb-error);
    font-weight: 600;
    text-align: center;
    margin-top: 16px;
    font-size: 0.88rem;
    border: none;
}

/* ── Капча ────────────────────────────────────────────────────────── */
.tfb-captcha-wrap {
    margin: 24px 0;
}

/* ── Экран успеха ────────────────────────────────────────────────── */
.tfb-success {
    text-align: center;
    padding: 56px 32px;
    background: var(--tfb-card-bg);
    border-radius: var(--tfb-radius);
    box-shadow: var(--tfb-shadow-card);
    border: none;
}
.tfb-success-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 24px;
    background: var(--tfb-success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    animation: tfbBounce 0.5s ease;
}
@keyframes tfbBounce {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.15); }
    100% { transform: scale(1); }
}
.tfb-success h2 {
    color: var(--tfb-text);
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 12px;
    letter-spacing: -0.3px;
}
.tfb-success p {
    color: var(--tfb-text-muted);
    font-size: 0.92rem;
    margin: 8px 0;
    line-height: 1.5;
}

/* ── Счётчик символов ────────────────────────────────────────────── */
.tfb-char-counter {
    float: right;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--tfb-text-muted);
}
.tfb-char-counter.warning {
    color: #d97706;
}
.tfb-char-counter.danger {
    color: var(--tfb-error);
}

/* ── Адаптив ─────────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .tfb-step {
        padding: 28px 20px;
        border-radius: 12px;
    }
    .tfb-categories {
        grid-template-columns: 1fr;
    }
    .tfb-progress-label {
        font-size: 9px;
    }
    .tfb-progress-num {
        width: 36px;
        height: 36px;
        font-size: 12px;
    }
    .tfb-progress-line {
        width: 20px;
    }
    .tfb-step-actions {
        flex-direction: column-reverse;
    }
    .tfb-step-actions .tfb-btn {
        width: 100%;
        text-align: center;
    }
    .tfb-otp {
        width: 46px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }
    .tfb-otp-wrap {
        gap: 8px;
    }
    .tfb-step h2 {
        font-size: 1.25rem;
    }
}
