:root {
    --auth-primary: #079bae;
    --auth-primary-dark: #044777;
    --auth-primary-light: #12c1c9;
    --auth-secondary: #0d7f88;
    --auth-accent: #2de4e3;
    --auth-mid: #056989;
    --auth-dark: #111827;
    --auth-light: #f9fafb;
    --auth-white: #ffffff;
    --auth-gray: #6b7280;
    --auth-gray-light: #9ca3af;
}

body.auth-page {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #044777 0%, #056989 32%, #0a646e 52%, #079bae 78%, #2cc6bf 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

body.auth-page::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(7, 155, 174, 0.22) 0%, transparent 52%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.12) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(45, 228, 227, 0.14) 0%, transparent 50%);
    z-index: 1;
}

.auth-container {
    position: relative;
    z-index: 2;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding: 2rem 0;
}

.auth-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    position: relative;
    max-width: 560px;
    margin: 0 auto;
    animation: authFloat 6s ease-in-out infinite;
}

.auth-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #044777 0%, #079bae 40%, #12c1c9 70%, #2de4e3 100%);
}

.auth-header {
    text-align: center;
    padding: 2rem 2.5rem 1rem;
    background: linear-gradient(135deg, rgba(4, 71, 119, 0.06) 0%, rgba(7, 155, 174, 0.08) 100%);
}

.auth-logo {
    margin-bottom: 1.25rem;
}

.auth-logo img {
    height: 65px;
    width: auto;
    transition: transform 0.3s ease;
}

.auth-logo:hover img {
    transform: scale(1.05);
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 0.35rem;
    background: linear-gradient(135deg, #044777 0%, #079bae 45%, #12c1c9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-subtitle {
    color: var(--auth-gray);
    font-size: 1rem;
    margin-bottom: 0;
}

/* Tabs */
.auth-tabs {
    display: flex;
    position: relative;
    margin: 1.25rem 2.5rem 0;
    padding: 4px;
    background: rgba(4, 71, 119, 0.07);
    border-radius: 14px;
    border: 1px solid rgba(7, 155, 174, 0.15);
}

.auth-tab {
    flex: 1;
    position: relative;
    z-index: 2;
    border: none;
    background: transparent;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--auth-gray);
    border-radius: 10px;
    cursor: pointer;
    transition: color 0.25s ease;
}

.auth-tab:hover {
    color: var(--auth-primary-dark);
}

.auth-tab.active {
    color: var(--auth-white);
}

.auth-tabs-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(50% - 4px);
    height: calc(100% - 8px);
    background: linear-gradient(135deg, #044777 0%, #079bae 55%, #12c1c9 100%);
    border-radius: 10px;
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 14px rgba(4, 71, 119, 0.35);
    z-index: 1;
}

.auth-tabs[data-active="register"] .auth-tabs-indicator {
    transform: translateX(100%);
}

.auth-panels {
    position: relative;
}

.auth-panel {
    display: none;
    animation: authPanelIn 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.auth-panel.active {
    display: block;
}

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

@keyframes authFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

.auth-form {
    padding: 1.25rem 2.5rem 1.5rem;
}

.form-floating {
    position: relative;
    margin-bottom: 1.25rem;
}

.form-floating .form-control {
    height: 55px;
    padding: 1rem 1.25rem;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: var(--auth-white);
}

.form-floating .form-control:focus {
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(7, 155, 174, 0.2);
    transform: translateY(-2px);
}

.form-floating label {
    padding: 1rem 1.25rem;
    color: var(--auth-gray);
    font-weight: 500;
}

.form-floating .form-control:focus ~ label,
.form-floating .form-control:not(:placeholder-shown) ~ label {
    opacity: 0.65;
    transform: scale(0.85) translateY(-0.5rem) translateX(0.15rem);
    color: var(--auth-primary);
}

.form-floating .form-icon {
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-gray);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    z-index: 3;
}

.form-floating .form-control:focus ~ .form-icon {
    color: var(--auth-primary);
    transform: translateY(-50%) scale(1.1);
}

.password-toggle-icon {
    cursor: pointer;
    z-index: 4;
}

.password-toggle-icon:hover {
    color: var(--auth-primary);
    transform: translateY(-50%) scale(1.15);
}

.form-check {
    margin-bottom: 1rem;
}

.form-check-input {
    width: 20px;
    height: 20px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    transition: all 0.3s ease;
}

