/**
 * TRDS Modal Form Styles
 *
 * Modal registration form with two-column layout
 * Based on modal.html template
 *
 * @package TRDS_Modal_Form
 * @version 1.0.0
 */

/* CSS ПЕРЕМЕННЫЕ */
:root {
    --trds-modal-overlay-bg: rgba(44, 24, 16, 0.6);
    --trds-modal-blur: 0px;
    --trds-modal-max-width: 950px;
    --trds-modal-border-radius: 12px;
    --trds-modal-transition: 0.3s ease;
}

/* --- Кнопка для вызова --- */
.trds-open-modal-btn {
    background: linear-gradient(135deg, var(--trds-course-primary, #003d82) 0%, var(--trds-course-primary-dark, #002855) 100%);
    color: #fff;
    padding: 15px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--trds-modal-transition);
    min-height: 44px;
}

.trds-open-modal-btn:hover {
    background: linear-gradient(135deg, var(--trds-course-primary-dark, #002855) 0%, var(--trds-course-primary, #003d82) 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 61, 130, 0.4);
}

.trds-open-modal-btn:focus-visible {
    outline: 3px solid var(--trds-focus-ring-color, #000);
    outline-offset: 4px;
}

/* --- Стили Модального Окна --- */
.trds-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--trds-modal-overlay-bg);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--trds-modal-transition), visibility var(--trds-modal-transition);
    /* padding: 20px; */
    box-sizing: border-box;
}

.trds-registration-help {
    position: fixed;
    top: max(12px, calc(50dvh - 165px));
    left: max(18px, env(safe-area-inset-left));
    z-index: 100001;
    box-sizing: border-box;
    width: min(190px, calc(100vw - 36px));
    border-radius: 16px;
    background: #294d8e;
    color: #fff;
    box-shadow: 0 6px 22px #13294d33;
}
.trds-registration-help::after {
    content: '';
    position: absolute;
    top: calc(100% - 1px);
    left: 15px;
    width: 34px;
    height: 34px;
    background: #294d8e;
    clip-path: polygon(0 0, 100% 0, 0 100%);
    pointer-events: none;
}
.trds-registration-help[hidden] { display: none; }
.trds-registration-help button { cursor: pointer; border: 0; color: inherit; font: inherit; }
.trds-registration-help__open { display: block; width: 100%; min-height: 62px; padding: 9px 27px 9px 10px; border-radius: inherit; background: transparent; text-align: left; font-size: 13px !important; font-weight: 700 !important; line-height: 1.15; }
.trds-registration-help__open:hover, .trds-registration-help__open:focus-visible { background: #3560a9; outline: 2px solid #fff; outline-offset: 2px; }
.trds-registration-help .trds-registration-help__dismiss { position: absolute; top: 3px; right: 4px; display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border-radius: 8px; background: transparent; font-size: 20px; line-height: 1; }
.trds-registration-help__dismiss:hover, .trds-registration-help__dismiss:focus-visible { background: #ffffff30; outline: 2px solid #fff; outline-offset: 2px; }

.trds-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.trds-modal {
    background: var(--trds-surface, #ffffff);
    width: 100%;
    max-width: var(--trds-modal-max-width);
    height: 77vh;
    max-height: 730px;
    border-radius: var(--trds-modal-border-radius);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.2);
    display: flex;
    overflow: hidden;
    position: relative;
    transform: translateY(20px);
    transition: transform var(--trds-modal-transition);
}

.trds-modal-overlay.is-visible .trds-modal {
    transform: translateY(0);
}

/* Кнопка закрытия */
.trds-modal__close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(0, 0, 0, 0.25);
    border: none;
    font-size: 24px;
    color: #fff;
    cursor: pointer;
    z-index: 20;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--trds-modal-transition);
    backdrop-filter: blur(4px);
}

/* Close button icon styling */
.trds-modal__close-icon {
    font-size: 31px;
    font-weight: 200;
    font-family: system-ui, sans-serif;
    position: relative;
    top: -0.1rem;
}

.trds-modal__close:hover {
    background-color: rgba(0, 0, 0, 0.4);
    transform: rotate(90deg);
}

.trds-modal__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* --- Колонка 1: Форма (Слева) --- */
.trds-modal__form-col {
    flex: 1.4;
    padding: var(--trds-space-xl);
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    overflow: visible;
}

.trds-modal__title {
    font-size: 26px;
    font-weight: 700;
    color: var(--trds-text-primary, #2c1810);
    margin: 0 0 10px 0;
    line-height: 1.2;
    flex-shrink: 0;
}

.trds-modal__subtitle {
    font-size: 15px;
    color: var(--trds-text-secondary, #5d4037);
    margin-bottom: 20px;
    flex-shrink: 0;
}

/* CF7 Form Container */
.trds-modal__cf7-container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* Mobile: Enable scrolling in CF7 container */
@media (max-width: 768px) {
    .trds-modal__cf7-container {
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
}

.trds-modal__cf7-container .wpcf7 {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.trds-modal-cf7-form {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* --- Колонка 2: Полезный контент (Справа) --- */
.trds-modal__info-col {
    flex: 1;
    box-sizing: border-box;
    min-width: 0;
    padding: 40px 40px clamp(40px, 8vh, 72px);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    position: relative;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(0, 61, 130, 0.72), rgba(0, 77, 155, 0.85)),
        url('../img/modal-info-tianshan-bg.jpg');
    background-size: cover;
    background-position: center bottom;
    height: 130%;
    margin-top: -14rem;
}

.trds-info-list {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
    padding-bottom: 6.7rem;
}

.trds-info-list li {
    display: flex;
    align-items: flex-start;
    margin-bottom: 24px;
    font-size: 17px;
    line-height: 1.5;
}

.trds-info-list i {
    font-size: 24px;
    margin-right: 14px;
    margin-top: 2px;
    color: #ffccbc;
    flex-shrink: 0;
}

.trds-info-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 24px;
    color: #fff;
    position: relative;
    z-index: 2;
}

.trds-faq-trigger {
    position: absolute;
    z-index: 3;
    bottom: 24px;
    left: calc(58.333% + 32px);
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: 24px;
    background: rgba(0, 43, 91, .48);
    color: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.trds-faq-trigger i { font-size: 24px; }
.trds-faq-trigger:hover { background: rgba(0, 43, 91, .8); }
.trds-faq-trigger:focus-visible,
.trds-faq-panel__close:focus-visible { outline: 3px solid #ffccbc; outline-offset: 3px; }

.trds-faq-panel {
    position: absolute;
    inset: 0;
    z-index: 110;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #2c1810;
}
.trds-faq-panel[hidden] { display: none; }
.trds-faq-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 24px 32px;
    background: #003d82;
    color: #fff;
}
.trds-faq-panel__header h2 { margin: 0; color: inherit; font-size: 25px; line-height: 1.2; }
.trds-faq-panel__close {
    flex: none;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font: inherit;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
}
.trds-faq-panel__close:hover { background: rgba(255, 255, 255, .3); }
.trds-faq-panel__content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 8px 32px 32px;
}
.trds-faq-item { border-bottom: 1px solid #e0d6d1; }
.trds-faq-item:last-child { border-bottom: 0; }
.trds-faq-item summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 0; color: #003d82; font-size: 19px; font-weight: 700; line-height: 1.35; list-style: none; cursor: pointer; }
.trds-faq-item summary::-webkit-details-marker { display: none; }
.trds-faq-item summary::after { content: '+'; flex: none; font-size: 28px; font-weight: 400; line-height: 1; }
.trds-faq-item[open] summary::after { content: '−'; }
.trds-faq-item summary:focus-visible { outline: 3px solid #003d82; outline-offset: 3px; }
.trds-faq-item__answer { padding: 0 36px 20px 0; }
.trds-faq-item p { margin: 0 0 10px; font-size: 16px; line-height: 1.55; }
.trds-faq-item p:last-child { margin-bottom: 0; }

@media (min-width: 769px) and (max-width: 900px) {
    .trds-modal__info-col { padding: 28px 24px 40px; }
    .trds-info-title { margin-bottom: 14px; font-size: 20px; }
    .trds-info-list li { margin-bottom: 12px; font-size: 15px; }
}

/* --- CF7 Form Structure --- */
.trds-modal-cf7-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.trds-modal-cf7-form .wpcf7-form {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* =========================================
   FLOATING LABEL INPUT GROUPS
   Structure:
   .trds-input-group > .wpcf7-form-control-wrap > input.trds-input
   .trds-input-group > label.trds-label

   The floating effect uses :placeholder-shown pseudo-class
   Inputs MUST have placeholder=" " attribute for this to work
   ========================================= */

.trds-input-group {
    position: relative !important;
    margin-bottom: 20px !important;
    width: 100% !important;
    overflow: visible !important;
}

.trds-email-suggestions {
    margin-top: 5px;
    overflow: hidden;
    border: 1px solid var(--trds-border, #e0d6d1);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 8px 20px rgba(44, 24, 16, 0.12);
}

.trds-email-suggestions[hidden] {
    display: none !important;
}

.trds-email-suggestions__option {
    padding: 5px 10px;
    font-size: 12px;
    line-height: 1;
    color: var(--trds-text-primary, #2c1810);
    cursor: pointer;
    overflow-wrap: anywhere;
}

.trds-email-suggestions__option:hover,
.trds-email-suggestions__option[aria-selected="true"] {
    background: #eaf2fb;
    color: #003d82;
}

/* CF7 form control wrap - display:contents so it adds no box/height of its own */
.trds-input-group .wpcf7-form-control-wrap {
    display: contents !important;
}

/* Hide br tags inside input group */
.trds-input-group br {
    display: none !important;
}

/* Input styling */
.trds-input-group .trds-input,
.trds-input-group input.wpcf7-form-control {
    width: 100% !important;
    padding: 16px !important;
    border: 2px solid var(--trds-border, #e0d6d1) !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-family: inherit !important;
    background: #fff !important;
    color: var(--trds-text-primary, #2c1810) !important;
    transition: border-color 0.3s ease !important;
    outline: none !important;
    box-sizing: border-box !important;
    height: 56px !important;
    margin: 0 !important;
    display: block !important;
}

.trds-input-group .trds-input:focus,
.trds-input-group input.wpcf7-form-control:focus {
    border-color: var(--trds-primary, #8b4513) !important;
}

/* Textarea Group - specific height handling */
.trds-textarea-group {
    height: auto !important;
    min-height: 100px !important;
    margin-bottom: 20px !important;
}

/* Textarea styling */
.trds-textarea-group textarea.wpcf7-form-control,
.trds-textarea-group .trds-textarea {
    width: 100% !important;
    min-height: 100px !important;
    height: 100px !important;
    padding: 16px !important;
    border: 2px solid var(--trds-border, #e0d6d1) !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-family: inherit !important;
    background: transparent !important;
    color: var(--trds-text-primary, #2c1810) !important;
    transition: border-color 0.3s ease !important;
    outline: none !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    resize: vertical !important;
}

.trds-textarea-group textarea.wpcf7-form-control:focus,
.trds-textarea-group .trds-textarea:focus {
    border-color: var(--trds-primary, #8b4513) !important;
}

/* Textarea placeholder styling - visible gray text inside */
.trds-textarea-group textarea::placeholder {
    color: #999 !important;
    opacity: 1 !important;
    font-size: 16px !important;
    font-weight: 400 !important;
}

/* Floating label - positioned inside input by default */
.trds-input-group label.trds-label {
    position: absolute !important;
    left: 14px !important;
    top: 28px !important;
    transform: translateY(-50%) !important;
    background-color: var(--trds-surface, #ffffff) !important;
    padding: 0 4px !important;
    color: var(--trds-text-muted, #8d7a75) !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    pointer-events: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1 !important;
    margin: 0 !important;
    line-height: 1 !important;
}

/* Floating label active state - when input has focus */
.trds-input-group:focus-within label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-course-primary, #003d82) !important;
    font-weight: 600 !important;
}

/* Floating label active state - when input has value (using :placeholder-shown) */
.trds-input-group:has(input:not(:placeholder-shown)) label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-course-primary, #003d82) !important;
    font-weight: 600 !important;
}

/* Also handle nested structure with wpcf7-form-control-wrap */
.trds-input-group:has(.wpcf7-form-control-wrap input:not(:placeholder-shown)) label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-course-primary, #003d82) !important;
    font-weight: 600 !important;
}

/* Fallback for has-value class added by JavaScript */
.trds-input-group.has-value label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-course-primary, #003d82) !important;
    font-weight: 600 !important;
}

/* Two-column form row for phone and email */
.trds-form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
    flex-shrink: 0 !important;
    /* Keep columns top-aligned so a validation message under one field
       does not stretch the neighbouring column and break the row. */
    align-items: start !important;
}

.trds-form-row .trds-input-group {
    margin-bottom: 0 !important;
}

.trds-phone-country {
    grid-column: 1 / -1;
    box-sizing: border-box;
    width: 100%;
    min-height: 38px;
    padding: 6px 12px;
    border: 1px solid var(--trds-border, #e0d6d1);
    border-radius: 8px;
    background: #fff;
    color: var(--trds-text-primary, #2c1810);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

.trds-phone-country:focus-visible {
    outline: 2px solid #003d82;
    outline-offset: 2px;
}

.trds-form-row:has(.trds-phone-country) {
    row-gap: 8px !important;
}

/* Reset p margins inside form row */
.trds-form-row p {
    margin: 0 !important;
}

/* Textarea label - hidden by default, floats when has value or focus */
.trds-textarea-group label.trds-label {
    opacity: 0 !important;
    visibility: hidden !important;
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-course-primary, #003d82) !important;
    font-weight: 600 !important;
    transition: opacity 0.2s ease, visibility 0.2s ease !important;
}

/* Show label when textarea has focus */
.trds-textarea-group:focus-within label.trds-label {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Show label when textarea has value */
.trds-textarea-group.has-value label.trds-label {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Hide placeholder when textarea has focus or value (label will show instead) */
.trds-textarea-group:focus-within textarea::placeholder,
.trds-textarea-group.has-value textarea::placeholder {
    opacity: 0 !important;
}

/* Participation toggle group */
.trds-participation-group {
    margin-bottom: var(--trds-space-xs) !important;
    display: flex;
    align-items: center;
    gap: var(--trds-space-sm);
    margin-top: 0.5rem;
}

.trds-participation-group .trds-section-label {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-bottom: 0 !important;
    color: var(--trds-text-primary, #2c1810) !important;
    white-space: nowrap;
}

/* Collapse p tags inside participation group so they don't break flex row */
.trds-participation-group > p {
    margin: 0 !important;
    padding: 0 !important;
    display: contents !important;
}

/* Toggle container */
.trds-toggle-container {
    display: flex !important;
    gap: 8px !important;
    flex: 1;
}

/* Reset p margins inside toggle container */
.trds-toggle-container > p {
    margin: 0 !important;
    display: contents !important;
}

/* Radio group: flex row so both items share the available space */
.trds-toggle-container .wpcf7-radio {
    display: flex !important;
    gap: 8px !important;
    flex: 1;
    margin: 0 !important;
    padding: 0 !important;
}

.trds-toggle-container .wpcf7-form-control-wrap {
    display: contents !important;
}

.trds-toggle-container .wpcf7-list-item {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    flex: 1;
    min-width: 0;
}

.trds-toggle-container .wpcf7-list-item > label {
    display: flex !important;
    width: 100% !important;
    min-width: 0;
    white-space: nowrap;
}

.trds-toggle-container input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
}

/* Toggle button styling */
.trds-toggle-container .wpcf7-list-item-label {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    padding: var(--trds-space-0-5) var(--trds-space-sm);
    background: var(--trds-background, #f5f5f5) !important;
    border: 2px solid var(--trds-border, #e0d6d1) !important;
    border-radius: 8px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: var(--trds-text-secondary, #5d4037) !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    user-select: none !important;
}

/* Toggle hover state */
.trds-toggle-container .wpcf7-list-item-label:hover {
    border-color: var(--trds-course-primary, #003d82) !important;
    background: rgba(0, 61, 130, 0.05) !important;
}

/* Toggle selected state */
.trds-toggle-container input[type="radio"]:checked + .wpcf7-list-item-label {
    background: var(--trds-course-primary, #003d82) !important;
    border-color: var(--trds-course-primary, #003d82) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(0, 61, 130, 0.3) !important;
}

/* Toggle focus state */
.trds-toggle-container input[type="radio"]:focus + .wpcf7-list-item-label {
    outline: 2px solid var(--trds-course-accent, #ffc107) !important;
    outline-offset: 2px !important;
}

/* Scrollable problems/chips area */
.trds-problems-scroll-area {
    flex: 1 !important;
    overflow-y: auto !important;
    padding-right: 10px !important;
    margin-bottom: 8px !important;
    margin-top: 8px !important;
    border-top: 1px solid #eee !important;
    border-bottom: 1px solid #eee !important;
    padding-top: 12px !important;
    padding-bottom: 5px !important;
    min-height: 0 !important;
    scrollbar-width: thin;
    scrollbar-color: var(--trds-secondary, #d4a574) transparent;
}

/* Reset p margins inside scroll area */
.trds-problems-scroll-area p {
    margin: 0 !important;
    padding: 0 !important;
}

.trds-problems-scroll-area::-webkit-scrollbar {
    width: 6px;
}

.trds-problems-scroll-area::-webkit-scrollbar-track {
    background: transparent;
}

.trds-problems-scroll-area::-webkit-scrollbar-thumb {
    background-color: var(--trds-secondary, #d4a574);
    border-radius: 3px;
}

.trds-problems-scroll-area::-webkit-scrollbar-thumb:hover {
    background: var(--trds-primary, #8b4513);
}

.trds-section-label {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    color: var(--trds-text-primary, #2c1810) !important;
    position: sticky !important;
    top: 0 !important;
    background: var(--trds-surface, #ffffff) !important;
    z-index: 5 !important;
    padding-bottom: 3px !important;
}

.trds-category-group {
    margin-bottom: 12px !important;
}

/* Reset p margins inside category group */
.trds-category-group > p {
    margin: 0 0 6px 0 !important;
}

.trds-category-title {
    display: block !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--trds-text-secondary, #6b5b52) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 6px !important;
}

.trds-chips-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

/* Reset p margins inside chips container */
.trds-chips-container p {
    margin: 0 !important;
    display: contents !important;
}

/* Fixed footer with submit button */
.trds-form-footer {
    flex-shrink: 0 !important;
    background: var(--trds-surface, #ffffff) !important;
    padding-top: 15px !important;
    margin-top: 8px !important;
}

/* Reset p margins inside footer */
.trds-form-footer > p {
    margin: 0 !important;
}

.trds-submit-btn,
.trds-form-footer input[type="submit"] {
    width: 100% !important;
    background: linear-gradient(135deg, var(--trds-course-primary, #003d82) 0%, var(--trds-course-primary-dark, #002855) 100%) !important;
    color: white !important;
    padding: 16px !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    min-height: 56px !important;
    margin-bottom: 8px !important;
}

.trds-submit-btn:hover,
.trds-form-footer input[type="submit"]:hover {
    background: linear-gradient(135deg, var(--trds-course-primary-dark, #002855) 0%, var(--trds-course-primary, #003d82) 100%) !important;
    box-shadow: 0 4px 12px rgba(0, 61, 130, 0.4) !important;
    transform: translateY(-2px) !important;
}

.trds-submit-btn:active,
.trds-form-footer input[type="submit"]:active {
    transform: translateY(0) !important;
}

/* Hide CF7 spinner */
.trds-form-footer .wpcf7-spinner {
    display: none !important;
}

.trds-legal {
    font-size: 12px !important;
    color: var(--trds-text-secondary, #6b5b52) !important;
    text-align: center !important;
    margin: 0 !important;
    line-height: 1.4 !important;
}

/* Hide br tags inside legal */
.trds-legal br {
    display: none !important;
}

/* Hide duplicate legal text - only show first one */
.trds-form-footer .trds-legal ~ .trds-legal {
    display: none !important;
}

.trds-legal a {
    color: var(--trds-primary, #8b4513) !important;
    text-decoration: underline !important;
}

.trds-legal a:hover {
    color: var(--trds-primary-dark, #6b3410) !important;
}

.trds-modal-cf7-form input[type="text"],
.trds-modal-cf7-form input[type="email"],
.trds-modal-cf7-form input[type="tel"],
.trds-modal-cf7-form textarea,
.trds-modal-cf7-form select {
    width: 100%;
    padding: 16px;
    border: 2px solid var(--trds-border, #e0d6d1);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    background: transparent;
    color: var(--trds-text-primary, #2c1810);
    transition: var(--trds-modal-transition);
    outline: none;
    box-sizing: border-box;
    min-height: 56px;
}

.trds-modal-cf7-form input:focus,
.trds-modal-cf7-form textarea:focus,
.trds-modal-cf7-form select:focus {
    border-color: var(--trds-primary, #8b4513);
}

.trds-modal-cf7-form textarea {
    min-height: 120px;
    resize: vertical;
}

/* Reset CF7 form control wrap margins when inside our custom structure */
.trds-modal-cf7-form .wpcf7-form-control-wrap {
    display: block !important;
    margin: 0 !important;
}

/* Only add margin when NOT inside our custom groups */
.trds-modal-cf7-form > .wpcf7-form-control-wrap {
    margin-bottom: 8px !important;
}

.trds-modal-cf7-form label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--trds-text-primary, #2c1810);
    margin-bottom: 8px;
}

.trds-modal-cf7-form .wpcf7-submit {
    width: 100%;
    background: linear-gradient(135deg, var(--trds-course-primary, #003d82) 0%, var(--trds-course-primary-dark, #002855) 100%);
    color: white;
    padding: 16px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--trds-modal-transition);
    min-height: 56px;
    margin-top: auto;
}

.trds-modal-cf7-form .wpcf7-submit:hover {
    background: linear-gradient(135deg, var(--trds-course-primary-dark, #002855) 0%, var(--trds-course-primary, #003d82) 100%);
    box-shadow: 0 4px 12px rgba(0, 61, 130, 0.4);
}

.trds-modal-cf7-form .wpcf7-submit:focus-visible {
    outline: 3px solid var(--trds-focus-ring-color, #000);
    outline-offset: 4px;
}

/* CF7 Validation Messages */
.trds-modal-cf7-form .wpcf7-not-valid-tip {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.35;
    max-width: 100%;
    /* Validation tips are positioned in normal flow and must not enlarge
       the input itself, so the field/label keep their original size. */
    position: static;
    color: var(--trds-error, #a64444);
}

.trds-modal-cf7-form .wpcf7-response-output {
    border-radius: 8px;
    padding: 12px;
    margin: 20px 0 0 0;
    font-size: 14px;
}

.trds-modal-cf7-form .wpcf7-validation-errors {
    background-color: #fff3cd;
    border: 2px solid #ffc107;
    color: #856404;
}

.trds-modal-cf7-form .wpcf7-mail-sent-ok {
    background-color: #d4edda;
    border: 2px solid #28a745;
    color: #155724;
}

.trds-modal-cf7-form .wpcf7-mail-sent-ng {
    background-color: #f8d7da;
    border: 2px solid #dc3545;
    color: #721c24;
}

/* CF7 still validates and submits the form; its duplicate inline notices are
   replaced by the Applications toast messages. */
.trds-modal__cf7-container .wpcf7-response-output,
.trds-modal__cf7-container .wpcf7-not-valid-tip {
    display: none !important;
}

/* Loading State */
.trds-modal-cf7-form.submitting .wpcf7-submit {
    opacity: 0.6;
    cursor: not-allowed;
}

/* --- Адаптив (Mobile) --- */
@media (max-width: 768px) {
    /* Fix: Align modal to top on mobile to prevent keyboard cutoff */
    .trds-modal-overlay {
        align-items: flex-start;
        padding: 0;
    }

    .trds-modal {
        flex-direction: column;
        width: 100%;
        height: 100vh;
        height: 100dvh; /* Dynamic viewport height - adjusts when keyboard opens */
        max-height: none;
        border-radius: 0;
    }

    .trds-modal__form-col {
        order: 2;
        flex: 1;
        padding: 20px 16px 80px 16px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain; /* Prevent scroll chaining on iOS */
    }

    /* Add extra top padding to CF7 container for floating labels */
    .trds-modal__cf7-container {
        padding-top: 8px;
    }

    .trds-modal__info-col {
        display: none;
    }

    .trds-faq-trigger {
        left: auto;
        right: 16px;
        bottom: 16px;
        box-shadow: 0 3px 12px rgba(0, 0, 0, .2);
    }

    .trds-faq-panel__header { padding: 16px; }
    .trds-faq-panel__header h2 { font-size: 20px; }
    .trds-faq-panel__content { padding: 0 16px 24px; }

    .trds-modal__close {
        top: 12px;
        right: 12px;
        width: 40px;
        height: 40px;
        background-color: rgba(0, 0, 0, 0.3);
        z-index: 100; /* Ensure close button stays on top */
    }

    .trds-modal__title {
        font-size: 20px;
        margin-bottom: 8px;
        line-height: 1.3;
        width: 25ch;
    }

    .trds-modal__subtitle {
        font-size: 14px;
        margin-bottom: 16px;
        line-height: 1.4;
    }

    .trds-info-title {
        font-size: 18px;
    }

    .trds-info-list li {
        font-size: 15px;
        margin-bottom: 18px;
    }

    .trds-form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        margin-bottom: 0 !important;
        display: grid !important; /* Ensure grid display on mobile */
    }

    .trds-form-row .trds-input-group {
        margin-bottom: 14px !important;
        width: 100% !important;
        height: 56px !important;
    }

    .trds-form-row .wpcf7-form-control-wrap {
        margin-bottom: 14px !important;
        width: 100% !important;
    }

    /* Ensure inputs inside form row are full width */
    .trds-form-row .trds-input-group input,
    .trds-form-row input.wpcf7-form-control {
        width: 100% !important;
    }

    /* Reduce input group margins on mobile */
    .trds-input-group {
        margin-bottom: 14px !important;
    }

    /* First input group needs extra top margin for floating label */
    .trds-input-group:first-of-type {
        margin-top: 10px !important;
    }

    .trds-textarea-group {
        margin-bottom: 14px !important;
    }

    /* Participation group: single row on mobile */
    .trds-participation-group {
        margin-bottom: 12px !important;
        gap: 8px !important;
    }

    .trds-toggle-container .wpcf7-list-item-label {
        font-size: 13px !important;
        padding: var(--trds-space-0-5) 6px !important;
    }

    .trds-info-list i {
        font-size: 20px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .trds-modal-overlay,
    .trds-modal,
    .trds-modal__close,
    .trds-open-modal-btn {
        transition: none;
    }

    .trds-modal__close:hover,
    .trds-open-modal-btn:hover {
        transform: none;
    }
}

/* CF7 Checkbox Chips Styling */
.trds-modal-cf7-form .wpcf7-checkbox {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0;
    padding: 0;
}

.trds-modal-cf7-form .wpcf7-list-item {
    margin: 0 !important;
    padding: 0;
}

.trds-modal-cf7-form .wpcf7-list-item-label {
    cursor: pointer;
    user-select: none;
    position: relative;
    display: inline-block;
}

.trds-modal-cf7-form .wpcf7-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.trds-modal-cf7-form .wpcf7-checkbox .wpcf7-list-item-label {
    display: inline-block;
    padding: 0 14px;
    background-color: #f0f0f0;
    border-radius: 20px;
    font-size: 14px;
    color: var(--trds-text-primary, #2c1810);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.trds-modal-cf7-form .wpcf7-checkbox .wpcf7-list-item-label:hover {
    background-color: #e0e0e0;
}

.trds-modal-cf7-form .wpcf7-checkbox input[type="checkbox"]:checked + .wpcf7-list-item-label {
    background-color: var(--trds-course-primary, #003d82);
    color: #ffffff;
    border-color: var(--trds-course-primary, #003d82);
    box-shadow: 0 4px 10px rgba(0, 61, 130, 0.3);
}

.trds-modal-cf7-form .wpcf7-checkbox input[type="checkbox"]:focus + .wpcf7-list-item-label {
    outline: 2px solid var(--trds-course-accent, #ffc107);
    outline-offset: 2px;
}

/* Selectable application topics with accessible detail tooltips */
.trds-modal-cf7-wrapper .trds-dependency-selection {
    margin: 4px 0 20px;
}

.trds-modal-cf7-wrapper .trds-dependency-heading {
    display: block;
    margin-bottom: 5px;
    color: var(--trds-text-primary, #2c1810);
    font-size: 16px;
    font-weight: 600;
}

.trds-modal-cf7-wrapper .trds-dependency-hint {
    display: block;
    margin-bottom: 12px;
    color: var(--trds-text-muted, #8d7a75);
    font-size: 13px;
}

.trds-modal-cf7-wrapper .trds-dependency-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.trds-modal-cf7-wrapper .trds-dependency-card {
    position: relative;
    min-width: 0;
    min-height: 72px;
    overflow: visible;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-form-control-wrap,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item label {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item label {
    position: relative;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox input[type="checkbox"] {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    clip-path: inset(50%);
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item-label {
    display: flex;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 72px;
    padding: 14px 43px 14px 16px;
    border: 1px solid var(--trds-border, #e0d6d1);
    border-radius: 12px;
    background: #fff;
    color: var(--trds-text-primary, #2c1810);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.35;
    transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item-label::before {
    display: none;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox input[type="checkbox"]:checked + .wpcf7-list-item-label {
    border-color: var(--trds-course-primary, #003d82);
    background: #edf4fc;
    color: var(--trds-course-primary, #003d82);
    box-shadow: 0 0 0 1px var(--trds-course-primary, #003d82);
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox input[type="checkbox"]:focus-visible + .wpcf7-list-item-label {
    outline: 2px solid var(--trds-course-accent, #ffc107);
    outline-offset: 2px;
}

.trds-modal-cf7-wrapper .trds-dependency-info {
    position: absolute;
    z-index: 2;
    top: 9px;
    right: 9px;
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 1px solid #9aaec3;
    border-radius: 50%;
    background: #fff;
    color: var(--trds-course-primary, #003d82);
    font: italic 600 15px/1 Georgia, serif;
    cursor: help;
}

.trds-modal-cf7-wrapper .trds-dependency-info:hover,
.trds-modal-cf7-wrapper .trds-dependency-info:focus-visible {
    border-color: var(--trds-course-primary, #003d82);
    background: var(--trds-course-primary, #003d82);
    color: #fff;
    outline: none;
}

.trds-modal-cf7-wrapper .trds-dependency-tooltip {
    position: absolute;
    z-index: 10;
    top: calc(100% - 4px);
    left: 0;
    display: none;
    width: max-content;
    max-width: min(280px, calc(100vw - 56px));
    padding: 10px 12px;
    border-radius: 8px;
    background: #18334e;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
    color: #fff;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
    white-space: normal;
    pointer-events: none;
}

.trds-modal-cf7-wrapper .trds-dependency-card:nth-child(2n) .trds-dependency-tooltip {
    right: 0;
    left: auto;
}

.trds-modal-cf7-wrapper .trds-dependency-card:nth-child(-n+2) .trds-dependency-tooltip {
    top: auto;
    bottom: calc(100% - 4px);
}

.trds-modal-cf7-wrapper .trds-dependency-info:hover + .trds-dependency-tooltip,
.trds-modal-cf7-wrapper .trds-dependency-info:focus-visible + .trds-dependency-tooltip,
.trds-modal-cf7-wrapper .trds-dependency-card.is-tooltip-open .trds-dependency-tooltip {
    display: block;
}

@media (max-width: 420px) {
    .trds-modal-cf7-wrapper .trds-dependency-grid {
        gap: 8px;
    }

    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item-label {
        min-height: 76px;
        padding: 12px 35px 12px 11px;
        font-size: 13px;
    }

    .trds-modal-cf7-wrapper .trds-dependency-info {
        top: 7px;
        right: 7px;
        width: 22px;
        height: 22px;
    }
}

/* Fix CF7 validation for floating labels */
.trds-modal-cf7-form .wpcf7-not-valid {
    border-color: var(--trds-error, #a64444) !important;
}

.trds-modal-cf7-form .wpcf7-not-valid ~ .trds-label {
    color: var(--trds-error, #a64444);
}

/* =========================================
   CF7 TEMPLATE STRUCTURE FIXES
   When CF7 form already has our custom classes,
   we need to handle the extra <p> and <br> tags
   ========================================= */

/* Main wrapper should use flex column layout */
.trds-modal-cf7-wrapper {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
    min-height: 0 !important;
}

/* Global p and br reset inside the modal form wrapper */
.trds-modal-cf7-wrapper p {
    margin: 0 !important;
    padding: 0 !important;
}

.trds-modal-cf7-wrapper br {
    display: none !important;
}

/* Input groups need relative positioning for floating labels */
.trds-modal-cf7-wrapper > .trds-input-group,
.trds-modal-cf7-wrapper .trds-form-row .trds-input-group {
    position: relative !important;
    margin-bottom: 16px !important;
    overflow: visible !important;
}

/* CF7 form control wrap - display:contents so it adds no box/height of its own */
.trds-modal-cf7-wrapper .trds-input-group .wpcf7-form-control-wrap {
    display: contents !important;
}

/* Inputs need proper sizing and placeholder for floating label trick */
.trds-modal-cf7-wrapper .trds-input,
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="text"],
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="tel"],
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="email"] {
    width: 100% !important;
    height: 56px !important;
    padding: 16px !important;
    border: 2px solid var(--trds-border, #e0d6d1) !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    background: #fff !important;
    color: var(--trds-text-primary, #2c1810) !important;
    outline: none !important;
    box-sizing: border-box !important;
    transition: border-color 0.3s ease !important;
}

.trds-modal-cf7-wrapper input.wpcf7-form-control:focus {
    border-color: var(--trds-primary, #8b4513) !important;
}

/* Floating labels - positioned inside input by default */
.trds-modal-cf7-wrapper .trds-input-group label.trds-label {
    position: absolute !important;
    left: 14px !important;
    top: 28px !important;
    transform: translateY(-50%) !important;
    background: var(--trds-surface, #ffffff) !important;
    padding: 0 4px !important;
    color: var(--trds-text-muted, #8d7a75) !important;
    font-size: 16px !important;
    font-weight: 400 !important;
    pointer-events: none !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 1 !important;
    line-height: 1 !important;
    margin: 0 !important;
}

/* Floating label - active state on focus */
.trds-modal-cf7-wrapper .trds-input-group:focus-within label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-primary, #8b4513) !important;
    font-weight: 600 !important;
}

/* Floating label - active state when has value */
.trds-modal-cf7-wrapper .trds-input-group:has(input:not(:placeholder-shown)) label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-primary, #8b4513) !important;
    font-weight: 600 !important;
}

/* Fallback for has-value class added by JavaScript */
.trds-modal-cf7-wrapper .trds-input-group.has-value label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    color: var(--trds-primary, #8b4513) !important;
    font-weight: 600 !important;
}

/* Form row for two-column layout */
.trds-modal-cf7-wrapper > .trds-form-row {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
}

.trds-modal-cf7-wrapper > .trds-form-row > .trds-input-group {
    position: relative !important;
    margin-bottom: 0 !important;
    overflow: visible !important;
}

/* Scroll area for checkboxes */
.trds-modal-cf7-wrapper > .trds-problems-scroll-area {
    flex: 1 !important;
    overflow-y: auto !important;
    margin: 8px 0 !important;
    padding: 12px 10px 5px 0 !important;
    border-top: 1px solid #eee !important;
    border-bottom: 1px solid #eee !important;
    min-height: 0 !important;
}

/* Section label inside scroll area */
.trds-modal-cf7-wrapper .trds-section-label {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    margin-bottom: 10px !important;
    color: var(--trds-text-primary, #2c1810) !important;
}

/* Category groups inside scroll area */
.trds-modal-cf7-wrapper .trds-category-group {
    margin-bottom: 12px !important;
}

.trds-modal-cf7-wrapper .trds-category-title {
    display: block !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: var(--trds-text-secondary, #6b5b52) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    margin-bottom: 6px !important;
}

.trds-modal-cf7-wrapper .trds-chips-container {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
}

/* Make p inside chips container inline */
.trds-modal-cf7-wrapper .trds-chips-container > p {
    display: contents !important;
}

/* Form footer with submit button */
.trds-modal-cf7-wrapper > .trds-form-footer {
    flex-shrink: 0 !important;
    padding-top: 15px !important;
    margin-top: 8px !important;
    background: #fff !important;
}

/* Submit button styling */
.trds-modal-cf7-wrapper .trds-form-footer input[type="submit"],
.trds-modal-cf7-wrapper .trds-submit-btn {
    width: 100% !important;
    height: 56px !important;
    background: linear-gradient(135deg, var(--trds-course-primary, #003d82) 0%, var(--trds-course-primary-dark, #002855) 100%) !important;
    color: #fff !important;
    border: none !important;
    border-radius: 8px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.3s ease !important;
    margin-bottom: 8px !important;
}

.trds-modal-cf7-wrapper .trds-form-footer input[type="submit"]:hover {
    background: linear-gradient(135deg, var(--trds-course-primary-dark, #002855) 0%, var(--trds-course-primary, #003d82) 100%) !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(0, 61, 130, 0.4) !important;
}

/* Hide CF7 spinner */
.trds-modal-cf7-wrapper .wpcf7-spinner {
    display: none !important;
}

/* Acceptance checkbox */
.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-list-item {
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance label {
    display: flex !important;
    align-items: flex-start !important;
    gap: 10px !important;
    cursor: pointer !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance input[type="checkbox"] {
    appearance: auto !important;
    -webkit-appearance: auto !important;
    width: 16px !important;
    height: 16px !important;
    min-width: 16px !important;
    margin: 2px 0 0 0 !important;
    flex-shrink: 0 !important;
    cursor: pointer !important;
    position: static !important;
    opacity: 1 !important;
    accent-color: var(--trds-primary, #8b4513) !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-list-item-label {
    font-size: 14px !important;
    color: var(--trds-text-primary, #2c1810) !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-list-item-label a {
    color: var(--trds-primary, #8b4513) !important;
    text-decoration: underline !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-list-item-label a:hover {
    color: var(--trds-primary-dark, #6b3410) !important;
}

/* Mobile responsive for wrapper */
@media (max-width: 768px) {
    .trds-modal-cf7-wrapper > .trds-form-row {
        grid-template-columns: 1fr !important;
        gap: 0 !important;
        display: grid !important;
    }

    .trds-modal-cf7-wrapper > .trds-form-row > .trds-input-group {
        margin-bottom: 14px !important;
        width: 100% !important;
        height: 56px !important;
    }

    /* Ensure form row children take full width on mobile */
    .trds-modal-cf7-wrapper > .trds-form-row > * {
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* ==========================================================================
   SUCCESS NOTICE - Telegram Invite
   ========================================================================== */

.trds-success-notice {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #ffffff;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    box-sizing: border-box;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 100001;
    text-align: center;
    animation: trdsSlideIn 0.3s ease;
}

.trds-success-notice.is-visible {
    display: block;
}

@keyframes trdsSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

.trds-success-notice__icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #00a32a 0%, #00ba37 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 50px;
    color: #fff;
}

.trds-success-notice__title {
    font-size: clamp(1.5rem, 3vw, 1.75rem);
    font-weight: 700;
    color: var(--trds-course-primary, #003d82);
    margin: 0 0 15px 0;
    line-height: 1.3;
}

.trds-success-notice__text {
    font-size: clamp(1rem, 2vw, 1.125rem);
    color: var(--trds-text-primary, #2c1810);
    line-height: 1.6;
    margin: 0 0 20px 0;
}

.trds-success-notice__important {
    background: #fff9e6;
    border-left: 4px solid var(--trds-course-accent, #ffc107);
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 8px;
    text-align: left;
}

.trds-success-notice__important strong {
    display: block;
    font-size: 1.125rem;
    color: var(--trds-course-primary, #003d82);
    margin-bottom: 8px;
}

.trds-success-notice__channels {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin: 20px 0;
}

.trds-success-notice__telegram-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #0088cc 0%, #006699 100%);
    color: #fff;
    padding: 16px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 20px 0;
    transition: all 0.3s ease;
    min-height: 56px;
    box-shadow: 0 4px 12px rgba(0, 136, 204, 0.3);
}

.trds-success-notice__telegram-btn:hover {
    background: linear-gradient(135deg, #006699 0%, #0088cc 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 136, 204, 0.4);
}

.trds-success-notice__telegram-btn:focus-visible {
    outline: 3px solid var(--trds-course-accent, #ffc107);
    outline-offset: 4px;
}

.trds-success-notice__telegram-icon {
    font-size: 28px;
}

.trds-success-notice__max-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
    color: #fff;
    padding: 16px 32px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 1.125rem;
    font-weight: 600;
    transition: all 0.3s ease;
    min-height: 56px;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}

.trds-success-notice__max-btn:hover {
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.trds-success-notice__max-btn:focus-visible {
    outline: 3px solid var(--trds-course-accent, #ffc107);
    outline-offset: 4px;
}

.trds-success-notice__max-icon {
    font-size: 28px;
}

.trds-success-notice__close {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e0e0;
}

.trds-success-notice__close-btn {
    background: transparent;
    border: 2px solid var(--trds-neutral-200);
    color: var(--trds-neutral-500);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.trds-success-notice__close-btn:hover {
    background: var(--trds-course-primary, #003d82);
    color: #fff;
}

.trds-success-notice__close-btn:focus-visible {
    outline: 3px solid var(--trds-course-accent, #ffc107);
    outline-offset: 2px;
}

/* Success Notice Overlay */
.trds-success-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(44, 24, 16, 0.7);
    /* backdrop-filter: blur(4px); */
    z-index: 100000;
}

.trds-success-overlay.is-visible {
    display: block;
}

/* Mobile Responsive */
@media (max-width: 640px) {
    .trds-success-notice {
        width: calc(100% - 24px);
        max-width: 400px;
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 20px 16px;
    }

    .trds-success-notice__icon {
        width: 48px;
        height: 48px;
        margin-bottom: 10px;
        font-size: 30px;
    }

    .trds-success-notice__title {
        margin-bottom: 10px;
        font-size: 1.375rem;
    }

    .trds-success-notice__text {
        margin-bottom: 12px;
        font-size: 0.9375rem;
        line-height: 1.45;
    }

    .trds-success-notice__important {
        margin: 12px 0;
        padding: 12px 15px;
    }

    .trds-success-notice__channels {
        gap: 10px;
        margin: 16px 0;
    }

    .trds-success-notice__telegram-btn,
    .trds-success-notice__max-btn {
        width: 100%;
        min-height: 52px;
        margin: 0;
        padding: 10px 16px;
        box-sizing: border-box;
        font-size: 1rem;
    }

    .trds-success-notice__close {
        margin-top: 16px;
        padding-top: 16px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .trds-success-notice {
        animation: none;
    }

    .trds-success-notice__telegram-btn:hover,
    .trds-success-notice__max-btn:hover,
    .trds-success-notice__close-btn:hover {
        transform: none;
    }
}

/* ==========================================================================
   FORM VALIDATION ERRORS
   ========================================================================== */

.trds-input-group.has-error label {
    color: #d63638 !important;
}

/* ==========================================================================
   SPAM PROTECTION - HONEYPOT
   ========================================================================== */

/* Hide honeypot field from human users (bots will still fill it) */
.trds-hp-field,
input.trds-hp-field,
.wpcf7-form-control-wrap[data-name="trds-honeypot"] {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

/* ==========================================================================
   Double-check confirmation step
   ========================================================================== */
.trds-submission-pending {
    position: relative;
    overflow: hidden;
    display: flex;
    min-height: 350px;
    padding: 40px 16px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    animation: trds-confirm-fade 0.25s ease;
}

.trds-submission-pending[hidden] { display: none; }
.trds-submission-pending:focus { outline: none; }

.trds-submission-pending__orbit {
    position: relative;
    display: grid;
    place-items: center;
    width: 96px;
    height: 96px;
    margin-bottom: 26px;
    border-radius: 50%;
    background: radial-gradient(circle, #fff 45%, #eef5ff 100%);
    color: var(--trds-course-primary, #003d82);
    box-shadow: 0 10px 30px rgba(0, 61, 130, 0.1);
    font-size: 36px;
}

.trds-submission-pending__orbit::before {
    content: '';
    position: absolute;
    inset: -6px;
    border: 3px solid rgba(0, 61, 130, 0.1);
    border-top-color: var(--trds-course-primary, #003d82);
    border-right-color: #ffc107;
    border-radius: 50%;
    animation: trds-submission-spin 1.4s linear infinite;
}

.trds-submission-pending__title {
    margin: 0 0 12px;
    color: var(--trds-course-primary, #003d82);
    font-size: clamp(22px, 3vw, 28px);
    line-height: 1.25;
}

.trds-submission-pending__text {
    margin: 0;
    color: var(--trds-text-primary, #2c1810);
    font-size: 15px;
    line-height: 1.6;
}

.trds-submission-pending__dots { display: flex; gap: 7px; margin-top: 24px; }
.trds-submission-pending__dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--trds-course-primary, #003d82);
    animation: trds-submission-pulse 1.2s ease-in-out infinite;
}
.trds-submission-pending__dots span:nth-child(2) { animation-delay: 0.15s; }
.trds-submission-pending__dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes trds-submission-spin { to { transform: rotate(360deg); } }
@keyframes trds-submission-pulse {
    0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
    40% { opacity: 1; transform: translateY(-4px); }
}
@media (prefers-reduced-motion: reduce) {
    .trds-submission-pending,
    .trds-submission-pending__orbit::before,
    .trds-submission-pending__dots span { animation: none; }
}

.trds-submission-pending.is-celebrating .trds-submission-pending__text,
.trds-submission-pending.is-celebrating .trds-submission-pending__dots { display: none; }
.trds-submission-pending.is-celebrating .trds-submission-pending__orbit {
    z-index: 1;
    margin-bottom: 20px;
    background: linear-gradient(135deg, #fff4cc, #ffc107);
    box-shadow: 0 0 45px rgba(255, 193, 7, 0.35);
    animation: trds-celebration-pop 0.65s cubic-bezier(0.2, 1.5, 0.5, 1) both;
}
.trds-submission-pending.is-celebrating .trds-submission-pending__orbit::before {
    border: 2px solid #ffc107;
    animation: trds-celebration-ring 0.85s ease-out both;
}
.trds-submission-pending.is-celebrating svg path {
    stroke-dasharray: 45;
    stroke-dashoffset: 45;
    animation: trds-celebration-check 0.35s 0.15s ease-out forwards;
}
.trds-submission-pending.is-celebrating .trds-submission-pending__title {
    margin: 0;
    animation: trds-confirm-fade 0.3s 0.15s both;
}
.trds-submission-celebration { position: absolute; inset: 0; pointer-events: none; }
.trds-submission-celebration span {
    position: absolute;
    top: calc(50% - 28px);
    left: 50%;
    width: 7px;
    height: 12px;
    margin: -6px 0 0 -3px;
    border-radius: 2px;
    opacity: 0;
    animation: trds-celebration-burst 0.85s var(--burst-delay) cubic-bezier(0.15, 0.6, 0.35, 1) both;
}
.trds-submission-celebration span:nth-child(3n) { width: 6px; height: 6px; border-radius: 50%; }
@keyframes trds-celebration-pop {
    0% { opacity: 0; transform: scale(0.65); }
    65% { opacity: 1; transform: scale(1.12); }
    100% { opacity: 1; transform: scale(1); }
}
@keyframes trds-celebration-ring {
    from { opacity: 0.8; transform: scale(1); }
    to { opacity: 0; transform: scale(2.7); }
}
@keyframes trds-celebration-check { to { stroke-dashoffset: 0; } }
@keyframes trds-celebration-burst {
    0% { opacity: 0; transform: translate(0, 0) scale(0.4); }
    15% { opacity: 1; }
    100% { opacity: 0; transform: translate(var(--burst-x), var(--burst-y)) rotate(var(--burst-turn)) scale(0.7); }
}

.trds-confirm {
    display: none;
    padding: var(--trds-space-md, 16px) 0;
    animation: trds-confirm-fade 0.25s ease;
}

@keyframes trds-confirm-fade {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.trds-confirm__notice {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(0, 61, 130, 0.06);
    border: 1px solid rgba(0, 61, 130, 0.18);
}

.trds-confirm__icon {
    flex: 0 0 auto;
    font-size: 24px;
    line-height: 1.2;
    color: var(--trds-course-primary, #003d82);
}

.trds-confirm__text {
    margin: 0;
    font-size: 15px;
    line-height: 1.55;
    color: var(--trds-text-primary, #2c1810);
}

.trds-confirm__check {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    margin: 18px 2px 4px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--trds-text-primary, #2c1810);
    user-select: none;
}

.trds-confirm__checkbox {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    margin-top: 1px;
    accent-color: var(--trds-course-primary, #003d82);
    cursor: pointer;
}

.trds-confirm__actions {
    display: flex;
    gap: 12px;
    margin-top: 22px;
}

.trds-confirm__back,
.trds-confirm__submit {
    flex: 1 1 0;
    padding: 14px 18px;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--trds-modal-transition, 0.3s ease), opacity var(--trds-modal-transition, 0.3s ease), border-color var(--trds-modal-transition, 0.3s ease);
}

.trds-confirm__back {
    background: #fff;
    color: var(--trds-text-primary, #2c1810);
    border: 2px solid var(--trds-border, #e0d6d1);
}

.trds-confirm__back:hover {
    border-color: var(--trds-course-primary, #003d82);
    color: var(--trds-course-primary, #003d82);
}

.trds-confirm__submit {
    background: linear-gradient(135deg, var(--trds-course-primary, #003d82) 0%, var(--trds-course-primary-dark, #002855) 100%);
    color: #fff;
    border: 2px solid transparent;
}

.trds-confirm__submit:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--trds-course-primary-dark, #002855) 0%, var(--trds-course-primary, #003d82) 100%);
}

.trds-confirm__submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.trds-confirm__back:focus-visible,
.trds-confirm__submit:focus-visible,
.trds-confirm__checkbox:focus-visible {
    outline: 3px solid var(--trds-focus-ring-color, #000);
    outline-offset: 2px;
}

/* Keep empty floating labels vertically centered in the shortened fields. */
.trds-modal-cf7-wrapper .trds-input-group label.trds-label {
    top: 50% !important;
}

/* Compact registration form: keep every field reachable in the modal */
.trds-modal {
    height: min(90vh, 760px);
    max-height: calc(100dvh - 24px);
}

.trds-modal__form-col {
    padding: 24px;
    overflow: hidden;
}

.trds-modal__title {
    margin-bottom: 6px;
    font-size: 23px;
}

.trds-modal__subtitle {
    margin-bottom: 12px;
}

.trds-modal__cf7-container {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.trds-modal-cf7-wrapper > .trds-input-group,
.trds-modal-cf7-wrapper .trds-form-row {
    margin-bottom: 9px !important;
}

.trds-modal-cf7-wrapper .trds-input,
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="text"],
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="tel"],
.trds-modal-cf7-wrapper input.wpcf7-form-control[type="email"] {
    height: 44px !important;
    min-height: 44px !important;
    padding: 9px 12px !important;
    font-size: 15px !important;
}

.trds-modal-cf7-wrapper > .trds-form-row > .trds-input-group {
    height: auto !important;
}

.trds-modal-cf7-wrapper .trds-dependency-selection {
    margin: 0 0 10px;
}

.trds-modal-cf7-wrapper .trds-dependency-heading {
    font-size: 15px;
}

.trds-modal-cf7-wrapper .trds-dependency-hint {
    margin-bottom: 8px;
    font-size: 12px;
}

.trds-modal-cf7-wrapper .trds-dependency-grid {
    gap: 8px;
}

.trds-modal-cf7-wrapper .trds-dependency-card,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-form-control-wrap,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item,
.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item label {
    min-height: 54px;
}

.trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item-label {
    min-height: 54px;
    padding: 9px 38px 9px 12px;
    font-size: 14px;
}

.trds-modal-cf7-wrapper .trds-dependency-selection + .trds-textarea-group {
    min-height: 0 !important;
    margin-bottom: 9px !important;
}

.trds-modal-cf7-wrapper .trds-textarea-group textarea.wpcf7-form-control,
.trds-modal-cf7-wrapper .trds-textarea-group .trds-textarea {
    height: 64px !important;
    min-height: 64px !important;
    padding: 10px 12px !important;
    font-size: 14px !important;
    resize: vertical !important;
}

.trds-modal-cf7-wrapper > .trds-form-footer {
    padding-top: 7px !important;
    margin-top: 3px !important;
}

.trds-modal-cf7-wrapper .trds-form-footer input[type="submit"],
.trds-modal-cf7-wrapper .trds-submit-btn {
    height: 46px !important;
    min-height: 46px !important;
    margin-bottom: 6px !important;
    padding: 10px 14px !important;
}

.trds-modal-cf7-wrapper .trds-form-footer .wpcf7-list-item-label {
    font-size: 12px !important;
}

@media (max-width: 768px) {
    .trds-modal {
        height: 100vh;
        height: 100dvh;
        max-height: none;
    }

    .trds-modal__form-col {
        padding: 14px 16px 16px;
        overflow-y: auto;
    }

    .trds-modal__title {
        font-size: 19px;
        margin-bottom: 4px;
    }

    .trds-modal__subtitle {
        margin-bottom: 8px;
    }

    .trds-modal__cf7-container {
        overflow: visible;
        padding-top: 4px;
    }

    .trds-modal-cf7-wrapper > .trds-form-row {
        margin-bottom: 0 !important;
    }

    .trds-modal-cf7-wrapper .trds-form-row .trds-input-group {
        height: auto !important;
        margin-bottom: 9px !important;
    }

    .trds-modal-cf7-wrapper > .trds-input-group:first-of-type {
        margin-top: 0 !important;
    }

    .trds-modal-cf7-wrapper .trds-dependency-card,
    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-form-control-wrap,
    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-checkbox,
    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item,
    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item label,
    .trds-modal-cf7-wrapper .trds-dependency-card .wpcf7-list-item-label {
        min-height: 54px;
    }
}

/* Float labels across the field border and mask the line beneath their text. */
.trds-modal-cf7-wrapper .trds-input-group:focus-within label.trds-label,
.trds-modal-cf7-wrapper .trds-input-group:has(input:not(:placeholder-shown)) label.trds-label,
.trds-modal-cf7-wrapper .trds-input-group.has-value label.trds-label {
    top: 0 !important;
    transform: translateY(-50%) scale(0.85) !important;
    transform-origin: left center !important;
    z-index: 2 !important;
    padding: 0 5px !important;
    background: var(--trds-surface, #ffffff) !important;
}

.trds-modal__cf7-container {
    padding-top: 12px;
}

@media (max-width: 768px) {
    .trds-modal__cf7-container {
        padding-top: 12px !important;
    }

    /* Let the form grow vertically; the form column is the only scroll area. */
    .trds-modal__cf7-container,
    .trds-modal__cf7-container .wpcf7,
    .trds-modal-cf7-form,
    .trds-modal-cf7-wrapper {
        flex: 0 0 auto;
        height: auto;
        min-height: 0;
        overflow: visible;
    }

    .trds-modal-cf7-wrapper > .trds-problems-scroll-area {
        flex: 0 0 auto !important;
        overflow: visible !important;
    }

    .trds-modal-cf7-wrapper .trds-textarea-group,
    .trds-modal-cf7-wrapper .trds-participation-group,
    .trds-modal-cf7-wrapper > .trds-form-footer {
        flex-shrink: 0 !important;
    }
}

@media (max-width: 600px) {
    .trds-registration-help {
        top: auto;
        bottom: max(80px, calc(env(safe-area-inset-bottom) + 64px));
        left: max(16px, env(safe-area-inset-left));
    }

    .trds-registration-help::after {
        left: 19px;
        width: 33px;
        height: 30px;
        clip-path: polygon(0 0, 100% 0, 12% 100%);
    }
}

/* Validation overlays keep controls clickable and preserve the normal focus ring. */
.trds-modal-cf7-wrapper .trds-dependency-selection,
.trds-modal-cf7-wrapper .trds-input-group,
.trds-modal-cf7-wrapper .wpcf7-acceptance {
    position: relative;
}

.trds-modal-cf7-wrapper .trds-dependency-selection,
.trds-modal-cf7-wrapper .wpcf7-acceptance {
    isolation: isolate;
}

/* Keep topic tooltips above the following comments field. */
.trds-modal-cf7-wrapper .trds-dependency-selection {
    z-index: 1;
}

.trds-modal-cf7-wrapper .trds-dependency-selection.has-error::after,
.trds-modal-cf7-wrapper .trds-input-group.has-error::after,
.trds-modal-cf7-wrapper .wpcf7-acceptance.has-error::after {
    content: '';
    position: absolute;
    inset: -3px;
    z-index: 5;
    border-radius: 6px;
    background: rgba(255, 76, 61, 0.2);
    pointer-events: none;
}

.trds-validation-error-hint {
    position: absolute;
    z-index: 5;
    box-sizing: border-box;
    padding: 8px 14px 8px 38px;
    background: rgb(255 70 57 / 72%);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    color: #fff;
    clip-path: polygon(28px 0, 100% 0, 100% 100%, 28px 100%, 0 var(--trds-arrow-tip, 50%));
    font: 500 14px/1.3 Arial, sans-serif;
    text-align: center;
    white-space: pre-line;
    pointer-events: none;
}

.trds-validation-error-hint[hidden] {
    display: none;
}

@media (max-width: 768px) {
    .trds-validation-error-hint {
        display: none;
    }
}

.trds-modal-cf7-wrapper .trds-dependency-selection.has-error .trds-dependency-heading {
    color: #b42318;
}

.trds-modal-cf7-wrapper .trds-input-group input:focus,
.trds-modal-cf7-wrapper .trds-input-group textarea:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16) !important;
}

/* Repeat applications: compact, scrollable correction request. */
.trds-repeat {
    overflow-y: auto;
    min-height: 0;
    max-height: 100%;
    padding: 2px 3px 16px;
    color: var(--trds-text-primary, #2c1810);
    font-size: 14px;
    line-height: 1.5;
}
.trds-repeat h3 { margin: 0 0 10px; font-size: 20px; }
.trds-repeat__intro { margin: 0 0 12px; }
.trds-repeat__hint { margin: 0 0 12px; color: #735b4f; font-size: 13px; }
.trds-repeat__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.trds-repeat__field { min-width: 0; border: 1px solid #ded4ce; border-radius: 8px; padding: 9px; }
.trds-repeat__choice, .trds-repeat__consent { display: flex; gap: 7px; align-items: flex-start; cursor: pointer; }
.trds-repeat__choice { font-weight: 600; }
.trds-repeat input[type="checkbox"] { width: 16px; height: 16px; flex-shrink: 0; margin: 3px 0 0; accent-color: #003d82; }
.trds-repeat__editor { margin-top: 8px; }
.trds-repeat [hidden] { display: none !important; }
.trds-repeat__editor input:not([type="checkbox"]), .trds-repeat__editor select, .trds-repeat textarea {
    box-sizing: border-box; width: 100%; height: 40px; border: 1px solid #ded4ce; border-radius: 6px; padding: 8px 10px;
    color: #2c1810; background: #fff; font: inherit;
}
.trds-repeat__editor fieldset { border: 0; padding: 0; margin: 0; }
.trds-repeat__editor legend { font-size: 12px; margin-bottom: 5px; }
.trds-repeat__editor fieldset label { display: flex; gap: 6px; margin-bottom: 5px; font-size: 13px; }
.trds-repeat__comment-label { display: block; margin-top: 12px; font-weight: 600; }
.trds-repeat textarea { display: block; height: 80px; resize: vertical; margin-top: 5px; font-weight: 400; }
.trds-repeat__consent { margin: 12px 0; font-size: 12px; }
.trds-repeat .is-invalid { border-color: #a92d2d; outline: 1px solid #a92d2d; border-radius: 6px; }
.trds-repeat input:focus-visible, .trds-repeat select:focus-visible, .trds-repeat textarea:focus-visible { outline: 2px solid #003d82; outline-offset: 1px; }
.trds-repeat .trds-confirm__actions { position: static; margin-top: 8px; padding: 10px 0; background: #fff; }
@media (max-width: 480px) {
    .trds-repeat__fields { grid-template-columns: 1fr; }
    .trds-repeat .trds-confirm__actions { flex-wrap: wrap; }
    .trds-repeat .trds-confirm__actions button { flex: 1 1 150px; }
}
.trds-repeat__invite { display: block; margin: 16px 0; color: #003d82; font-weight: 600; }
.trds-repeat__auth { border: 1px solid #bfd1e5; background: #f3f7fc; border-radius: 8px; margin-top: 12px; padding: 12px; }
.trds-repeat__auth p { margin: 0 0 8px; font-size: 13px; }
.trds-repeat__auth-button { border: 1px solid #003d82; color: #003d82; background: #fff; padding: 8px 12px; border-radius: 6px; font: inherit; cursor: pointer; }
.trds-repeat__auth-button:disabled { opacity: .6; cursor: wait; }
.trds-repeat__code-row { display: flex; gap: 8px; margin: 10px 0; }
.trds-repeat__code-row input { min-width: 0; width: 170px; border: 1px solid #ded4ce; border-radius: 6px; padding: 8px 10px; font: inherit; text-align: center; font-size: 22px; font-weight: 600; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.trds-repeat__fallback { display: block; padding: 0; margin-top: 10px; border: 0; background: transparent; color: #003d82; text-align: left; font: inherit; text-decoration: underline; cursor: pointer; }
.trds-repeat__auth-status { color: #245c35; }

/* Email proof: a centered branded step with local icons. */
.trds-modal__form-col:has(.trds-email-verification) {
    background:
        radial-gradient(ellipse at 100% 0%, #e9f2fc 0%, transparent 55%),
        radial-gradient(ellipse at 0% 100%, #f5eee5 0%, transparent 55%),
        #fcfbf8;
}
.trds-modal__cf7-container:has(.trds-email-verification) {
    padding-top: 0 !important;
}
.trds-modal__cf7-container .wpcf7:has(.trds-email-verification) {
    flex: 1 0 auto;
}
.trds-email-verification {
    flex: 0 0 auto;
    width: 100%;
    max-width: 420px;
    max-height: none;
    box-sizing: border-box;
    margin: auto;
    padding: 28px 12px;
    overflow: visible;
    text-align: center;
}
.trds-email-verification__emblem {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin: 0 auto 24px;
    border: 1px solid #d3e1ef;
    border-radius: 26px;
    background: linear-gradient(145deg, #fff, #e4eef9);
    box-shadow: 0 12px 30px rgba(0, 61, 130, .08);
    color: #003d82;
}
.trds-email-verification__emblem::before,
.trds-email-verification > .trds-repeat__auth-button::before,
.trds-email-verification > .trds-repeat__fallback::before {
    content: '';
    display: inline-block;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: currentColor;
    -webkit-mask: var(--trds-email-icon) center / contain no-repeat;
    mask: var(--trds-email-icon) center / contain no-repeat;
}
.trds-email-verification__emblem::before {
    --trds-email-icon: url('../icons/phosphor/envelope-simple-duotone.svg');
    width: 48px;
    height: 48px;
}
.trds-email-verification h3 {
    margin: 0 0 14px;
    font-size: clamp(24px, 4vw, 30px);
    line-height: 1.2;
    color: var(--trds-text-primary, #2c1810);
}
.trds-email-verification__hint {
    margin: 0 0 24px;
    color: var(--trds-text-secondary, #5d4037);
    font-size: 15px;
    line-height: 1.65;
}
.trds-email-verification .trds-repeat__auth-button {
    min-height: 48px;
    padding: 12px 20px;
    border-radius: 10px;
    border-color: #003d82;
    background: linear-gradient(135deg, #003d82, #002855);
    color: #fff;
    font-weight: 600;
    line-height: 1.4;
    box-shadow: 0 6px 16px rgba(0, 61, 130, .15);
}
.trds-email-verification > .trds-repeat__auth-button {
    --trds-email-icon: url('../icons/phosphor/paper-plane-tilt.svg');
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}
.trds-email-verification .trds-repeat__auth-button:hover:not(:disabled) {
    background: #002855;
}
.trds-email-verification button:focus-visible {
    outline: 3px solid #003d82;
    outline-offset: 4px;
}
.trds-email-verification .trds-repeat__code-row {
    flex-direction: column;
    margin: 20px 0 0;
    gap: 12px;
}
.trds-email-verification .trds-repeat__code-row input {
    box-sizing: border-box;
    width: 100%;
    min-height: 50px;
    border-color: #bfd1e5;
    border-radius: 10px;
    background: #fff;
    text-align: center;
    font-size: 24px;
    letter-spacing: .08em;
}
.trds-email-verification__status {
    margin: 16px 0 0;
    color: #245c35;
    font-size: 13px;
    overflow-wrap: anywhere;
}
.trds-email-verification__status:empty { display: none; }
.trds-email-verification > .trds-repeat__fallback {
    --trds-email-icon: url('../icons/phosphor/arrow-left.svg');
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    margin: 14px auto 0;
    text-align: center;
    text-decoration: none;
}
.trds-email-verification > .trds-repeat__fallback:hover { text-decoration: underline; }

/* The repeat step has its own heading and introduction. */
.trds-modal-overlay.is-repeat-request .trds-modal__form-col > .trds-modal__title,
.trds-modal-overlay.is-repeat-request .trds-modal__form-col > .trds-modal__subtitle {
    display: none;
}

/* Separate repeat participation from changes to an existing application. */
.trds-repeat__purpose, .trds-repeat__reuse { border: 0; margin: 12px 0; padding: 0; min-width: 0; }
.trds-repeat__purpose { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.trds-repeat__purpose legend, .trds-repeat__reuse legend { margin-bottom: 8px; font-weight: 600; }
.trds-repeat__purpose legend { width: 100%; margin-bottom: 0; }
.trds-repeat__purpose .trds-repeat__role-option { position: relative; display: flex; align-items: center; justify-content: center; min-width: 96px; margin: 0; padding: 6px 14px; border: 2px solid #ded4ce; border-radius: 8px; background: #fff; color: #5d4037; font-weight: 600; cursor: pointer; }
.trds-repeat__purpose .trds-repeat__role-option.is-selected { border-color: #003d82; background: #003d82; color: #fff; box-shadow: 0 4px 10px rgba(0, 61, 130, .24); }
.trds-repeat__purpose .trds-repeat__role-option input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.trds-repeat__purpose .trds-repeat__role-option:focus-within { outline: 2px solid #003d82; outline-offset: 2px; }
.trds-repeat input[type="radio"] { width: 16px; height: 16px; flex-shrink: 0; margin: 3px 0 0; accent-color: #003d82; }
.trds-new-course-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; padding: 10px; border: 1px solid #bfd1e5; border-radius: 8px; background: #f3f7fc; font-size: 13px; }
.trds-new-course-banner button { padding: 0; border: 0; background: transparent; color: #003d82; font: inherit; text-decoration: underline; cursor: pointer; }

.trds-repeat__intro { white-space: pre-line; }
.trds-repeat__topics { margin-top: 14px; }
.trds-repeat__topics .trds-dependency-selection { margin-bottom: 14px; }
.trds-repeat__topics.is-invalid .trds-dependency-card { border-color: #d63638; background: #fff7f7; }

/* Consent must remain in normal flow, above the repeat submission actions. */
.trds-repeat > .trds-repeat__consent {
    display: flex !important;
    position: static !important;
    align-items: flex-start;
    gap: 10px;
    min-height: 20px;
    flex-shrink: 0;
    margin: 14px 0 8px;
    padding: 8px 0;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible;
    line-height: 1.5;
}
.trds-repeat__consent > input[type="checkbox"] {
    display: block !important;
    position: static !important;
    appearance: auto !important;
    -webkit-appearance: checkbox !important;
    width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    min-height: 20px !important;
    flex: 0 0 20px;
    margin: 2px 0 0 !important;
    padding: 0;
    opacity: 1 !important;
    visibility: visible !important;
    clip: auto !important;
    clip-path: none !important;
    transform: none !important;
}
.trds-repeat__consent > span { min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 768px) {
    .trds-repeat { flex: 0 0 auto; max-height: none; overflow: visible; }
    .trds-repeat .trds-confirm__actions { position: static; }
    .trds-repeat__code-row { flex-wrap: wrap; }
}

/* Center the repeat-request confirmation in the available modal height. */
.trds-modal__form-col:has(.trds-repeat--success) {
    background:
        radial-gradient(ellipse at 90% 10%, #e9f2fc 0%, transparent 55%),
        radial-gradient(ellipse at 10% 90%, #f6eee6 0%, transparent 55%),
        #fcfbf8;
}
.trds-modal__cf7-container:has(.trds-repeat--success) {
    padding-top: 0 !important;
}
.trds-repeat.trds-repeat--success {
    display: flex;
    flex: 1 0 auto;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    min-height: 100%;
    max-height: none;
    padding: 20px 0;
    overflow: visible;
}
.trds-repeat__success-card {
    box-sizing: border-box;
    width: min(100%, 430px);
    margin: auto;
    padding: clamp(24px, 5vw, 38px);
    border: 1px solid #d6e3f0;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 18px 45px rgba(0, 47, 101, .10);
    text-align: center;
}
.trds-repeat__success-emblem {
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 76px;
    height: 76px;
    margin: 0 auto 22px;
    border: 1px solid #d3e1ef;
    border-radius: 24px;
    background: linear-gradient(145deg, #fff, #e4eef9);
    box-shadow: 0 10px 25px rgba(0, 61, 130, .08);
    color: #003d82;
    font: 700 38px/1 system-ui, sans-serif;
}
.trds-repeat--success h3 {
    margin: 0 0 14px;
    color: var(--trds-text-primary, #2c1810);
    font-size: clamp(22px, 3vw, 28px);
    line-height: 1.2;
}
.trds-repeat__success-message {
    margin: 0;
    color: var(--trds-text-secondary, #5d4037);
    font-size: 15px;
    line-height: 1.6;
}
.trds-repeat__success-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 26px;
}
.trds-repeat--success .trds-repeat__invite,
.trds-repeat__success-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    min-height: 46px;
    margin: 0;
    padding: 10px 22px;
    border: 1px solid #003d82;
    border-radius: 9px;
    background: #003d82;
    box-shadow: 0 5px 14px rgba(0, 61, 130, .15);
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.3;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
}
.trds-repeat--success .trds-repeat__invite:hover,
.trds-repeat__success-close:hover { background: #002855; color: #fff; }
.trds-repeat--success .trds-repeat__invite:focus-visible,
.trds-repeat__success-close:focus-visible { outline: 3px solid #c48132; outline-offset: 3px; }
@media (max-width: 480px) {
    .trds-repeat.trds-repeat--success { padding: 16px 0; }
    .trds-repeat__success-card { padding: 28px 22px; }
    .trds-repeat__success-emblem { width: 68px; height: 68px; margin-bottom: 20px; font-size: 34px; }
}

/* Country code and national number share one phone field. */
.trds-modal-cf7-wrapper .trds-phone-composite {
    position: relative !important;
}
.trds-modal-cf7-wrapper .trds-phone-composite .trds-phone-country {
    display: none !important;
}
.trds-modal-cf7-wrapper .trds-phone-composite .trds-phone-picker {
    position: absolute;
    top: 2px;
    left: 2px;
    box-sizing: border-box;
    width: 70px;
    height: 40px;
    border-right: 1px solid var(--trds-border, #e0d6d1);
    border-radius: 6px 0 0 6px;
    background: #fff;
    color: var(--trds-text-primary, #2c1810);
    font-size: 13px;
}
.trds-modal-cf7-wrapper .trds-phone-composite:has(.trds-phone-picker[open]) {
    padding-bottom: 142px;
}
.trds-phone-picker summary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    cursor: pointer;
    list-style: none;
    user-select: none;
}
.trds-phone-picker summary::-webkit-details-marker {
    display: none;
}
.trds-phone-picker__flag {
    font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
    font-size: 17px;
    line-height: 1;
}
.trds-phone-picker__menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 128px;
    padding: 4px;
    border: 1px solid var(--trds-border, #e0d6d1);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(30, 32, 45, .18);
}
.trds-phone-picker__option {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    min-height: 32px;
    padding: 5px 7px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--trds-text-primary, #2c1810);
    font: inherit;
    text-align: left;
    cursor: pointer;
}
.trds-phone-picker__option:hover,
.trds-phone-picker__option:focus-visible,
.trds-phone-picker__option[aria-pressed="true"] {
    background: #e9f1fb;
    color: #003d82;
}
.trds-modal-cf7-wrapper .trds-phone-composite input[type="tel"],
.trds-modal-cf7-wrapper .trds-phone-composite input.wpcf7-form-control[type="tel"] {
    padding-left: 77px !important;
    padding-right: 7px !important;
    letter-spacing: -0.02em;
}
.trds-modal-cf7-wrapper .trds-phone-composite label.trds-label {
    top: 0 !important;
    left: 12px !important;
    transform: translateY(-50%) scale(0.85) !important;
    transform-origin: left center !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    z-index: 4 !important;
}
.trds-modal-cf7-wrapper .trds-phone-composite:focus-within input[type="tel"] {
    border-color: #003d82 !important;
}

@media (max-width: 600px) {
    .trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance {
        padding-left: 56px !important;
    }

    .trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance input[type="checkbox"] {
        width: 21px !important;
        height: 21px !important;
        min-width: 21px !important;
    }

    .trds-modal-cf7-wrapper .trds-form-footer .wpcf7-acceptance .wpcf7-list-item-label {
        font-size: 15.6px !important;
    }
}

/* Click-to-open email confirmation help. */
.trds-input-group.trds-email-group input[type="email"] {
    padding-right: 52px !important;
}
.trds-input-group.trds-email-group.is-email-help-open {
    z-index: 10;
}
.trds-email-group .trds-email-help {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #b5c7df;
    border-radius: 50%;
    background: #f2f6fc;
    color: #064487;
    font: 700 18px/1 Arial, sans-serif;
    cursor: pointer;
}
.trds-email-group .trds-email-help:hover,
.trds-email-group .trds-email-help[aria-expanded="true"] {
    background: #e2edfc;
    border-color: #064487;
}
.trds-email-group .trds-email-help:focus-visible {
    outline: 3px solid #2563eb;
    outline-offset: 2px;
}
.trds-email-group .trds-email-help-tooltip {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 8;
    box-sizing: border-box;
    width: min(340px, calc(100vw - 80px));
    padding: 14px 16px;
    border: 1px solid #b5c7df;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 8px 24px rgb(0 35 75 / 16%);
    color: #243b53;
    font: 400 14px/1.5 Arial, sans-serif;
    text-align: left;
}
.trds-email-group .trds-email-help-tooltip[hidden] {
    display: none;
}
