:root {
    --espa-auth-bg: #e8eef4;
    --espa-auth-panel: #0b3d36;
    --espa-auth-panel-mid: #0f4a42;
    --espa-auth-teal: #0d9488;
    --espa-auth-teal-hover: #0f766e;
    --espa-auth-teal-soft: #5eead4;
    --espa-auth-text-muted: #6b7280;
    --espa-auth-border: #e5e7eb;
    --espa-auth-card-radius: 20px;
}

.espa247-auth-body {
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background: var(--espa-auth-bg);
    font-family:
        "Poppins",
        system-ui,
        -apple-system,
        sans-serif;
    font-size: 15px !important;
}

.espa247-auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.espa247-auth-card {
    display: flex;
    width: 100%;
    max-width: 1080px;
    min-height: min(640px, calc(100vh - 2.5rem));
    background: #fff;
    border-radius: var(--espa-auth-card-radius);
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(15, 23, 42, 0.12);
    box-sizing: border-box;
}

/* —— Brand panel (left) —— */
.espa247-auth-brand {
    flex: 0 0 44%;
    max-width: 44%;
    background: linear-gradient(
        145deg,
        #0a3530 0%,
        var(--espa-auth-panel) 45%,
        var(--espa-auth-panel-mid) 100%
    );
    color: #fff;
    padding: 2rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.espa247-auth-brand::before,
.espa247-auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.04);
    pointer-events: none;
}

.espa247-auth-brand::before {
    width: 280px;
    height: 280px;
    top: -80px;
    right: -60px;
}

.espa247-auth-brand::after {
    width: 200px;
    height: 200px;
    bottom: 20%;
    left: -40px;
}

.espa247-auth-brand__inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.espa247-auth-brand__logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    margin-bottom: 2rem;
    text-decoration: none;
    color: #fff;
}

.espa247-auth-brand__logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    flex-shrink: 0;
}

.espa247-auth-brand__logo-text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.espa247-auth-brand__logo-name {
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.espa247-auth-brand__logo-tag {
    font-size: 0.625rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    opacity: 0.75;
}

.espa247-auth-brand__headline {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.25;
    margin: 0 0 0.85rem;
    letter-spacing: -0.02em;
}

.espa247-auth-brand__headline em {
    font-style: normal;
    color: var(--espa-auth-teal-soft);
}

.espa247-auth-brand__desc {
    margin: 0 0 1.75rem;
    font-size: 0.875rem;
    line-height: 1.55;
    opacity: 0.88;
    max-width: 22rem;
}

.espa247-auth-features {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.espa247-auth-features li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: #fff;
}

.espa247-auth-features__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    color: #fff;
}

.espa247-auth-features__icon i {
    color: #fff;
    opacity: 1;
}

.espa247-auth-brand__copy {
    margin-top: auto;
    padding-top: 1.5rem;
    font-size: 0.875rem;
    opacity: 0.55;
}

/* —— Form panel (right) —— */
.espa247-auth-form-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    padding: 1.75rem 2.25rem 1.25rem;
    position: relative;
    overflow-x: hidden;
}

.espa247-auth-form-panel__lang {
    position: absolute;
    top: 1.25rem;
    right: 1.5rem;
    z-index: 2;
}

.espa247-auth-lang-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-weight: 500;
    color: #374151;
    background: #fff;
    border: 1px solid var(--espa-auth-border);
    border-radius: 8px;
    text-decoration: none;
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.espa247-auth-lang-btn:hover {
    border-color: #d1d5db;
    text-decoration: none;
    color: #111827;
}

.espa247-auth-form-panel__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    max-width: 460px;
    width: 100%;
    margin: 0 auto;
    padding-top: 1.5rem;
    box-sizing: border-box;
    font-size: 1rem;
}

.espa247-auth-form-panel__body--scroll {
    justify-content: flex-start;
    overflow-x: hidden;
    overflow-y: auto;
    max-height: calc(100vh - 5rem);
    padding-top: 2.5rem;
    padding-bottom: 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

.espa247-auth-form-panel__body.espa247-auth-register {
    max-width: 100%;
    width: 100%;
}

.espa247-auth-heading {
    margin: 0 0 0.35rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: #111827;
}

.espa247-auth-subheading {
    margin: 0 0 1.5rem;
    font-size: 0.875rem;
    color: var(--espa-auth-text-muted);
}

.espa247-auth-field {
    margin-bottom: 1rem;
}

.espa247-auth-field label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    color: #374151;
}

.espa247-auth-input-wrap {
    position: relative;
}

.espa247-auth-input-wrap__icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: #9ca3af;
    font-size: 0.9rem;
    pointer-events: none;
    z-index: 1;
}

.espa247-auth-input-wrap .form-control {
    height: 2.75rem;
    padding-left: 2.5rem;
    padding-right: 2.5rem;
    border-radius: 10px;
    border: 1px solid var(--espa-auth-border);
    font-size: 0.875rem;
}

