/* =========================================
   BASE STYLES
   ========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --accent-blue-original: #2B3389;
    --accent-blue: #4b67d6;
    --accent-blue-hover: #5b76e1;
    --accent-blue-soft: rgba(75, 103, 214, 0.14);
    --accent-blue-shadow: rgba(75, 103, 214, 0.32);
    --accent-orange: #f59e0b;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1a1a1a;
    color: #e0e0e0;
    padding: 40px 20px;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* SVG Page Load Overlay */
#sib-loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #111;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 1s ease;
}

#sib-loading-overlay.sib-fade-out {
    opacity: 0;
    pointer-events: none;
}

.container {
    max-width: 980px;
    width: 100%;
    animation: containerFadeIn 0.7s ease;
}

#registrationForm {
    position: relative;
}

@keyframes containerFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

header {
    text-align: center;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #3d3d3d;
}

header img {
    max-width: 300px;
    height: auto;
}

/* =========================================
   LANGUAGE TOGGLE
   ========================================= */
.language-toggle {
    display: flex;
    gap: 0;
    background-color: #2d2d2d;
    border-radius: 6px;
    overflow: hidden;
    border: 2px solid #3d3d3d;
    width: fit-content;
    margin: 0 auto 30px;
}

.lang-btn {
    padding: 10px 20px;
    background-color: transparent;
    color: #a0a0a0;
    border: none;
    cursor: pointer;
    font-weight: 500;
    font-size: 0.95em;
    transition: all 0.6s ease;
    margin: 0;
    width: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.flag-icon {
    width: 24px;
    height: 16px;
    object-fit: cover;
    border-radius: 2px;
}

.lang-btn:hover {
    background-color: #3d3d3d;
    transform: none;
    box-shadow: none;
}

.lang-btn.active {
    background-color: var(--accent-blue-original);
    color: #ffffff;
}

.lang-btn + .lang-btn {
    border-left: 1px solid #3d3d3d;
}

h1 {
    color: var(--accent-blue-original);
    margin-bottom: 10px;
    font-size: 2em;
}

.subtitle {
    color: #a0a0a0;
    margin-bottom: 30px;
    font-size: 0.95em;
}

/* =========================================
   TAB NAVIGATION STYLES
   ========================================= */
.tab-container {
    display: flex;
    gap: 0;
    margin-bottom: 30px;
    margin-top: 20px;
    margin: 20px 0 30px 0;
    padding: 8px;
    background-color: #1f1f1f;
    border-radius: 8px;
}

.tab-input {
    display: none;
}

.tab-label {
    flex: 1 1 0;
    display: block;
    min-width: 0;
    padding: 12px 16px;
    background-color: #2d2d2d;
    border: 2px solid #3d3d3d;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    color: #999;
    text-align: center;
    font-size: 0.95em;
    word-spacing: normal;
    letter-spacing: normal;
    margin: 0 -1px 0 0;
    position: relative;
    z-index: 1;
}

.tab-label:hover {
    z-index: 2;
    color: #bbb;
    background-color: #353535;
    border-color: #4d4d4d;
}

.tab-input:checked + .tab-label {
    color: #ffffff;
    background-color: var(--accent-blue-original);
    border-color: var(--accent-blue-original);
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(45, 100, 180, 0.3);
}

#tab1:checked ~ .tab-container label[for="tab1"],
#tab2:checked ~ .tab-container label[for="tab2"],
#tab3:checked ~ .tab-container label[for="tab3"],
#tab4:checked ~ .tab-container label[for="tab4"],
#tab5:checked ~ .tab-container label[for="tab5"],
#tab6:checked ~ .tab-container label[for="tab6"] {
    color: #ffffff;
    background-color: var(--accent-blue-original);
    border-color: var(--accent-blue-original);
    font-weight: 700;
    z-index: 2;
    box-shadow: 0 4px 12px rgba(45, 100, 180, 0.3);
}

.tab-content {
    display: none;
    animation: fadeIn 0.45s ease;
}

.mobile-accordion-item {
    position: relative;
}

.mobile-accordion-trigger {
    display: none;
}

.mobile-accordion-chevron {
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform 0.22s ease;
}

.tab-input:checked + .tab-label + .tab-content,
.tab-input:checked ~ .tab-content {
    display: block;
}

/* Position tab contents properly */
#tab1:checked ~ .tabs-content #content1,
#tab2:checked ~ .tabs-content #content2,
#tab3:checked ~ .tabs-content #content3,
#tab4:checked ~ .tabs-content #content4,
#tab5:checked ~ .tabs-content #content5,
#tab6:checked ~ .tabs-content #content6 {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px) scale(0.995); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   PROGRESS INDICATOR (HIDDEN - replaced with step counter)
   ========================================= */
