/* ===== TOKENS ===== */
:root {
    --blue: #0056cb;
    --blue-dark: #0a2499;
    --blue-light: #e9f0f9;
    --text: #0f172a;
    --text-muted: rgba(0, 18, 59, 0.6);
    --border: #dae3ef;
    --border-field: #d6d5d4;
    --bg-light: #f3faff;
    --bg-field: rgba(239, 239, 236, 0.3);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --shadow-form: 0px 1px 2px 0px rgba(0, 0, 0, 0.05);
    --page-bg: #f7f8fb;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html.basvuru-page,
body.basvuru-page {
    margin: 0;
    padding: 0;
    width: 100%;
}

body.basvuru-page {
    font-family: 'Avenir Next W1G', 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    min-height: 100vh;
}

/* Tam sayfa — docs/design/affiliate-marketing-form-html */
body.basvuru-page:not(.basvuru-page--auth-landing):not(.basvuru-embed) {
    background: var(--page-bg);
}

html.basvuru-page:not(.basvuru-embed):has(body:not(.basvuru-page--auth-landing)) {
    background: var(--page-bg);
}

html.basvuru-page:not(.basvuru-embed):has(body.basvuru-page--auth-landing) {
    background: #f3faff;
}

/* iframe / ?embed=1 — üst siteden gelen zemin görünsün */
html.basvuru-page.basvuru-embed,
body.basvuru-page.basvuru-embed {
    min-height: 0 !important;
    height: auto !important;
    background: transparent !important;
    background-color: transparent !important;
}

body.basvuru-page.basvuru-embed main.page {
    min-height: 0 !important;
    padding: 0;
    max-width: none;
}

body.basvuru-page.basvuru-embed .form-card {
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    max-width: none;
}

.page {
    padding: 40px 20px;
    max-width: 720px;
    margin: 0 auto;
}

.form-card {
    position: relative;
    z-index: 1;
    background: #fff;
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-form);
    padding: 32px;
    width: 100%;
    max-width: 680px;
    margin: 0 auto;
    overflow: hidden;
}

#appForm {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-row--2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.form-field__hint {
    margin: 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--text-muted);
}

.form-field__label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    padding: 0 8px;
}

.form-field__input {
    width: 100%;
    background: var(--bg-field);
    border: 0.7px solid var(--border-field);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text);
    line-height: 22px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

.form-field__input::placeholder {
    color: var(--text-muted);
}

.form-field__input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 203, 0.1);
    background: #fff;
}

.form-field.has-error .form-field__input,
.form-field.has-error .form-field__dropdown {
    border-color: #e03e3e;
    box-shadow: 0 0 0 3px rgba(224, 62, 62, 0.08);
}

.form-field.is-valid .form-field__input,
.form-field.is-valid .form-field__dropdown {
    border-color: #16a34a;
}

.form-field__error {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #e03e3e;
    padding: 0 8px;
    min-height: 14px;
}

.form-field__error.field-validation-valid {
    display: none;
}

.form-validation-summary {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: var(--radius-md);
    color: #b91c1c;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 12px;
    padding: 10px 12px;
}

.form-validation-summary:empty {
    display: none;
}

.form-validation-summary ul {
    margin: 0;
    padding-left: 1.1rem;
}

.form-field__phone-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.form-field__phone-wrap .form-field__select-wrap {
    width: 100%;
}

.form-field__input--phone {
    width: 100%;
}

.form-field__select-wrap {
    position: relative;
    width: 100%;
}

.form-field__select {
    padding-right: 36px;
    cursor: pointer;
}

.form-field__select-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
}

.form-field__dropdown {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--bg-field);
    border: 0.7px solid var(--border-field);
    border-radius: var(--radius-md);
    padding: 10px 12px;
    font-size: 14px;
    font-weight: 400;
    color: var(--text-muted);
    line-height: 22px;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-field__dropdown:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 86, 203, 0.1);
    outline: none;
}

.form-field__dropdown-label {
    flex: 1;
}

.form-field__dropdown.has-value {
    color: var(--text);
}

.form-field__dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    background: #fff;
    border: 0.7px solid var(--border-field);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    z-index: 50;
    overflow: hidden;
    margin: 0;
    padding: 0;
    list-style: none;
}

.form-field__dropdown-menu.is-open {
    display: block;
}

