:root {
    --mc-primary-blue: #0ea5e9;
    --mc-soft-teal: #14b8a6;
    --mc-primary-gradient: linear-gradient(135deg, #14b8a6 0%, #0ea5e9 100%);
    --mc-warm-bg: #f7f6f2;
    --mc-card-bg: #ffffff;
    --mc-text-strong: #102a43;
    --mc-text-muted: #5f738c;
    --mc-border: rgba(128, 150, 173, 0.32);
    --mc-input-bg: #fbfdff;
    --mc-focus-ring: 0 0 0 4px rgba(20, 184, 166, 0.16);
    --mc-shadow-card: 0 20px 40px rgba(0, 0, 0, 0.08);
    --mc-shadow-soft: 0 12px 26px rgba(16, 42, 67, 0.12);
    --mc-radius-card: 24px;
    --mc-radius-control: 16px;
    --mc-radius-pill: 999px;
    --mc-speed-fast: 0.2s;
    --mc-speed-base: 0.3s;
}

html {
    background:
    radial-gradient(circle at 8% 18%, rgba(20, 184, 166, 0.2) 0%, transparent 38%),
    radial-gradient(circle at 92% 15%, rgba(14, 165, 233, 0.22) 0%, transparent 42%),
        linear-gradient(165deg, #fbfaf6 0%, var(--mc-warm-bg) 100%);
}

body {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease-in-out;
}

body.auth-resolved {
    opacity: 1 !important;
    visibility: visible !important;
}

.auth-main-wrapper {
    width: min(94%, 480px);
    max-width: 480px;
    margin: 0 auto;
}

.auth-container {
    width: 100%;
    max-width: 100%;
    gap: 14px;
}

.auth-card {
    position: relative;
    overflow: visible;
    padding: 2rem;
    border-radius: var(--mc-radius-card);
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(255, 255, 255, 0.93);
    box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
    animation: loginCardIn 0.55s ease both;
}

.auth-card::before {
    content: none;
}

.auth-card.secondary {
    padding: 1rem 1.35rem;
    border-radius: 20px;
    animation-delay: 0.08s;
}

.auth-header {
    margin: 0 0 1.2rem;
    text-align: center;
}

.auth-header i {
    color: var(--mc-primary-blue);
    font-size: 2.7rem;
    margin-bottom: 0.65rem;
    filter: drop-shadow(0 8px 16px rgba(14, 165, 233, 0.26));
}

.auth-header h1 {
    margin-bottom: 0.45rem;
    font-weight: 800;
    font-size: 2rem;
    color: var(--mc-text-strong);
    letter-spacing: -0.02em;
    font-family: 'Outfit', sans-serif;
}

.auth-header p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--mc-text-muted);
    line-height: 1.5;
}

.auth-subcopy {
    margin-top: 0.15rem !important;
    font-size: 0.86rem !important;
    color: #6f7f93 !important;
}

.status-msg {
    margin-bottom: 0.95rem;
    font-size: 0.88rem;
    border-radius: 12px;
    padding: 0.72rem 0.85rem;
    text-align: left;
    border: 1px solid transparent;
    background: rgba(248, 250, 252, 0.97);
}

.status-msg.error {
    color: #b91c1c;
    border-color: rgba(185, 28, 28, 0.28);
    background: rgba(254, 242, 242, 0.94);
}

.status-msg.success {
    color: #047857;
    border-color: rgba(4, 120, 87, 0.24);
    background: rgba(236, 253, 245, 0.94);
}

.auth-role-section {
    margin-bottom: 0.95rem;
}

.login-role-switch {
    position: relative;
    isolation: isolate;
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border-radius: var(--mc-radius-pill);
    border: 1px solid rgba(148, 163, 184, 0.36);
    background: rgba(241, 245, 249, 0.85);
}

.login-role-indicator {
    position: absolute;
    top: 6px;
    left: 6px;
    width: calc(50% - 6px);
    height: calc(100% - 12px);
    border-radius: var(--mc-radius-pill);
    background: var(--mc-primary-gradient);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.28);
    transition: transform var(--mc-speed-base) ease;
    z-index: 0;
}