.espa247-auth-input-wrap .form-control:focus {
    border-color: var(--espa-auth-teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.espa247-auth-input-wrap .form-control.is-invalid {
    border-color: #ef4444;
}

.espa247-auth-toggle-pw {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #9ca3af;
    padding: 0.25rem;
    cursor: pointer;
    z-index: 1;
}

.espa247-auth-toggle-pw:hover {
    color: #6b7280;
}

.espa247-auth-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.espa247-auth-remember {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin: 0;
    cursor: pointer;
    color: #374151;
}

.espa247-auth-remember input {
    width: 1rem;
    height: 1rem;
    accent-color: var(--espa-auth-teal);
}

.espa247-auth-link {
    color: var(--espa-auth-teal);
    font-weight: 600;
    text-decoration: none;
}

.espa247-auth-link:hover {
    color: var(--espa-auth-teal-hover);
    text-decoration: underline;
}

.espa247-auth-btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 2.75rem;
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 10px;
    background: var(--espa-auth-teal);
    color: #fff !important;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease;
}

.espa247-auth-btn-primary i,
.espa247-auth-btn-primary svg {
    color: #fff !important;
    fill: currentColor;
}

.espa247-auth-btn-primary:hover:not(:disabled) {
    background: var(--espa-auth-teal-hover);
    color: #fff !important;
}

.espa247-auth-btn-primary:hover:not(:disabled) i,
.espa247-auth-btn-primary:hover:not(:disabled) svg {
    color: #fff !important;
}

.espa247-auth-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.espa247-auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.25rem 0;
    color: var(--espa-auth-text-muted);
    font-size: 0.75rem;
}

.espa247-auth-divider::before,
.espa247-auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--espa-auth-border);
}

.espa247-auth-social {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.65rem;
}

.espa247-auth-social__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 2.5rem;
    padding: 0.4rem 0.75rem;
    border: 1px solid var(--espa-auth-border);
    border-radius: 10px;
    background: #fff;
    color: #374151 !important;
    font-weight: 600;
    text-decoration: none;
    transition:
        background 0.15s ease,
        border-color 0.15s ease;
}

.espa247-auth-social__btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    text-decoration: none;
    color: #111827 !important;
}

.espa247-auth-social__btn svg {
    flex-shrink: 0;
}

.espa247-auth-switch {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.875rem;
    color: var(--espa-auth-text-muted);
}

.espa247-auth-form-panel__legal {
    margin-top: auto;
    padding-top: 1rem;
    text-align: center;
    font-size: 0.6875rem;
    color: #9ca3af;
}

.espa247-auth-form-panel__legal a {
    color: #6b7280;
    text-decoration: none;
}

.espa247-auth-form-panel__legal a:hover {
    text-decoration: underline;
}

/* Register-specific */
.espa247-auth-register .form,
.espa247-auth-register .form-group,
.espa247-auth-register .form-group .row {
    max-width: 100%;
    min-width: 0;
}

.espa247-auth-register .form-group .row {
    margin-left: 0;
    margin-right: 0;
}

.espa247-auth-register .form-group .row > [class*="col-"] {
    min-width: 0;
}

.espa247-auth-register .form-group {
    margin-bottom: 0.85rem;
}

.espa247-auth-register .select2-container {
    width: 100% !important;
    max-width: 100%;
}

.espa247-auth-register .select2-container .select2-selection--single {
    width: 100%;
}

.espa247-auth-register #warp-state,
.espa247-auth-register #warp-city {
    min-width: 0;
    overflow: hidden;
}

.espa247-auth-register .form-group label {
    font-weight: 600;
    color: #374151;
}

.espa247-auth-register .form-control {
    border-radius: 10px;
    border: 1px solid var(--espa-auth-border);
    min-height: 2.5rem;
}

.espa247-auth-register .form-control:focus {
    border-color: var(--espa-auth-teal);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
}

.espa247-auth-register .espa247-auth-pw-field {
    position: relative;
}

.espa247-auth-register .espa247-auth-pw-field .field-icon {
    position: absolute;
    right: 12px;
    top: 2.35rem;
    cursor: pointer;
    color: #9ca3af;
    z-index: 2;
}

.espa247-auth-register .country-address {
    position: static;
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.75rem;
}

.espa247-auth-register .select2-container .select2-selection--single {
    min-height: 2.5rem;
    border-radius: 10px;
    border-color: var(--espa-auth-border);
}

.espa247-auth-register .checkbox-inline label.checkbox {
    line-height: 1.45;
}

.espa247-auth-captcha {
    margin: 1rem 0;
}

@media (max-width: 991px) {
    .espa247-auth-card {
        flex-direction: column;
        max-width: 480px;
        min-height: auto;
    }

    .espa247-auth-brand {
        flex: none;
        max-width: none;
        padding: 1.5rem;
    }

    .espa247-auth-brand__headline {
        font-size: 1.35rem;
    }

    .espa247-auth-features {
        display: none;
    }

    .espa247-auth-form-panel {
        padding: 1.5rem 1.25rem 1rem;
    }

    .espa247-auth-form-panel__body--scroll {
        max-height: none;
    }
}
