/* SAFIN — login & registration */

.safin-auth {
    --auth-primary: #14498c;
    --auth-primary-dark: #0f3a6e;
    --auth-accent: #c9a227;
    --auth-bg: #f0f4f8;
    --auth-card-bg: #ffffff;
    --auth-border: #dbe3ee;
    --auth-border-light: #eef2f7;
    --auth-text: #152535;
    --auth-muted: #5f6b7a;
    --auth-success: #276749;
    --auth-success-bg: #e8f5e9;
    --auth-error: #c53030;
    --auth-error-bg: #fff5f5;
    --auth-info: #14498c;
    --auth-info-bg: rgba(20, 73, 140, 0.08);
    --auth-radius: 16px;
    --auth-radius-sm: 10px;

    padding: 56px 0 72px;
    background: var(--auth-bg);
    font-family: Montserrat, sans-serif;
}

.safin-auth__container {
    max-width: 560px;
}

.safin-auth__shell {
    overflow: hidden;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    background: var(--auth-card-bg);
    box-shadow: 0 4px 24px rgba(20, 73, 140, 0.08);
}

.safin-auth__hero {
    padding: 32px 32px 24px;
    text-align: center;
    border-bottom: 1px solid var(--auth-border-light);
    background: linear-gradient(180deg, #ffffff 0%, #f7faff 100%);
}

.safin-auth__title {
    margin: 0 0 8px;
    font-size: clamp(1.35rem, 3vw, 1.65rem);
    font-weight: 700;
    line-height: 1.3;
    color: var(--auth-text);
}

.safin-auth__subtitle {
    margin: 0;
    font-size: 0.94rem;
    line-height: 1.6;
    color: var(--auth-muted);
}

.safin-auth__tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0;
    padding: 0;
    border-bottom: 1px solid var(--auth-border-light);
    background: #f8fafc;
}

.safin-auth__tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 52px;
    padding: 12px 16px;
    border: none;
    border-bottom: 3px solid transparent;
    background: transparent;
    color: var(--auth-muted);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.safin-auth__tab:hover,
.safin-auth__tab:focus-visible {
    color: var(--auth-primary);
    text-decoration: none;
}

.safin-auth__tab.is-active {
    color: var(--auth-primary);
    border-bottom-color: var(--auth-primary);
    background: #ffffff;
}

.safin-auth__body {
    padding: 28px 32px 32px;
}

.safin-auth__alert {
    margin-bottom: 20px;
    border-radius: var(--auth-radius-sm);
}

.safin-auth__form .form-label {
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-text);
}

.safin-auth__form .form-control,
.safin-auth__form .form-select {
    min-height: 44px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    font-size: 0.9375rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.safin-auth__form .form-control:focus,
.safin-auth__form .form-select:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(20, 73, 140, 0.12);
}

.safin-auth__honeypot {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.safin-auth__form-section {
    margin-bottom: 20px;
}

.safin-auth__section-label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--auth-text);
}

.safin-auth__type-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.safin-auth__type-option {
    margin: 0;
    cursor: pointer;
}

.safin-auth__type-input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.safin-auth__type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 88px;
    padding: 16px 12px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #ffffff;
    color: var(--auth-muted);
    font-size: 0.875rem;
    font-weight: 600;
    text-align: center;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.safin-auth__type-card i {
    font-size: 1.25rem;
    color: var(--auth-primary);
}

.safin-auth__type-option:hover .safin-auth__type-card {
    border-color: #b8dcfa;
}

.safin-auth__type-input:checked + .safin-auth__type-card {
    border-color: var(--auth-primary);
    background: rgba(20, 73, 140, 0.06);
    color: var(--auth-primary);
    box-shadow: 0 0 0 1px rgba(20, 73, 140, 0.08);
}

.safin-auth__legal-fields {
    margin-bottom: 20px;
    padding: 18px;
    border: 1px solid var(--auth-border-light);
    border-radius: var(--auth-radius-sm);
    background: #f8fafc;
}

.safin-auth__country-select {
    width: 100%;
    position: relative;
}

.safin-auth__country-select .nice-select {
    width: 100%;
    float: none;
    display: flex;
    align-items: center;
    min-height: 44px;
    height: auto;
    line-height: 1.45;
    padding: 10px 42px 10px 14px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--auth-text);
    background: #fff;
    white-space: nowrap;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.safin-auth__country-select .nice-select:hover:not(.disabled) {
    border-color: #c5d4e4;
}

.safin-auth__country-select .nice-select.open,
.safin-auth__country-select .nice-select:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgba(20, 73, 140, 0.12);
}

.safin-auth__country-select .nice-select.is-invalid {
    border-color: var(--auth-error);
    box-shadow: 0 0 0 3px rgba(197, 48, 48, 0.12);
}

.safin-auth__country-select .nice-select.disabled {
    background: #f5f7fa;
    color: #9aa3ad;
    border-color: var(--auth-border);
    cursor: not-allowed;
    opacity: 0.9;
    pointer-events: none;
}

.safin-auth__country-select .nice-select:after {
    right: 14px;
    width: 6px;
    height: 6px;
    margin-top: -3px;
    border-color: var(--auth-primary);
}

.safin-auth__country-select .nice-select.disabled:after {
    border-color: #b0bac5;
}