.form-check-input:checked {
    background-color: var(--auth-primary);
    border-color: var(--auth-primary);
}

.form-check-input:focus {
    box-shadow: 0 0 0 4px rgba(7, 155, 174, 0.2);
}

.form-check-label {
    color: var(--auth-gray);
    font-weight: 500;
    margin-left: 0.5rem;
}

.form-check-label a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
}

.form-check-label a:hover {
    text-decoration: underline;
}

.btn-auth {
    width: 100%;
    height: 55px;
    background: linear-gradient(135deg, #044777 0%, #079bae 50%, #12c1c9 100%);
    border: none;
    border-radius: 16px;
    color: var(--auth-white);
    font-size: 1.05rem;
    font-weight: 600;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.btn-auth::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn-auth:hover::before {
    left: 100%;
}

.btn-auth:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px rgba(4, 71, 119, 0.45);
}

.btn-auth:active {
    transform: translateY(-1px);
}

.btn-auth.loading {
    pointer-events: none;
    opacity: 0.8;
}

.auth-divider {
    position: relative;
    text-align: center;
    margin: 1.5rem 0;
}

.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #d1d5db, transparent);
}

.auth-divider span {
    background: var(--auth-white);
    padding: 0 1.25rem;
    color: var(--auth-gray);
    font-weight: 500;
    font-size: 0.9rem;
}

.btn-oauth {
    background: rgba(7, 155, 174, 0.1);
    border: 1px solid rgba(4, 71, 119, 0.22);
    color: var(--auth-primary-dark);
    border-radius: 12px;
    padding: 0.7rem 1.25rem;
    font-weight: 500;
    transition: all 0.3s ease;
    text-decoration: none;
    display: block;
    text-align: center;
}

.btn-oauth:hover {
    background: var(--auth-primary);
    color: var(--auth-white);
    transform: translateY(-2px);
}

