/* =========================================
   ПЕРЕОПРЕДЕЛЕНИЕ BOOTSTRAP MODAL
   ========================================= */
.reg-modal{
    --bs-modal-footer-gap: 0;
}

/* Ширина модалки и отступы */
.reg-modal .modal-dialog{
    margin: 8px;
    max-width: calc(100% - 16px);
}

/* Стили контента */
.reg-modal .modal-content{
    padding: 16px;
    border-radius: 12px;
    border: none;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative; /* Для абсолютного позиционирования кнопки закрытия */
    background-color: var(--light-blue-bg);
    overflow: auto;
}

/* Кнопка закрытия (переопределение btn-close) */
.reg-modal .btn-close{
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    opacity: 1;
    background-size: 1.5rem;
    width: 24px;
    height: 24px;
    padding: 0;
    margin: 0;
    display: none;
}

.reg-modal .btn-close:hover{
    opacity: 0.7;
}

/* Убираем стандартные отступы Bootstrap у header/body/footer */
.reg-modal .modal-header,
.reg-modal .modal-body,
.reg-modal .modal-footer{
    padding: 0;
    border: none;
    display: block;
}

.reg-modal .modal-header{
    margin-bottom: 10px;
}

.reg-modal .modal-body{
    padding-top: 10px;
}

.reg-modal .modal-body:focus{
    outline: none;
}

/* =========================================
   ЗАГОЛОВОК МОДАЛКИ
   ========================================= */

.reg-modal__title{
    --fs-min: 20;
    --fs-max: 52;
    margin: 0;
    color: #1A3A52;
    line-height: 1.2;
}

/* =========================================
   ПЕРЕКЛЮЧАТЕЛИ РЕЖИМА (кандидат на удаление)
   ========================================= */

.reg-mode-switch{
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.reg-mode-switch__btn{
    padding: 8px 24px;
    border: none;
    background: rgba(16, 43, 76, 0.07);
    color: rgba(16, 43, 76, 0.5);
    font-size: 16px;
    font-weight: 500;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
}

.reg-mode-switch__btn:hover{
    background: rgba(16, 43, 76, 0.12);
    color: rgba(16, 43, 76, 0.7);
}

.reg-mode-switch__btn--active{
    background: var(--base-blue, rgba(0, 113, 186, 1));
    color: #FFF;
}

.reg-mode-switch__btn--active:hover{
    background: var(--base-blue-hover, rgba(0, 90, 150, 1));
    color: #FFF;
}

/* =========================================
   ПОЛЯ ВВОДА (FLOATING LABEL)
   ========================================= */

.form-field{
    position: relative;
    margin-bottom: 12px;
}

.form-field__input{
    width: 100%;
    padding: 16px 20px;
    border: 2px solid #D1D9E6;
    border-radius: 8px;
    font-size: 16px;
    transition: all 0.2s;
    box-sizing: border-box;
    background: var(--light-blue-bg);
}

.form-field__input:focus{
    outline: none;
    border-color: var(--dark-blue, rgba(3, 56, 120, 1));
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.form-field__label{
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--light-blue-bg);
    padding: 0 8px;
    color: #999;
    font-size: 16px;
    transition: all 0.2s ease;
    pointer-events: none;
    z-index: 1;
}

.form-field__input:focus + .form-field__label,
.form-field__input:not(:placeholder-shown) + .form-field__label{
    top: 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--dark-blue, rgba(3, 56, 120, 1));
}

.form-field__input--error{
    border-color: #DC3545 !important;
    background: white !important;
}

.form-field__input--error + .form-field__label{
    top: 0 !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    color: #DC3545 !important;
}

.form-field__error{
    color: #DC3545;
    font-size: 14px;
    padding-left: 4px;
    position: absolute;
    bottom: -24px;
    left: 4px;
    white-space: nowrap;
}

.form-field:has(.form-field__error){
    margin-bottom: 56px;
}

/* =========================================
   ФОРМЫ И КНОПКИ
   ========================================= */

.reg-form{
    display: flex;
    flex-direction: column;
}

.reg-form__description{
    font-size: 16px;
    color: #666;
    margin-bottom: 16px;
    line-height: 1.5;
}

.reg-btn--primary{
    display: grid;
    padding: 16px 40px;
    background: var(--dark-blue, rgba(3, 56, 120, 1));
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
    align-items: center;
    justify-content: center;
}

.reg-btn--primary.svg{
    padding: 11px 40px;
    grid-template-columns: max-content max-content;
}