.safin-auth__country-select .nice-select .current {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.safin-auth__country-select .nice-select .list {
    width: 100%;
    left: 0 !important;
    right: 0 !important;
    margin-top: 6px;
    max-height: min(240px, 40vh);
    overflow-y: auto;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    box-shadow: 0 10px 28px rgba(20, 73, 140, 0.12);
    z-index: 20;
}

.safin-auth__country-select .nice-select .option-select {
    padding: 11px 14px;
    line-height: 1.45;
    min-height: auto;
    font-size: 0.9375rem;
    color: var(--auth-text);
}

.safin-auth__country-select .nice-select .option-select:hover,
.safin-auth__country-select .nice-select .option-select.focus,
.safin-auth__country-select .nice-select .option-select.selected.focus {
    background: rgba(20, 73, 140, 0.08);
    color: var(--auth-primary);
}

.safin-auth__country-select .nice-select .option-select.selected {
    font-weight: 600;
    color: var(--auth-primary);
}

.safin-auth__country-select .nice-select.open {
    z-index: 21;
}

.safin-auth__lookup-wrap {
    display: flex;
    gap: 8px;
}

.safin-auth__lookup-wrap .form-control {
    flex: 1;
    min-width: 0;
}

.safin-auth__lookup-btn {
    flex-shrink: 0;
    min-width: 48px;
    padding-inline: 14px;
    border-radius: var(--auth-radius-sm);
}

.safin-auth__lookup-feedback {
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    line-height: 1.5;
}

.safin-auth__lookup-feedback.is-loading {
    color: var(--auth-info);
    background: var(--auth-info-bg);
}

.safin-auth__lookup-feedback.is-success {
    color: var(--auth-success);
    background: var(--auth-success-bg);
}

.safin-auth__lookup-feedback.is-error {
    color: var(--auth-error);
    background: var(--auth-error-bg);
}

.safin-auth__lookup-feedback.is-info {
    color: var(--auth-info);
    background: var(--auth-info-bg);
}

.safin-auth__registry-preview {
    margin-top: 14px;
    padding: 14px 16px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #ffffff;
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--auth-muted);
}

.safin-auth__registry-preview-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--auth-primary);
}

.safin-auth__password-wrap {
    position: relative;
    display: flex;
    align-items: stretch;
}

.safin-auth__password-wrap .form-control {
    padding-right: 48px;
}

.safin-auth__password-toggle {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--auth-muted);
    cursor: pointer;
    transition: color 0.2s ease;
}

.safin-auth__password-toggle:hover,
.safin-auth__password-toggle:focus-visible {
    color: var(--auth-primary);
}

.safin-auth__options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.safin-auth__remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.875rem;
    color: var(--auth-muted);
    cursor: pointer;
}

.safin-auth__remember input {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
}

.safin-auth__link {
    color: var(--auth-primary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s ease;
}

.safin-auth__link:hover,
.safin-auth__link:focus-visible {
    color: var(--auth-primary-dark);
    text-decoration: underline;
}

.safin-auth__terms {
    margin-bottom: 20px;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--auth-muted);
}

.safin-auth__terms a {
    color: var(--auth-primary);
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.safin-auth__submit {
    min-height: 48px;
    border-radius: var(--auth-radius-sm);
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--auth-primary);
    border-color: var(--auth-primary);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.safin-auth__submit:hover,
.safin-auth__submit:focus-visible {
    background: var(--auth-primary-dark);
    border-color: var(--auth-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(20, 73, 140, 0.18);
}

.safin-auth__submit:disabled {
    opacity: 0.75;
    transform: none;
    box-shadow: none;
    cursor: not-allowed;
}

.safin-auth__divider {
    position: relative;
    margin: 24px 0;
    text-align: center;
}

.safin-auth__divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--auth-border);
}

.safin-auth__divider span {
    position: relative;
    z-index: 1;
    display: inline-block;
    padding: 0 14px;
    background: var(--auth-card-bg);
    color: var(--auth-muted);
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.safin-auth__google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 48px;
    padding: 10px 16px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-sm);
    background: #ffffff;
    color: var(--auth-text);
    font-size: 0.9375rem;
    font-weight: 600;
    text-decoration: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.safin-auth__google:hover,
.safin-auth__google:focus-visible {
    border-color: #b8dcfa;
    box-shadow: 0 4px 14px rgba(20, 73, 140, 0.08);
    transform: translateY(-1px);
    color: var(--auth-text);
    text-decoration: none;
}

.safin-auth__google-icon {
    display: inline-flex;
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

.safin-auth__google-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.safin-auth__switch-text {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--auth-muted);
}

@media (max-width: 575.98px) {
    .safin-auth {
        padding: 32px 0 48px;
    }

    .safin-auth__hero,
    .safin-auth__body {
        padding-inline: 20px;
    }

    .safin-auth__hero {
        padding-top: 24px;
        padding-bottom: 20px;
    }

    .safin-auth__body {
        padding-block: 24px;
    }

    .safin-auth__tab {
        min-height: 48px;
        font-size: 0.84rem;
    }

    .safin-auth__type-options {
        grid-template-columns: 1fr;
    }

    .safin-auth__options {
        flex-direction: column;
        align-items: flex-start;
    }
}