.progress-indicator {
    display: none !important;
    margin: 0;
    padding: 0;
    margin-bottom: 0;
    position: relative;
}

.progress-step {
    display: none !important;
}

/* =========================================
   COLLAPSIBLE SECTION STYLES
   ========================================= */
details {
    margin-bottom: 20px;
    background-color: #252525;
    border: 2px solid #3d3d3d;
    border-radius: 6px;
    overflow: hidden;
}

summary {
    padding: 16px 20px;
    cursor: pointer;
    font-weight: 600;
    color: var(--accent-blue);
    list-style: none;
    user-select: none;
    transition: background-color 0.6s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

summary::-webkit-details-marker {
    display: none;
}

summary::after {
    content: '+';
    font-size: 1.5em;
    font-weight: bold;
    color: var(--accent-blue);
    transition: transform 0.6s ease;
}

details[open] summary::after {
    transform: rotate(45deg);
}

summary:hover {
    background-color: #2d2d2d;
}

details .details-content {
    padding: 20px;
    border-top: 1px solid #3d3d3d;
}

/* =========================================
   FIELDSET & FORM GROUPS
   ========================================= */
fieldset {
    border: 2px solid #3d3d3d;
    border-radius: 6px;
    padding: 5px 20px 20px 20px;
    margin-bottom: 20px;
    background-color: #2d2d2d;
    margin-top: 25px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

fieldset:focus-within {
    border-color: #5a66c2;
    box-shadow: 0 0 0 1px rgba(90, 102, 194, 0.35), 0 6px 18px rgba(0, 0, 0, 0.2);
}

.subsection-fieldset {
    margin-top: 16px;
    padding-top: 8px;
    border-color: #444444;
    background-color: #292929;
    box-shadow: none;
}

.subsection-fieldset legend {
    font-size: 1em;
}

legend {
    color: var(--accent-blue);
    font-weight: 600;
    padding: 0 10px;
    font-size: 1.1em;
    margin-bottom: 5px;
    transform: translateY(-10px);
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 6px;
    color: var(--accent-blue);
    font-weight: 500;
    font-size: 0.9em;
}

/* =========================================
   FORM INPUTS
   ========================================= */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="date"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 16px;
    background-color: #252525;
    border: 2px solid #3d3d3d;
    border-radius: 6px;
    color: #e0e0e0;
    font-size: 1em;
    transition: all 0.6s ease;
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-blue-original);
    background-color: #333333;
    box-shadow: 0 0 0 3px rgba(43, 51, 137, 0.1);
}

/* Keep dark theme when browser autocomplete/autofill is applied */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
    -webkit-text-fill-color: #e0e0e0 !important;
    caret-color: #e0e0e0 !important;
    background-color: #252525 !important;
    box-shadow: 0 0 0 1000px #252525 inset !important;
    -webkit-box-shadow: 0 0 0 1000px #252525 inset !important;
    border: 2px solid #3d3d3d !important;
    border-radius: 6px;
    transition: background-color 9999s ease-out 0s;
}

#registrationForm input:-webkit-autofill,
#registrationForm input:-webkit-autofill:hover,
#registrationForm input:-webkit-autofill:focus,
#registrationForm textarea:-webkit-autofill,
#registrationForm textarea:-webkit-autofill:hover,
#registrationForm textarea:-webkit-autofill:focus,
#registrationForm select:-webkit-autofill,
#registrationForm select:-webkit-autofill:hover,
#registrationForm select:-webkit-autofill:focus {
    -webkit-text-fill-color: #e0e0e0 !important;
    background-color: #252525 !important;
    box-shadow: 0 0 0 1000px #252525 inset !important;
    -webkit-box-shadow: 0 0 0 1000px #252525 inset !important;
}

input:-moz-autofill,
textarea:-moz-autofill,
select:-moz-autofill {
    box-shadow: 0 0 0 1000px #252525 inset;
    -moz-text-fill-color: #e0e0e0;
    border: 2px solid #3d3d3d;
}

textarea {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 15px;
}

.form-row-csz {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 15px;
}

.checkbox-group {
    display: flex;
    align-items: center;
    margin: 10px 0;
}

input[type="checkbox"],
input[type="radio"] {
    width: 20px;
    height: 20px;
    margin-right: 10px;
    cursor: pointer;
    accent-color: var(--accent-blue-original);
}