.reg-btn--primary:hover:not(:disabled){
    background: var(--dark-blue-hover, rgba(2, 40, 90, 1));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.reg-btn--primary:disabled{
    background: #A0AEC0;
    cursor: not-allowed;
    opacity: 0.6;
}

.reg-form__resend-btn{
    padding: 16px 40px;
    background: #A0AEC0;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: not-allowed;
    opacity: 0.6;
    transition: all 0.2s;
}

.reg-form__resend-btn:not(:disabled){
    background: var(--dark-blue, rgba(3, 56, 120, 1));
    cursor: pointer;
    opacity: 1;
}

.reg-form__resend-btn:not(:disabled):hover{
    background: var(--dark-blue-hover, rgba(2, 40, 90, 1));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

.reg-form__link{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--base-blue);
    font-weight: 500;
    transition: color 0.2s;
    text-decoration: underline;
}

.reg-form__link:hover{
    color: var(--base-blue-hover);
}

.reg-form__link-icon{
    width: 32px;
    height: 32px;
    vertical-align: middle;
    fill: currentColor;
}

.show-instructions-link{
    display: block;
    text-align: left;
    margin-top: 20px;
    color: var(--transparency-color, rgba(16, 43, 76, 0.5));
    text-decoration: underline;
    font-size: 14px;
}

.show-instructions-link:hover{
    color: var(--dark-blue-hover, rgba(2, 40, 90, 1));
}

.reg-modal .modal-footer{
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    margin-top: auto;
    flex-wrap: wrap;
    position: relative;
}

/* =========================================
   ИНСТРУКЦИИ
   ========================================= */

.reg-instructions__list{
    margin: 20px 0;
    padding-left: 24px;
    color: #666;
    font-size: 16px;
    line-height: 1.8;
}

.reg-instructions__list li{
    margin-bottom: 8px;
}

/* Список на первом экране */
.reg-list{
    padding: 0;
}

.reg-list li{
    list-style: none;
    position: relative;
    padding-left: 28px;
    line-height: 1.2em;
    margin-bottom: 0.4em;
}

.reg-list li::before{
    content: "";
    position: absolute;
    left: 0;
    top: 3px;
    width: 16px;
    height: 16px;
    background: url("../img/bullet.svg") no-repeat center / contain;
}

.reg-link{
    color: var(--transparency-color);
}

.reg-link-blue{
    color: var(--base-blue);
    text-decoration: none;
    display: flex;
    gap: 8px;
    line-height: 1.2em;
    align-items: center;
}

.reg-link-blue svg{
    width: 32px;
    height: 32px;
}

li > .reg-list{
    margin-top: 1em;
}

/* Сообщение на форме загрузки скана чека */
.reg-modal .alert-warning{
    padding: 1em 1em 1em 1em;
    color: rgba(204, 122, 0, 1);
    background: rgba(255, 225, 179, 1) !important;
    position: relative;
    border-radius: 8px;
    display: grid;
    grid-template-columns: calc(44px + 1em) 1fr;
    grid-gap: 1em;
    align-items: center;
    margin-bottom: 0 !important;
}

.reg-modal .alert-warning svg{
    width: 44px;
    height: 44px;
    justify-self: center;
}

/* =========================================
   Шаги
   ========================================= */
.reg-steps__list{
    display: flex;
    flex-wrap: nowrap;
    overflow: auto;
    gap: 8px;
    padding: 4px 0 8px 0;
    margin-bottom: 16px;
}

.step-badge{
    flex: 0 0 7em;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 5px;
    border: 1px solid rgba(169, 182, 198, 1);
    border-radius: 999px;
    padding: calc(1em / 14 * 4) calc(1em / 14 * 4 * 2);
    color: rgba(169, 182, 198, 1);
    line-height: 1;
}

.step-badge.active{
    border: 2px solid var(--dark-blue);
    color: var(--primary-color);
    background: #FFF;
}

.step-badge.complete{
    border: 1px solid var(--dark-blue);
    color: var(--primary-color);
    display: none;
}

.step-badge svg{
    width: 20px;
    height: 20px;
    color: var(--dark-blue);
}

.step-help{
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 2px solid var(--base-blue);
    border-radius: 50%;
    color: var(--base-blue);
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    flex: 0 0 auto;
    cursor: help;
}

.debug-actions{
    position: absolute;
    top: 0;
    left: 0;
}

/* Скрываем стандартный чекбокс, но оставляем его доступным для клавиатуры и скринридеров */
#reg-modal input[type="checkbox"]{
    position: absolute;
    opacity: 0;
    cursor: pointer;
    height: 0;
    width: 0;
}