.form-field__dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    border-radius: var(--radius-sm);
    margin: 2px;
    transition: background 0.15s;
}

.form-field__dropdown-item:hover {
    background: var(--bg-light);
}

.form-field__dropdown-item.is-selected {
    background: var(--blue-light);
    color: var(--blue);
}

.form-field__textarea {
    resize: none;
    min-height: 80px;
    line-height: 22px;
}

.form-bottom {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.form-checkbox-wrap {
    padding: 16px 0;
}

.form-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.form-checkbox input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.form-checkbox__box {
    flex-shrink: 0;
    width: 14px;
    height: 14px;
    border: 1px solid rgba(85, 84, 83, 0.6);
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 3px;
    transition: background 0.2s, border-color 0.2s;
}

.form-checkbox input:checked + .form-checkbox__box {
    background: var(--blue);
    border-color: var(--blue);
}

.form-checkbox input:checked + .form-checkbox__box::after {
    content: '';
    display: block;
    width: 7px;
    height: 4px;
    border-left: 1.5px solid #fff;
    border-bottom: 1.5px solid #fff;
    transform: rotate(-45deg) translateY(-1px);
}

.form-checkbox input:focus-visible + .form-checkbox__box {
    box-shadow: 0 0 0 3px rgba(0, 86, 203, 0.2);
}

.form-checkbox__text {
    font-size: 13px;
    font-weight: 500;
    color: rgba(85, 84, 83, 0.6);
    line-height: 20px;
}

.form-link {
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.form-field.has-error .form-checkbox__box {
    border-color: #e03e3e;
}

.login-step {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: center;
    padding: 8px 0 4px;
}

.login-step__title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
}

.login-step__lead {
    margin: 0;
    font-size: 14px;
    line-height: 22px;
    color: var(--text-muted);
}

.login-step__error {
    margin: 0;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: #fef2f2;
    color: #b91c1c;
    font-size: 13px;
    line-height: 20px;
    text-align: left;
}

.login-step__btn {
    display: inline-block;
    text-decoration: none;
    margin-top: 8px;
}

.member-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--blue-light);
    font-size: 13px;
    line-height: 20px;
}

.member-banner__label {
    font-weight: 600;
    color: var(--blue-dark);
}

.member-banner__email {
    color: var(--text);
}

.member-banner__switch {
    margin-left: auto;
    color: var(--blue);
    font-weight: 600;
    text-decoration: none;
}

.form-field__input[readonly] {
    background: var(--bg-field);
    color: var(--text-muted);
}

.btn-submit {
    width: 100%;
    background: #efefec;
    border: none;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
    border-radius: var(--radius-md);
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    color: rgba(15, 23, 42, 0.5);
    line-height: 22px;
    text-align: center;
    cursor: not-allowed;
    transition: background 0.2s, color 0.2s;
    overflow: hidden;
}

.btn-submit.is-active {
    background: var(--blue);
    color: #fff;
    cursor: pointer;
    border-color: rgba(0, 0, 0, 0.12);
}

.btn-submit.is-active:hover {
    background: var(--blue-dark);
}

/* Overlay */
#successOverlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    background: rgba(15, 23, 42, 0.35);
    align-items: center;
    justify-content: center;
    padding: 16px;
    box-sizing: border-box;
}

#successOverlay.active {
    display: flex;
}

.success-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 42px;
    width: 100%;
    max-width: 520px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 21px rgba(0, 86, 203, 0.18);
    position: relative;
    overflow: visible;
    box-sizing: border-box;
}

.success-texts {
    display: flex;
    flex-direction: column;
    gap: 20px;
    width: 100%;
    align-items: center;
    text-align: center;
    color: #0f172a;
}

.success-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    margin: 0 auto;
    flex-shrink: 0;
    animation: successPop 0.6s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

@keyframes successPop {
    from {
        opacity: 0;
        transform: scale(0.6);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.success-icon {
    display: block;
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
}

.success-title {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-weight: 700;
    font-size: 28px;
    line-height: 1.2;
    margin: 0;
}

.success-body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-weight: 400;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    color: #0f172a;
}

html.popup-open,
body.popup-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

.basvuru-form--frozen {
    pointer-events: none;
    user-select: none;
}

@media (max-width: 768px) {
    .form-row--2 {
        grid-template-columns: 1fr;
    }

    .form-card {
        padding: 24px 20px;
    }
}