.checkbox-group label,
.radio-group label {
    margin: 0;
    color: #e0e0e0;
    font-weight: normal;
    cursor: pointer;
}

.radio-group {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.radio-option {
    display: flex;
    align-items: center;
}

/* =========================================
   BUTTONS
   ========================================= */
button {
    width: 100%;
    padding: 14px;
    background-color: var(--accent-blue-original);
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1.1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.6s ease;
    margin-top: 10px;
}

button:hover {
    background-color: #3a44a8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(43, 51, 137, 0.3);
}

button:active {
    transform: translateY(0);
}

/* =========================================
   NAVIGATION BUTTONS
   ========================================= */
.navigation-buttons {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    gap: 10px;
}

.nav-btn {
    padding: 12px 24px;
    background-color: #3d3d3d;
    color: #e0e0e0;
    border: 2px solid #4d4d4d;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.6s ease;
}

.nav-btn:hover:not(:disabled) {
    background-color: #4d4d4d;
    border-color: var(--accent-blue-original);
}

.nav-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =========================================
   VALIDATION & ERROR STATES
   ========================================= */
.validation-error {
    color: #ff6b6b;
    font-size: 0.85em;
    margin-top: 4px;
    display: none;
}

.validation-error.show {
    display: block;
}

input.error,
select.error,
textarea.error {
    border-color: #ff6b6b !important;
}

input.valid,
select.valid {
    border-color: #51cf66 !important;
}

/* =========================================
   PROGRESS BAR & FORM PROGRESS
   ========================================= */
.form-progress {
    background-color: #2d2d2d;
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #3a3a3a;
}

.debug-tools {
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 8px;
    margin: 10px 0 14px;
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px dashed #4a4a4a;
    background: rgba(37, 37, 37, 0.65);
}

.debug-tools[hidden] {
    display: none !important;
}

.debug-badge {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #f59e0b;
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 4px;
    padding: 2px 6px;
}

.debug-btn {
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
    border-radius: 4px;
    border: 1px solid rgba(245, 158, 11, 0.55);
    background: #2b2b2b;
    color: #f59e0b;
    cursor: pointer;
    white-space: nowrap;
}

.debug-btn:hover {
    border-color: #f8b84a;
    color: #ffd08a;
}

.progress-text {
    color: #a0a0a0;
    font-size: 0.9em;
    margin-bottom: 8px;
}

.save-meta {
    min-height: 18px;
    margin-top: 8px;
    font-size: 0.82em;
    color: #9aa3d9;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #3d3d3d;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--accent-blue-original);
    transition: width 0.6s ease;
}

/* =========================================
   AUTO-SAVE INDICATOR
   ========================================= */
.auto-save-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background-color: #2d2d2d;
    padding: 10px 20px;
    border-radius: 6px;
    border: 2px solid #3d3d3d;
    opacity: 0;
    transition: opacity 0.6s ease;
    max-width: min(92vw, 420px);
    z-index: 1000;
}

.auto-save-indicator.show {
    opacity: 1;
}

#autoSaveMessage {
    display: block;
    line-height: 1.35;
}

/* =========================================
   CHARACTER COUNTER
   ========================================= */
.char-counter {
    font-size: 0.85em;
    color: #888;
    text-align: right;
    margin-top: 4px;
}

/* =========================================
   TOOLTIP
   ========================================= */
.tooltip {
    position: relative;
    display: inline-block;
    margin-left: 5px;
    color: var(--accent-orange);
    cursor: help;
}

.tooltip .tooltiptext {
    visibility: hidden;
    width: 200px;
    background-color: #2d2d2d;
    color: #e0e0e0;
    text-align: center;
    border-radius: 6px;
    padding: 8px;
    position: absolute;
    z-index: 1;
    bottom: 125%;
    left: 50%;
    margin-left: -100px;
    opacity: 0;
    transition: opacity 0.6s;
    font-size: 0.85em;
    border: 2px solid #3d3d3d;
}

.tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
}

/* =========================================
   UTILITY CLASSES
   ========================================= */
.required {
    color: var(--accent-orange);
}

small {
    display: block;
    color: #888;
    font-size: 0.85em;
    margin-top: 4px;
    font-style: italic;
    font-family: 'Roboto Condensed', 'Arial Narrow', sans-serif;
    letter-spacing: -0.01em;
}

/* =========================================
   RECAPTCHA
   ========================================= */
.cf2-recaptcha-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 20px 0;
}

.cf2-recaptcha-wrap .cf2-field-error {
    margin-top: 8px;
    text-align: center;
    color: #ff6b6b;
}