/* Контейнер для кастомного чекбокса (обычно это label) */
#reg-modal .custom-checkbox{
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    position: relative;
    line-height: 1.1em;
    margin-bottom: 8px;
}

/* Рисуем сам квадратик чекбокса */
#reg-modal .custom-checkbox::before{
    flex: 0 0 auto;
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #CCC; /* Цвет рамки unchecked */
    border-radius: 4px; /* Скругление углов */
    background-color: var(--light-blue-bg);
    transition: all 0.2s ease-in-out;
    position: relative;
}

/* Состояние:Unchecked (по умолчанию уже задано выше, но можно уточнить) */
#reg-modal input[type="checkbox"]:not(:checked) + .custom-checkbox::before{
    border-color: var(--base-blue);
    background-color: #FFF;
}

/* Состояние: Checked */
#reg-modal input[type="checkbox"]:checked + .custom-checkbox::before{
    border-color: var(--base-blue);
    background-color: var(--base-blue);
}

/* Рисуем галочку символом */
#reg-modal input[type="checkbox"]:checked + .custom-checkbox::after{
    content: '✓'; /* Сам символ */
    position: absolute;
    left: 0;
    width: 20px; /* Ширина должна совпадать с ::before */
    height: 20px; /* Высота должна совпадать с ::before */

    /* Центрируем символ внутри квадрата */
    display: flex;
    align-items: center;
    justify-content: center;

    color: #FFF;
    font-size: 14px; /* Подбираем размер, чтобы влезло красиво */
    font-weight: bold;
    line-height: 1;

    pointer-events: none;
    z-index: 1;
}

/* Эффект при наведении */
#reg-modal .custom-checkbox:hover::before{
    border-color: #888;
}

/* Фокус для доступности (когда переключаем Tab'ом) */
#reg-modal input[type="checkbox"]:focus + .custom-checkbox::before{
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* примеры чеков*/
.receipt_examples{
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(164px, 1fr));
    grid-auto-rows: auto;
    grid-gap: 8px;
    justify-items: center;
    margin-bottom: 24px;
    max-width: 600px;
}

/* модалка "Регистрация завершена" */
.green-check{
    width: 136px;
    height: 136px;
    color: #9ABE35;
    margin: 0 auto;
    display: block;
}

.two_button{
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    grid-gap: 16px;
}

.two_button > *{
    width: 275px;
}

/* одинаковый размер кнопок в шаге сканирования чека*/
#regUploadContent .reg-btn--primary{
    /*padding: 0 8px;*/
    width: 100%;
    max-width: 340px;
    height: 56px;
    justify-items: center;
    align-items: center;
    line-height: 1.2em;
}

@media (max-width: 360px){
    #regUploadContent .reg-scan-camera-btn{
        display: grid;
        grid-template-columns: auto auto;
        justify-content: center;
        grid-gap: 8px;
    }

    #regUploadContent .reg-scan-camera-btn span{
        max-width: 160px;
        display: block;
    }
}

#regFinishBtn svg{
    transform: rotate(-90deg);
    display: none;
}

#regCloseModalBtn svg{
    transform: rotate(-90deg);
}

.two_button{
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
}

.two_button > *{
    width: 100%;
    height: 54px;
    padding: 0;
}

.reg-back-to-upload{
    display: block;
    position: relative;
}

.reg-back-to-upload:hover{
    color: var(--base-blue-hover);
}

.reg-skip-email-btn svg,
.reg-back-to-upload svg{
    width: 32px;
    height: 32px;
    transform: rotate(90deg);
}

.reg-skip-email-btn svg{
    width: 32px;
    height: 32px;
    transform: rotate(-90deg);
}

/* Опрос */
.reg-quiz-options{
    padding: 8px 16px;
    background-color: #FFF;
    border-radius: 8px;
}

.reg-quiz-options .form-group{
    border-bottom: 1px solid var(--blue-20);
    padding-top: 6px;
}

.reg-quiz-options > .form-group:last-child{
    border-bottom: none;
}

.reg-quiz-options > .form-group:last-child label{
    margin-bottom: 0 !important;
}

.reg-quiz-options .form-group .custom-checkbox::before,
.reg-quiz-options .form-group .custom-checkbox::after{
    margin-left: 10px;
}

.reg-quiz-counter{
    background-color: var(--blue-20);
    border-radius: 8px;
    padding: 8px 20px;
}

