/* --- Базовые стили --- */
body {
    background-color: #f0f2f5;
    font-family: 'Segoe UI', 'Roboto', sans-serif;
    margin: 0;
    padding: 0;
}

#particle-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.5;
}

#registration-app {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    padding: 2rem;
}

/* --- Основная карточка формы --- */
.portal-card {
    width: 100%;
    max-width: 850px;
    height: 620px;
    background: #ffffff;
    border-radius: 24px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: flex;
    overflow: hidden;
}

.form-section {
    width: 65%;
    display: flex;
    flex-direction: column;
    position: relative;
    min-width: 0;
}

.info-section {
    width: 35%;
    background: #ffffff;
    padding: 1rem;
    border-right: 1px solid #e9ecef;
    display: flex;
    flex-direction: column;
}

.info-block {
    text-align: left;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.info-header {
    text-align: center;
}

.info-header img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin-bottom: 1rem;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    object-fit: contain;
}

.info-header h4 {
    color: #333;
    font-weight: 600;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.info-header .org-details {
    color: #6c757d;
    font-size: 1rem;
    line-height: 1.4;
    margin-bottom: 1.5rem;
}

.instruction-box {
    background-color: #fdf8e6;
    border-radius: 12px;
    padding: 1.25rem;
}

.instruction-box p {
    color: #555;
    font-size: 0.95rem;
    line-height: 1.6;
    margin: 0 0 0.75rem 0;
}

.instruction-box p:last-child {
    margin-bottom: 0;
}

.instruction-box strong {
    color: #000;
}

.info-footer {
    margin-top: auto;
    padding-top: 1.5rem;
    border-top: 1px solid #f0f2f5;
}

.info-footer p {
    margin: 0;
    font-size: 0.9rem;
    color: #6c757d;
}

.info-footer .contact-phone {
    font-size: 1.1rem;
    font-weight: 700;
    color: #333;
    margin-top: 0.5rem;
}

.form-step {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    padding: 2.5rem 3.5rem;
}

.form-field {
    margin-bottom: 1.5rem;
}

.field-label {
    display: block;
    font-weight: 600;
    color: #343a40;
    margin-bottom: 0.75rem;
}

.service-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.8rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
}

.service-tag.tag-telegram {
    background-color: #eaf6ff;
    color: #007bff;
    border-color: #b8dAFC;
}

.service-tag.tag-whatsapp {
    background-color: #e9f9ee;
    color: #25D366;
    border-color: #b2e9c5;
}

.service-tag.tag-email {
    background-color: #fef0f0;
    color: #d9534f;
    border-color: #f7c6c4;
}

.form-input,
.form-select {
    display: block;
    width: 100%;
    box-sizing: border-box;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: #333;
    font-size: 1rem;
    padding: 0.9rem 1rem;
    transition: all 0.2s ease;
}

.form-input[type="date"] {
    color-scheme: light;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: #0052CC;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.25);
}

.is-invalid,
.is-invalid.form-input {
    border-color: #e74c3c !important;
}

.invalid-feedback {
    display: block;
    color: #e74c3c;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    text-align: left;
}

.custom-radio-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.custom-radio-list.is-invalid {
    border: 1px solid #e74c3c;
    border-radius: 8px;
    padding: 10px;
    background-color: rgba(231, 76, 60, 0.05);
}

.custom-radio-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-radio-label:hover {
    border-color: #0065ff;
}

.custom-radio-label input[type="radio"] {
    display: none;
}

.custom-radio-label .radio-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #adb5bd;
    transition: all 0.2s ease;
    position: relative;
}

.custom-radio-label .radio-icon::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: #0052CC;
    transition: all 0.2s ease;
}

.custom-radio-label input[type="radio"]:checked~.radio-icon {
    border-color: #0052CC;
}

.custom-radio-label input[type="radio"]:checked~.radio-icon::after {
    transform: translate(-50%, -50%) scale(1);
}

.custom-radio-label .radio-text {
    color: #343a40;
    font-weight: 500;
}

.custom-radio-label input[type="radio"]:checked~.radio-text {
    color: #000;
}

.other-field-wrapper {
    margin-top: 1rem;
}