.submit-success-box {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(680px, calc(100vw - 28px));
    margin: 0;
    padding: 16px 20px;
    min-height: 200px;
    line-height: 1.35;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 2px solid #2fcb74;
    background: #101a15;
    color: #bfffd9;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
    z-index: 100001;
}

.submit-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 17, 17, 0.72);
    backdrop-filter: blur(2px);
}

#submitOverlay[hidden],
#submitSuccessBox[hidden] {
    display: none !important;
}

.submit-overlay-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
    padding: 18px 22px;
    border-radius: 10px;
    background: rgba(34, 34, 34, 0.92);
    border: 1px solid #4a4a4a;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.submit-overlay-image {
    width: 144px;
    height: 144px;
}

#submitOverlayText {
    margin: 0;
    color: #e8ebff;
    font-size: 0.98em;
    text-align: center;
}

.navigation-buttons button[disabled] {
    opacity: 0.65;
    cursor: wait;
}

/* =========================================
   RESPONSIVE MEDIA QUERIES
   ========================================= */
@media (max-width: 768px) {
    body {
        padding: 20px 12px;
    }

    .debug-tools {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: stretch;
        overflow-x: visible;
        gap: 5px;
        padding: 6px;
    }

    .debug-badge {
        grid-column: 1 / -1;
        align-self: flex-start;
        font-size: 10px;
        padding: 1px 5px;
    }

    .debug-btn {
        width: 100%;
        min-height: 26px;
        padding: 3px 6px;
        font-size: 9px;
        line-height: 1.05;
        text-align: center;
    }

    .container {
        max-width: 100%;
    }

    fieldset {
        padding: 8px 14px 16px 14px;
    }

    .form-group {
        margin-bottom: 16px;
    }

    input[type="text"],
    input[type="email"],
    input[type="tel"],
    input[type="date"],
    input[type="number"],
    textarea,
    select {
        min-height: 46px;
        padding: 12px 14px;
    }

    .form-row,
    .form-row-3,
    .form-row-csz {
        grid-template-columns: 1fr;
    }
    
    .tab-container {
        display: none;
    }

    .tabs-content {
        display: grid;
        gap: 10px;
    }

    .mobile-accordion-item {
        border: 1px solid #3d3d3d;
        border-radius: 10px;
        background: linear-gradient(180deg, #202020 0%, #1a1a1a 100%);
        overflow: hidden;
    }

    .mobile-accordion-trigger {
        display: flex;
        width: 100%;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 0;
        padding: 12px 14px;
        border: 0;
        border-bottom: 1px solid transparent;
        background: linear-gradient(180deg, #2b2b2b 0%, #252525 100%);
        color: #d2d2d2;
        text-align: left;
        font-size: 0.92em;
        font-weight: 700;
        letter-spacing: 0.01em;
    }

    .mobile-accordion-item.is-open .mobile-accordion-trigger {
        color: #ffffff;
        background: linear-gradient(180deg, #2f4f7f 0%, #2d64b4 100%);
        border-bottom-color: rgba(255, 255, 255, 0.12);
    }

    .mobile-accordion-item.is-open .mobile-accordion-chevron {
        transform: rotate(225deg);
    }

    .mobile-accordion-item .tab-content {
        display: none !important;
        animation: none;
    }

    .mobile-accordion-item.is-open .tab-content {
        display: block !important;
    }
    
    .progress-indicator {
        overflow-x: auto;
        flex-wrap: nowrap;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
    }
    
    .progress-step {
        min-width: 100px;
        font-size: 0.75em;
        padding: 8px;
        scroll-snap-align: center;
        flex: 0 0 auto;
    }

    .checkbox-group {
        margin: 8px 0 4px;
    }

    input[type="checkbox"],
    input[type="radio"] {
        width: 24px;
        height: 24px;
    }

    button,
    .nav-btn {
        min-height: 48px;
        padding: 12px 16px;
        font-size: 1em;
    }

    .navigation-buttons {
        gap: 8px;
        position: sticky;
        bottom: 0;
        z-index: 30;
        padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
        background: linear-gradient(180deg, rgba(26, 26, 26, 0) 0%, rgba(26, 26, 26, 0.9) 40%, rgba(26, 26, 26, 1) 100%);
        backdrop-filter: blur(2px);
    }

    .auto-save-indicator {
        top: 12px;
        right: 12px;
        left: 12px;
        max-width: none;
        padding: 10px 14px;
    }

    .submit-success-box {
        width: calc(100vw - 24px);
    }
    
    header {
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
}