.reg-quiz-counter strong{
    float: right;
}

@media (min-width: 360px){
    #regFinishBtn svg{
        display: inline-block;
    }
}

@media (min-width: 400px){
    .reg-btn--primary{
        width: max-content;
    }

    .two_button > *{
        width: 100%;
    }
}

@media (min-width: 680px){
    .two_button{
        margin: 0 auto;
        width: 100%;
        max-width: 660px;
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 768px){
    .reg-modal .modal-dialog{
        max-width: 960px;
        margin: 1.75rem auto; /* Центрирование по вертикали */
    }

    .reg-modal .modal-content{
        padding: 40px 60px;
    }

    .reg-modal .form-field{
        margin-bottom: 24px;
    }

    .reg-quiz-options{
        border-radius: 20px;
    }
}

/* шаги */
@media (min-width: 640px){
    .reg-steps__list{
        gap: 10px;
    }
}

@media (min-width: 768px){
    .reg-steps__list{
        gap: 12px;
    }
}

@media (min-width: 992px){
    .step-badge.complete{
        display: block;
    }
}

/* =========================================
   ЗАГРУЗКА ФАЙЛА ЧЕКА
   ========================================= */

.reg-file-upload{
    position: relative;
    width: 100%;
    height: 240px;
    margin-bottom: 16px;
}

.reg-file-upload__input{
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 3;
}

.reg-file-upload__dropzone{
    width: 100%;
    height: 100%;
    padding: 24px 20px;
    border: 2px dashed rgba(169, 182, 198, 0.9);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.22);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-align: center;
    transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s, transform 0.2s;
    overflow: hidden;
    position: relative;
}

.reg-file-upload:hover .reg-file-upload__dropzone{
    border-color: var(--base-blue);
    background: rgba(255, 255, 255, 0.35);
}

.reg-file-upload__input:focus + .reg-file-upload__dropzone,
.reg-file-upload__input:focus-visible + .reg-file-upload__dropzone{
    outline: none;
    border-color: var(--dark-blue, rgba(3, 56, 120, 1));
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.reg-file-upload__default,
.reg-file-upload__message{
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.reg-file-upload__default{
    gap: 12px;
    pointer-events: none;
}

.reg-file-upload__message{
    padding: 24px;
    text-align: center;
    font-size: 20px;
    line-height: 1.4;
    font-weight: 600;
}

.reg-file-upload__icon{
    color: var(--dark-blue, rgba(3, 56, 120, 1));
    line-height: 1;
    flex: 0 0 auto;
    display: none;
}

.reg-file-upload__icon svg{
    width: 63px;
    height: 63px;
}

.reg-file-upload__text{
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
    color: var(--dark-blue, rgba(3, 56, 120, 1));
    max-width: 460px;
}

.reg-file-upload__hint{
    font-size: 16px;
    line-height: 1.4;
    color: var(--transparency-color, rgba(16, 43, 76, 0.5));
    max-width: 420px;
}

.reg-file-upload__btn{
    margin-top: 8px;
    width: 100%;
    max-width: 240px;
    min-height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 16px 24px;
    pointer-events: none;
}

/* Состояния */
.reg-file-upload--loading .reg-file-upload__dropzone{
    border-color: rgba(169, 182, 198, 0.9);
    background: rgba(255, 255, 255, 0.35);
}

.reg-file-upload--loading .reg-file-upload__message{
    color: var(--dark-blue, rgba(3, 56, 120, 1));
}

.reg-file-upload--success .reg-file-upload__dropzone{
    border-color: #28A745;
    background: rgba(40, 167, 69, 0.08);
}

.reg-file-upload--success .reg-file-upload__message{
    color: #1E7E34;
}

.reg-file-upload--error .reg-file-upload__dropzone{
    border-color: #DC3545;
    background: rgba(220, 53, 69, 0.08);
}

.reg-file-upload--error .reg-file-upload__message{
    color: #B02A37;
}

@media (min-width: 768px){
    .reg-file-upload{
        margin-bottom: 24px;
        height: 260px;
    }

    .reg-file-upload__icon{
        display: block;
    }

    .reg-file-upload__dropzone{
        border-radius: 20px;
        padding: 32px 24px;
    }
}

@media (max-width: 480px){
    .reg-file-upload__text{
        font-size: 20px;
    }

    .reg-file-upload__hint{
        font-size: 14px;
    }

    .reg-file-upload__message{
        font-size: 18px;
    }
}