.auth-card.is-therapist-mode .login-role-indicator {
    background: linear-gradient(130deg, #0284c7 0%, #0ea5e9 100%);
    box-shadow: 0 8px 18px rgba(14, 165, 233, 0.35);
}

.login-role-btn {
    position: relative;
    z-index: 1;
    border: 1px solid transparent;
    background: transparent;
    color: #31475f;
    border-radius: var(--mc-radius-pill);
    padding: 0.66rem 0.7rem;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition:
        color var(--mc-speed-base) ease,
        box-shadow var(--mc-speed-fast) ease,
        transform var(--mc-speed-fast) ease,
        border-color var(--mc-speed-fast) ease;
}

.login-role-btn:not(.is-active) {
    background: rgba(241, 245, 249, 0.9);
    border-color: rgba(148, 163, 184, 0.26);
}

.login-role-btn:hover {
    transform: translateY(-1px);
}

.login-role-btn.is-active {
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.login-role-btn:focus-visible {
    outline: none;
    box-shadow: var(--mc-focus-ring);
}

.therapist-context {
    margin: 0.6rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    color: #0369a1;
    letter-spacing: 0.01em;
}

.auth-form {
    text-align: left;
}

.form-group {
    margin-bottom: 0.9rem;
    position: relative;
}

.field-label {
    display: block;
    margin-bottom: 0.44rem;
    font-size: 0.84rem;
    font-weight: 700;
    color: #1f354e;
}

.form-group input {
    width: 100%;
    min-height: 48px;
    padding: 0.88rem 0.95rem;
    border: 1px solid var(--mc-border);
    background: var(--mc-input-bg);
    border-radius: var(--mc-radius-control);
    font-size: 0.95rem;
    color: #0f2236;
    transition:
        border-color var(--mc-speed-fast) ease,
        box-shadow var(--mc-speed-fast) ease,
        background-color var(--mc-speed-fast) ease;
}

#login-password {
    padding-right: 3.1rem;
}

.form-group input::placeholder {
    color: #87a0bb;
}

.form-group input:focus {
    border-color: var(--mc-primary-blue);
    box-shadow: var(--mc-focus-ring);
    background: #ffffff;
    outline: none;
}

.auth-card.is-therapist-mode .form-group input:focus {
    border-color: #0ea5e9;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: calc(50% + 14px);
    transform: translateY(-50%) !important;
    border: 1px solid transparent;
    border-radius: var(--mc-radius-pill);
    min-width: 32px;
    min-height: 32px;
    padding: 0;
    background: transparent;
    color: #4b647e;
    font-size: 0.82rem;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: none !important;
}

.toggle-password:hover,
.toggle-password:active {
    transform: translateY(-50%) !important;
    background: transparent !important;
    color: #4b647e !important;
    box-shadow: none !important;
}

.toggle-password:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.inline-error {
    margin: 0.2rem 0 0.75rem;
    font-size: 0.84rem;
    color: #b91c1c;
    background: rgba(254, 242, 242, 0.9);
    border: 1px solid rgba(185, 28, 28, 0.22);
    border-radius: 12px;
    padding: 0.6rem 0.72rem;
}

.auth-actions-row {
    margin: 0.15rem 0 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.remember-me-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.84rem;
    color: #33506b;
    font-weight: 600;
    cursor: pointer;
}

.remember-me-wrap input {
    width: 16px;
    height: 16px;
    accent-color: var(--mc-primary-blue);
}

.forgot-password-link {
    position: relative;
    color: #2563eb;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.forgot-password-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    transform: scaleX(0);
    transform-origin: left;
    background: linear-gradient(90deg, #14b8a6, #0ea5e9);
    transition: transform var(--mc-speed-base) ease;
}

.forgot-password-link:hover::after,
.forgot-password-link:focus-visible::after {
    transform: scaleX(1);
}

.forgot-password-link:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
    border-radius: 6px;
}

.auth-btn {
    width: 100%;
    min-height: 52px;
    border: none;
    border-radius: 22px;
    padding: 0.94rem 1.2rem;
    margin-top: 0.1rem;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--mc-primary-gradient);
    color: #ffffff;
    box-shadow: 0 10px 24px rgba(14, 165, 233, 0.3);
    transition: transform var(--mc-speed-fast) ease, box-shadow var(--mc-speed-fast) ease, filter var(--mc-speed-fast) ease;
}

.auth-btn:hover {
    transform: scale(1.02);
    filter: saturate(1.08);
    box-shadow: 0 16px 30px rgba(14, 165, 233, 0.33);
}

.auth-btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.2), 0 16px 30px rgba(14, 165, 233, 0.33);
}

.auth-btn:disabled {
    opacity: 0.75;
    cursor: not-allowed;
    transform: none;
}

.auth-btn.is-loading {
    transform: none;
}

.trust-row {
    margin: 0.8rem 0 0.15rem;
    display: grid;
    gap: 0.32rem;
    text-align: center;
}

.trust-row p {
    margin: 0;
    color: #405a74;
    font-size: 0.78rem;
    font-weight: 600;
}

.trust-row i {
    color: var(--mc-primary-blue);
    margin-right: 0.28rem;
}

.trust-links {
    display: inline-flex;
    justify-content: center;
    gap: 0.72rem;
}

.trust-links a {
    color: #2563eb;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
}

.trust-links a:hover,
.trust-links a:focus-visible {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1rem 0 0.35rem;
    color: #8ea2b8;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.16em;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    height: 1px;
    flex: 1;
    background: rgba(148, 163, 184, 0.3);
}

.social-auth-btn {
    min-height: 50px;
    border-radius: 16px;
    font-weight: 700;
    transition: transform var(--mc-speed-fast) ease, box-shadow var(--mc-speed-fast) ease, border-color var(--mc-speed-fast) ease;
}

.social-auth-btn:hover {
    transform: scale(1.01);
    box-shadow: var(--mc-shadow-soft);
}

.social-auth-btn:focus-visible {
    outline: none;
    box-shadow: var(--mc-focus-ring);
}

.auth-footer {
    color: #334d68;
    margin: 0;
    text-align: center;
    font-size: 0.92rem;
}

.toggle-form {
    color: var(--mc-primary-blue);
    text-decoration: none;
    font-weight: 700;
}

.toggle-form:hover,
.toggle-form:focus-visible {
    text-decoration: underline;
}

.hidden {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

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

@media (max-width: 640px) {
    .auth-main-wrapper {
        width: 100%;
        max-width: none;
    }

    .auth-card {
        padding: 1.35rem 1.05rem;
        border-radius: 18px;
    }

    .auth-card.secondary {
        padding: 0.95rem 1rem;
    }

    .auth-header h1 {
        font-size: 1.8rem;
    }

    .auth-header p {
        font-size: 0.9rem;
    }

    .login-role-btn {
        padding: 0.7rem 0.5rem;
        font-size: 0.82rem;
    }

    .auth-actions-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.55rem;
    }

    .forgot-password-link {
        font-size: 0.9rem;
    }

    .auth-btn,
    .social-auth-btn {
        min-height: 54px;
        font-size: 0.98rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}