.progress-container {
    flex-shrink: 0;
    padding: 2rem 3.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    background: linear-gradient(to top, #ffffff 70%, rgba(255, 255, 255, 0));
    z-index: 10;
}

.nav-buttons {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.progress-bar-wrapper {
    flex-grow: 1;
    background: #e9ecef;
    border-radius: 5px;
    height: 6px;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: #0052CC;
    border-radius: 5px;
    transition: width 0.5s ease-out;
}

.form-button {
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    border-radius: 12px;
}

.form-button.next-button {
    background: #0052CC;
    color: #fff;
    min-width: 150px;
    height: 48px;
    padding: 0 1.5rem;
    font-size: 1rem;
    gap: 0.75rem;
    box-shadow: 0 4px 15px -5px rgba(0, 82, 204, 0.6);
}

.form-button.next-button:hover {
    transform: translateY(-2px);
    background: #0065ff;
}

.form-button.back-button {
    background: #f1f3f5;
    color: #495057;
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.form-button.back-button:hover {
    background: #e9ecef;
}

.language-selection {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 4rem;
    text-align: center;
}

.language-selection h3 {
    font-weight: 600;
    color: #4a4a4a;
    margin-bottom: 2.5rem;
    line-height: 1.6;
}

.lang-button {
    color: #ffffff;
    border: none;
    font-weight: 600;
    width: 100%;
    max-width: 320px;
    height: 55px;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    margin-bottom: 1.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.lang-button:hover {
    transform: translateY(-3px) scale(1.02);
    filter: brightness(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.lang-button:last-child {
    margin-bottom: 0;
}

.btn-tg {
    background-color: #0052CC;
}

.btn-ru {
    background-color: #2ecc71;
}

.btn-en {
    background-color: #e74c3c;
}

.review-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    width: 100%;
    padding: 2.5rem 3.5rem;
}

.review-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
}

.review-card h2 {
    font-weight: 600;
    text-align: center;
    color: #333;
    margin-bottom: 1.5rem;
}

.review-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 1.5rem;
    background-color: #fcfcfc;
}

.review-list li {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem 0;
    border-bottom: 1px solid #f0f2f5;
}

.review-list li:last-child {
    border-bottom: none;
}

.review-list .item-label {
    color: #6c757d;
    font-weight: 500;
    padding-right: 1rem;
}

.review-list .item-value {
    color: #343a40;
    font-weight: 600;
    text-align: right;
    word-break: break-word;
}

.form-button.confirm-button {
    background: #27ae60;
    box-shadow: 0 4px 15px -5px rgba(39, 174, 96, 0.6);
}

.form-button.confirm-button:hover {
    background: #2ecc71;
}

.form-button i.fa-spinner {
    animation: fa-spin 1s infinite linear;
}

@keyframes fa-spin {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

.final-screen-container {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    position: absolute;
    top: 0;
    left: 0;
}

.pass-download-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

/* --- Стили для финального экрана и карточки-пропуска --- */
.registration-content-wrapper {
    display: flex;
    width: 100%;
    height: 100%;
    align-items: stretch;
}

.progress-container .nav-buttons {
    margin: 0;
}

.final-screen-info {
    text-align: center;
    color: #333;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.final-screen-info h3 {
    font-weight: 600;
    margin-bottom: 1rem;
}

.final-screen-info .download-button {
    background: #27ae60;
    color: #fff;
    min-width: 250px;
    height: 52px;
    padding: 0 1.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    gap: 0.75rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px -5px rgba(39, 174, 96, 0.6);
}

.final-screen-info .download-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.4);
    background: #2ecc71;
}

.participant-pass-final {
    width: 380px;
    background: #ffffff;
    color: #333;
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    text-align: center;
    border: 1px solid #f0f0f0;
}

.pass-final-header h3 {
    color: #0052CC;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.pass-final-header p {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

.pass-final-qr {
    padding: 25px 0;
    display: inline-block;
}

#qrcode-container-final {
    padding: 15px;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    display: inline-block;
    line-height: 0;
}

.pass-final-details {
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.pass-final-details .participant-name-final {
    font-size: 26px;
    font-weight: 600;
    color: #212529;
    margin: 0;
    word-break: break-word;
}

.pass-final-details .participant-school-final {
    font-size: 16px;
    color: #495057;
    margin-top: 4px;
    word-break: break-word;
}

.pass-final-footer {
    margin-top: 25px;
    font-size: 12px;
    color: #adb5bd;
    line-height: 1.5;
}

/* Стили для библиотеки intl-tel-input */
.iti {
    width: 100%;
    display: block;
}

.iti__tel-input {
    box-sizing: border-box;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    color: #333;
    font-size: 1rem;
    padding: 0.9rem 1rem;
    transition: all 0.2s ease;
    width: 100%;
    height: calc(1.5em + 1.8rem + 2px);
}

.iti__tel-input:focus {
    outline: none;
    border-color: #0052CC;
    box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.25);
}

/* --- Адаптация для мобильных устройств --- */
@media (max-width: 992px) {
    #registration-app {
        padding: 0;
        height: auto;
        min-height: 100vh;
        align-items: flex-start;
    }

    .portal-card {
        flex-direction: column;
        height: auto;
        max-height: none;
        width: 100%;
        border-radius: 0;
        box-shadow: none;
    }

    .registration-content-wrapper {
        flex-direction: column;
    }

    .info-section, .form-section {
        width: 100%;
        border-right: none;
    }
    
    .info-section {
        border-bottom: 1px solid #e9ecef;
    }

    .form-step {
        padding: 2rem 1.5rem;
    }

    .progress-container {
        padding: 1.5rem;
    }

    .review-container {
        padding: 2rem 1.5rem;
    }

    .review-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }

    .review-list .item-value {
        text-align: left;
    }

    .language-selection {
        padding: 2rem 1.5rem;
        min-height: 100vh;
        box-sizing: border-box;
    }

    .final-screen-container {
        padding: 2rem;
        position: relative;
        height: auto;
        box-sizing: border-box;
        min-height: 100vh;
    }

    .participant-pass-final {
        width: 100%;
        max-width: 380px;
    }
}