.password-strength {
    margin-top: 0.5rem;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.password-strength-bar {
    height: 100%;
    border-radius: 2px;
    transition: all 0.3s ease;
    width: 0%;
}

.strength-weak { background: #ef4444; width: 25%; }
.strength-fair { background: #f59e0b; width: 50%; }
.strength-good { background: #079bae; width: 75%; }
.strength-strong { background: #044777; width: 100%; }

.strength-text {
    font-size: 0.875rem;
    margin-top: 0.5rem;
    font-weight: 500;
}

.benefits-section {
    background: linear-gradient(135deg, rgba(4, 71, 119, 0.06) 0%, rgba(7, 155, 174, 0.08) 100%);
    border: 1px solid rgba(7, 155, 174, 0.22);
    border-radius: 16px;
    padding: 1.25rem;
    margin-top: 1.25rem;
}

.benefits-section h6 {
    color: var(--auth-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
    text-align: center;
    font-size: 0.9rem;
}

.benefit-item {
    text-align: center;
    padding: 0.35rem;
}

.benefit-item i {
    font-size: 1.35rem;
    color: var(--auth-primary);
    margin-bottom: 0.35rem;
    display: block;
}

.benefit-item small {
    color: var(--auth-gray);
    font-weight: 500;
    font-size: 0.75rem;
}

.auth-footer {
    text-align: center;
    padding: 1rem 2.5rem 1.5rem;
    background: rgba(249, 250, 251, 0.8);
}

.auth-footer a {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.auth-footer a:hover {
    color: var(--auth-accent);
    text-decoration: underline;
}

.alert {
    border-radius: 12px;
    border: none;
    margin-bottom: 1.25rem;
    font-weight: 500;
}

.alert-success {
    background: linear-gradient(135deg, #0d7f88 0%, #079bae 100%);
    color: white;
}

.alert-danger,
.alert-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.alert-info {
    background: linear-gradient(135deg, #056989 0%, #079bae 55%, #2de4e3 100%);
    color: white;
}

.form-control.is-valid {
    border-color: #0d7f88;
}

.form-control.is-invalid {
    border-color: #ef4444;
}

/* Top navigation bar */
.auth-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding: 0.75rem 0;
    background: rgba(4, 71, 119, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 4px 24px rgba(4, 71, 119, 0.25);
}

.auth-topbar__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.auth-topbar__brand {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.auth-topbar__brand:hover {
    transform: scale(1.02);
    opacity: 0.95;
}

.auth-topbar__logo {
    height: 42px;
    width: auto;
    filter: brightness(0) invert(1);
    opacity: 0.95;
}

.auth-topbar__nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.auth-topbar__link {
    display: inline-flex;
    align-items: center;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
    transition: all 0.25s ease;
}

.auth-topbar__link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border-color: rgba(255, 255, 255, 0.28);
}

.auth-topbar__link--primary {
    background: linear-gradient(135deg, rgba(7, 155, 174, 0.9) 0%, rgba(18, 193, 201, 0.85) 100%);
    border-color: rgba(45, 228, 227, 0.35);
    box-shadow: 0 4px 14px rgba(7, 155, 174, 0.35);
}

.auth-topbar__link--primary:hover {
    background: linear-gradient(135deg, #079bae 0%, #12c1c9 100%);
    box-shadow: 0 6px 20px rgba(7, 155, 174, 0.45);
}

body.auth-page--with-topbar .auth-container {
    padding-top: 5.5rem;
}

.auth-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.auth-step {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--auth-gray);
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(4, 71, 119, 0.05);
}

.auth-step.active {
    color: var(--auth-primary-dark);
    background: rgba(7, 155, 174, 0.12);
    border: 1px solid rgba(7, 155, 174, 0.22);
}

.auth-step i {
    font-size: 0.7rem;
}

.auth-step-divider {
    color: var(--auth-gray-light);
    font-size: 0.65rem;
}

.auth-activate-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: rgba(7, 155, 174, 0.1);
    border: 1px solid rgba(7, 155, 174, 0.2);
    color: var(--auth-primary-dark);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.auth-hint-list {
    margin: 1rem 0 0;
    padding: 0;
    list-style: none;
}

.auth-hint-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--auth-gray);
    margin-bottom: 0.5rem;
    line-height: 1.45;
}

.auth-hint-list li i {
    color: var(--auth-primary);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.field-error {
    color: #ef4444;
    font-size: 0.8rem;
    margin-top: 0.35rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .auth-container {
        padding: 1rem 0;
    }

    .auth-card {
        margin: 0 1rem;
        border-radius: 20px;
        max-width: none;
    }

    .auth-header,
    .auth-tabs,
    .auth-form,
    .auth-footer {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }

    .auth-tabs {
        margin-left: 1.5rem;
        margin-right: 1.5rem;
    }

    .auth-title {
        font-size: 1.5rem;
    }
}

@media (max-width: 576px) {
    .auth-tab {
        font-size: 0.875rem;
        padding: 0.65rem 0.5rem;
    }

    .auth-topbar__logo {
        height: 34px;
    }

    .auth-topbar__link {
        padding: 0.45rem 0.75rem;
        font-size: 0.8rem;
    }

    .auth-topbar__link span.auth-topbar__link-label {
        display: none;
    }

    .auth-forgot-link {
        white-space: normal;
    }
}

/* Brand extras: only in the split (desktop / tablet landscape) layout */
.auth-brand__kicker,
.auth-brand__highlights {
    display: none;
}

.auth-oauth {
    display: grid;
    gap: 0.65rem;
}

.auth-form-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.auth-forgot-link {
    color: var(--auth-primary);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    white-space: nowrap;
}

.auth-forgot-link:hover {
    text-decoration: underline;
}

/* Split layout: desktop and tablets in landscape.
   Portrait phones/tablets keep the stacked vertical card. */
@media (min-width: 900px) and (orientation: landscape),
       (min-width: 1200px) {
    .auth-card--split {
        display: grid;
        grid-template-columns: minmax(280px, 0.4fr) minmax(380px, 0.6fr);
        max-width: 1080px;
        min-height: min(640px, calc(100vh - 7.5rem));
        margin: 0 auto;
        animation: none;
        align-items: stretch;
    }

    .auth-card--split::before {
        background: linear-gradient(180deg, #044777 0%, #079bae 40%, #12c1c9 70%, #2de4e3 100%);
        width: 4px;
        height: 100%;
        right: auto;
    }

    .auth-card--split .auth-brand {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 1.75rem;
        padding: 2.75rem 2.5rem;
        background: linear-gradient(165deg, #044777 0%, #056989 42%, #079bae 100%);
        overflow: hidden;
        text-align: left;
    }

    .auth-card--split .auth-brand::before,
    .auth-card--split .auth-brand::after {
        content: '';
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
    }

    .auth-card--split .auth-brand::before {
        width: 220px;
        height: 220px;
        top: -70px;
        right: -80px;
        background: radial-gradient(circle, rgba(45, 228, 227, 0.28) 0%, transparent 70%);
    }

    .auth-card--split .auth-brand::after {
        width: 180px;
        height: 180px;
        bottom: -60px;
        left: -50px;
        background: radial-gradient(circle, rgba(255, 255, 255, 0.12) 0%, transparent 70%);
    }

    .auth-card--split .auth-header {
        text-align: left;
        padding: 0;
        background: none;
        position: relative;
        z-index: 1;
    }

    .auth-card--split .auth-logo {
        margin-bottom: 1.5rem;
    }

    .auth-card--split .auth-logo img {
        height: 46px;
        filter: brightness(0) invert(1);
        opacity: 0.96;
    }

    .auth-card--split .auth-brand__kicker {
        display: inline-flex;
        align-items: center;
        margin: 0 0 0.65rem;
        padding: 0.28rem 0.7rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.92);
        font-size: 0.72rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    .auth-card--split .auth-title {
        font-size: 2.05rem;
        line-height: 1.15;
        margin-bottom: 0.6rem;
        background: none;
        -webkit-text-fill-color: #fff;
        color: #fff;
    }

    .auth-card--split .auth-subtitle {
        color: rgba(255, 255, 255, 0.82);
        font-size: 1.02rem;
        line-height: 1.5;
        max-width: 22rem;
    }

    .auth-card--split .auth-brand__highlights {
        display: flex;
        flex-direction: column;
        gap: 0.65rem;
        margin: 0;
        padding: 0;
        list-style: none;
        position: relative;
        z-index: 1;
    }

    .auth-card--split .auth-brand__highlights li {
        display: flex;
        align-items: flex-start;
        gap: 0.75rem;
        padding: 0.7rem 0.85rem;
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.14);
        color: rgba(255, 255, 255, 0.95);
        font-size: 0.88rem;
        font-weight: 500;
        line-height: 1.4;
    }

    .auth-card--split .auth-brand__highlights i {
        flex-shrink: 0;
        width: 1.75rem;
        height: 1.75rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        background: rgba(45, 228, 227, 0.22);
        color: #e8fffe;
        font-size: 0.8rem;
        margin-top: 0.05rem;
    }

    .auth-card--split .auth-main {
        display: flex;
        flex-direction: column;
        min-width: 0;
        background: var(--auth-white);
    }

    .auth-card--split .auth-tabs {
        margin: 1.5rem 2rem 0;
    }

    .auth-card--split .auth-form {
        padding: 1.15rem 2rem 1.25rem;
    }

    .auth-card--split .auth-footer {
        margin-top: auto;
        padding: 0.85rem 2rem 1.25rem;
    }

    .auth-card--split .auth-oauth {
        grid-template-columns: 1fr 1fr;
    }

    .auth-card--split .btn-oauth {
        white-space: nowrap;
        font-size: 0.88rem;
        padding: 0.7rem 0.85rem;
    }

    .auth-card--split .auth-fields-pair {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 1rem;
    }

    .auth-card--split .benefits-section {
        display: none;
    }

    .auth-card--split .form-floating {
        margin-bottom: 1.05rem;
    }
}

@media (min-width: 900px) and (orientation: landscape) and (max-height: 820px) {
    .auth-card--split {
        min-height: 0;
    }

    .auth-card--split .auth-brand {
        padding: 2rem 2rem;
        gap: 1.25rem;
    }

    .auth-card--split .auth-logo {
        margin-bottom: 1rem;
    }

    .auth-card--split .auth-logo img {
        height: 42px;
    }

    .auth-card--split .auth-title {
        font-size: 1.65rem;
    }

    .auth-card--split .auth-subtitle {
        font-size: 0.92rem;
    }

    .auth-card--split .auth-brand__highlights li {
        padding: 0.5rem 0.7rem;
        font-size: 0.8rem;
    }

    .auth-card--split .auth-tabs {
        margin-top: 1.15rem;
    }

    .auth-card--split .auth-form {
        padding-top: 0.9rem;
        padding-bottom: 0.9rem;
    }

    .auth-card--split .form-floating {
        margin-bottom: 0.85rem;
    }

    .auth-card--split .form-floating .form-control,
    .auth-card--split .btn-auth {
        height: 50px;
    }
}
