/* === Account Layout Styles (from AccountLayout.razor.css) === */

.account-bg {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(50% 88.03% at 50% 50%, #07C3D6 0%, var(--blue) 100%);
    min-height: 100vh;
}

.account-container .form-box {
    background: #fff;
    width: 60%;
    padding: 26px 46px;
    border-top-right-radius: 40px;
    border-bottom-right-radius: 40px;
}

.account-container {
    display: flex;
    width: 750px;
    justify-content: space-between;
    position: relative;
    z-index: 99999;
}

.account-container .left-form-box {
    background: #A7C7E7;
    display: flex;
    justify-content: center;
    padding: 106px 22px;
    position: relative;
    width: 40%;
    overflow: hidden;
    align-items: center;
    border-top-left-radius: 40px;
    border-bottom-left-radius: 40px;
}

.account-container .left-form-box img {
    position: absolute;
}

.left-form-box .login-img {
    width: 290px;
    left: 50%;
    transform: translate(-40%, 0);
}

.account-container .wave-bg-left {
    left: 0;
    top: 0;
    height: 65%;
}

.account-container .wave-bg-right {
    right: 0;
    top: 0;
    width: 34%;
    height: 100%;
}

.account-container .loop-img {
    position: absolute;
    right: -12%;
    width: 16%;
    top: -18%;
}

.curve-img {
    width: 240px;
    position: absolute;
}

.top-left-img {
    width: 700px;
    top: 0;
    left: -100px;
}

.top-right-img {
    right: 0;
    top: 0;
    width: 160px;
}

.bottom-left-img {
    left: 0;
    bottom: 0;
    width: 610px;
}

.bottom-right-img {
    right: 0;
    bottom: 0;
    width: 580px;
}

/* === Form Styles (from Login.razor.css) === */

.form-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
}

.tenant-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--blue);
    background-color: #dbeafe;
    border-radius: 0.375rem;
    margin-right: auto;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.form-head {
    font-size: 25px;
    font-weight: 500;
    margin-bottom: 13px;
    clear: both;
}

.form-head .title {
    font-weight: 600;
    font-size: 20px;
    line-height: 48px;
    color: #1E1E1E;
}

.form-head .subtitle {
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
    line-height: 1.4;
}

.logo {
    width: 135px;
    flex-shrink: 0;
}

.logo img {
    width: 100%;
}

.inputfield {
    margin-bottom: 18px;
    border-radius: 10px;
    transition: max-height 0.5s ease;
    position: relative;
}

.inputfield input {
    background: #F5F5F5;
    border-radius: 15px;
    width: 100%;
    height: 50px;
    border: none;
    font-size: 14px;
    padding: 10px 62px 10px 22px;
    font-family: "Inter", sans-serif;
}

.inputfield select {
    background: #F5F5F5;
    border-radius: 15px;
    width: 100%;
    height: 50px;
    border: none;
    font-size: 14px;
    padding: 10px 22px;
    font-family: "Inter", sans-serif;
}

.input-box {
    position: relative;
}

.inputfield .icon {
    position: absolute;
    right: 25px;
    top: 50%;
    transform: translate(0, -50%);
    width: 18px;
}

.form-box .inputfield label {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-size: 14px;
    line-height: 26px;
    color: #1E1E1E;
    margin-bottom: 6px;
}

.action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.submit {
    margin-top: 40px;
    margin-bottom: 20px;
}

.psd a {
    font-weight: 500;
    font-size: 14px;
    line-height: 27px;
    color: #1E1E1E;
    margin: 0;
    text-decoration: none;
    transition: all 0.4s ease;
}

.psd a:hover {
    color: var(--blue);
}

.rmb label {
    font-weight: 500;
    font-size: 14px;
    line-height: 26px;
    color: #1E1E1E;
    white-space: nowrap;
}

.social-divider {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 1rem 0;
    color: #9ca3af;
    font-size: 0.8125rem;
}

.social-divider::before,
.social-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e5e7eb;
}

.social-buttons {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #111827;
    background-color: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.15s ease-in-out;
}

.social-btn:hover:not(:disabled) {
    background-color: #f9fafb;
    border-color: #d1d5db;
}

.signup-prompt {
    text-align: center;
    font-size: 0.9375rem;
    color: #6b7280;
    margin: 0;
}

/* === Success / Confirmation Screens === */

.success-screen {
    text-align: center;
    padding: 2rem 0;
}

.success-screen .success-icon {
    width: 64px;
    height: 64px;
    background-color: #dcfce7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #16a34a;
    font-size: 1.5rem;
}

.success-screen h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.75rem;
}

.success-screen p {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* --- Countdown Ring (Logout) --- */

.countdown-ring-container {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto 1.5rem;
}

.countdown-ring {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.countdown-ring__track {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 6;
}

.countdown-ring__progress {
    fill: none;
    stroke: #578798;
    stroke-width: 6;
    stroke-linecap: round;
    transition: none;
}

.countdown-ring__progress--active {
    transition: stroke-dashoffset 10s linear;
    stroke-dashoffset: 326.73 !important; /* 2 * PI * 52 */
}

.countdown-ring__number {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: #578798;
}

.countdown-text {
    font-size: 0.875rem !important;
    color: #9ca3af !important;
}

/* --- Dark mode: Countdown Ring --- */

html[data-theme="dark"] .countdown-ring__track {
    stroke: #30363D;
}

html[data-theme="dark"] .countdown-ring__progress {
    stroke: #3FB950;
}

html[data-theme="dark"] .countdown-ring__number {
    color: #3FB950;
}

html[data-theme="dark"] .countdown-text {
    color: #6e7681 !important;
}

/* === Error / Info Screens === */

.info-screen {
    text-align: center;
    padding: 2rem 0;
}

.info-screen .info-icon {
    width: 64px;
    height: 64px;
    background-color: #fef3c7;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #d97706;
    font-size: 1.5rem;
}

.error-screen {
    text-align: center;
    padding: 2rem 0;
}

.error-screen .error-icon {
    width: 64px;
    height: 64px;
    background-color: #fee2e2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    color: #dc2626;
    font-size: 1.5rem;
}

.error-screen h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    margin-bottom: 0.75rem;
}

.error-screen p {
    font-size: 0.9375rem;
    color: #6b7280;
    margin-bottom: 0.5rem;
    line-height: 1.5;
}

/* === Subdomain validation (Register page) === */

.subdomain-input-group {
    display: flex;
    align-items: center;
    background: #F5F5F5;
    border-radius: 15px;
    padding: 0 16px;
}

.subdomain-input-group input {
    background: transparent;
    border: none;
    padding: 0 !important;
    flex: 1;
    outline: none;
}

.subdomain-input-group:focus-within {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.subdomain-input-group .subdomain-suffix {
    color: #6b7280;
    font-size: 0.875rem;
    white-space: nowrap;
}

.subdomain-status {
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.subdomain-status.checking { color: #6b7280; }
.subdomain-status.valid { color: #16a34a; }
.subdomain-status.invalid { color: #dc2626; outline: none; }

/* === OTP Input (MFA page) === */

.otp-container {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin: 1.5rem 0;
}

.otp-input {
    width: 48px;
    height: 56px;
    text-align: center;
    font-size: 1.5rem;
    font-weight: 600;
    border: 2px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
    transition: border-color 0.15s;
}

.otp-input:focus {
    border-color: var(--blue);
    outline: none;
    box-shadow: 0 0 0 3px rgba(24, 112, 209, 0.1);
}

/* === Tenant Selection Cards === */

.tenant-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    cursor: pointer;
    transition: all 0.15s;
    margin-bottom: 0.75rem;
}

.tenant-card:hover {
    border-color: var(--blue);
    background-color: #f0f7ff;
}

.tenant-card.disabled {
    opacity: 0.5;
    pointer-events: none;
}

.tenant-card .tenant-info h5 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
    color: #111827;
}

.tenant-card .tenant-info p {
    font-size: 0.8125rem;
    color: #6b7280;
    margin: 0;
}

.tenant-card .default-badge {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--blue);
    background-color: #dbeafe;
    padding: 0.125rem 0.5rem;
    border-radius: 0.25rem;
    margin-left: 0.5rem;
}

/* === Password hint === */

.password-hint {
    font-size: 0.8125rem;
    color: #6b7280;
    margin-top: 0.25rem;
}

/* === Recovery Code overlay === */

.recovery-overlay {
    margin-top: 1rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 0.5rem;
    border: 1px solid #e5e7eb;
}

.recovery-overlay label {
    font-weight: 500;
    font-size: 0.875rem;
    color: #374151;
    margin-bottom: 0.5rem;
    display: block;
}

/* === Loading spinner === */

.loading-screen {
    text-align: center;
    padding: 3rem 0;
}

.loading-screen .spinner-border {
    width: 3rem;
    height: 3rem;
    color: var(--blue);
}

.loading-screen p {
    margin-top: 1rem;
    color: #6b7280;
    font-size: 0.9375rem;
}

/* === Terms checkbox === */

.terms-check {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.terms-check input[type="checkbox"] {
    width: auto;
    height: auto;
    margin-top: 0.25rem;
}

.terms-check label {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.4;
}

/* === Login Form Compact Spacing === */

.login-form {
    gap: 0;
}

.login-form .inputfield {
    margin-bottom: 6px;
}

.login-form .inputfield input {
    height: 40px;
}

/* === Register Form Compact Spacing === */

.register-form {
    gap: 0;
}

.register-form .form-head {
    margin-bottom: 14px;
}

.register-form .inputfield {
    margin-bottom: 6px;
}

.register-form .inputfield input {
    height: 40px;
}

.register-form .submit {
    margin-top: 12px;
}

/* === Registration Wizard === */

.wizard-viewport {
    overflow: hidden;
    position: relative;
    transition: min-height 0.4s ease-in-out;
}

.wizard-track {
    display: flex;
    width: 300%;
    transition: transform 0.4s ease-in-out;
}

.wizard-step {
    width: 33.33%;
    flex-shrink: 0;
    overflow: hidden;
    padding: 0 5px;
}

.wizard-buttons {
    display: flex;
    gap: 0.75rem;
}

/* Step 3 visibility fade for form head, divider, signup prompt */
.register-form .form-head,
.register-form ~ hr,
.register-form ~ .signup-prompt {
    transition: opacity 0.3s ease-in-out;
}

.register-form .form-head.fade-out,
.register-form ~ hr.fade-out,
.register-form ~ .signup-prompt.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Create Account button spinner */
.register-form .btn-spinner {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

/* Success checkmark in step 3 (fade in after countdown) */
.register-form .success-icon.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.8); }
    to { opacity: 1; transform: scale(1); }
}

/* Countdown ring fade out */
.countdown-ring-container.fade-out,
.countdown-text.fade-out {
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
}

/* ================================ */
/* Dark Mode                        */
/* ================================ */

html[data-theme="dark"] .account-container .form-box {
    background: #161B22;
}

html[data-theme="dark"] .account-container .left-form-box {
    background: #1C2333;
}

html[data-theme="dark"] .form-head .subtitle {
    color: #8B949E;
}

html[data-theme="dark"] .form-box .inputfield label {
    color: #E6EDF3;
}

html[data-theme="dark"] .inputfield input,
html[data-theme="dark"] .inputfield select {
    background: #0D1117;
    color: #E6EDF3;
}

html[data-theme="dark"] .inputfield input::placeholder {
    color: #6E7681;
}

html[data-theme="dark"] .psd a {
    color: #C9D1D9;
}

html[data-theme="dark"] .rmb label {
    color: #C9D1D9;
}

html[data-theme="dark"] .tenant-badge {
    background-color: rgba(88, 166, 255, 0.15);
    color: #58A6FF;
}

html[data-theme="dark"] .social-divider {
    color: #6E7681;
}

html[data-theme="dark"] .social-divider::before,
html[data-theme="dark"] .social-divider::after {
    background-color: #21262D;
}

html[data-theme="dark"] .social-btn {
    color: #E6EDF3;
    background-color: #0D1117;
    border-color: #30363D;
}

html[data-theme="dark"] .social-btn:hover:not(:disabled) {
    background-color: #161B22;
    border-color: #30363D;
}

html[data-theme="dark"] .signup-prompt {
    color: #8B949E;
}

html[data-theme="dark"] .success-screen p,
html[data-theme="dark"] .error-screen p {
    color: #8B949E;
}

html[data-theme="dark"] .success-screen .success-icon {
    background-color: rgba(63, 185, 80, 0.15);
    color: #3FB950;
}

html[data-theme="dark"] .error-screen .error-icon {
    background-color: rgba(248, 81, 73, 0.15);
    color: #F85149;
}

html[data-theme="dark"] .info-screen .info-icon {
    background-color: rgba(210, 153, 34, 0.15);
    color: #D29922;
}

html[data-theme="dark"] .subdomain-input-group {
    background: #0D1117;
}

html[data-theme="dark"] .subdomain-input-group .subdomain-suffix {
    color: #6E7681;
}

html[data-theme="dark"] .otp-input {
    border-color: #30363D;
    background: #0D1117;
    color: #E6EDF3;
}

html[data-theme="dark"] .otp-input:focus {
    border-color: #58A6FF;
}

html[data-theme="dark"] .tenant-card {
    border-color: #30363D;
    background: #161B22;
}

html[data-theme="dark"] .tenant-card:hover {
    border-color: #58A6FF;
    background-color: rgba(88, 166, 255, 0.06);
}

html[data-theme="dark"] .tenant-card .tenant-info p {
    color: #8B949E;
}

html[data-theme="dark"] .tenant-card .default-badge {
    color: #58A6FF;
    background-color: rgba(88, 166, 255, 0.15);
}

html[data-theme="dark"] .password-hint {
    color: #6E7681;
}

html[data-theme="dark"] .recovery-overlay {
    background: #0D1117;
    border-color: #21262D;
}

html[data-theme="dark"] .recovery-overlay label {
    color: #C9D1D9;
}

html[data-theme="dark"] .terms-check label {
    color: #C9D1D9;
}

html[data-theme="dark"] .loading-screen p {
    color: #8B949E;
}

html[data-theme="dark"] .wizard-buttons .btn-outline-secondary {
    color: #C9D1D9;
    border-color: #30363D;
}

html[data-theme="dark"] .wizard-buttons .btn-outline-secondary:hover {
    background-color: #21262D;
}

/* ================================ */
/* Responsive Media Queries         */
/* ================================ */

@media (max-width: 1600px) {
    body { font-size: 14px; }
}

@media (max-width: 1500px) {
    .top-left-img { width: 420px; }
    .top-right-img { width: 138px; }
}

@media (max-width: 1380px) {
    .account-container .left-form-box { width: 50%; }
    .left-form-box .login-img { width: 230px; }
    .bottom-right-img { width: 380px; }
    .bottom-left-img { width: 430px; }
}

@media (max-width: 1200px) {
    .form-box .inputfield input { height: 55px; }
    .form-box .inputfield .icon { width: 19px; }
    .account-container .psd p { font-size: 14px; }
    .account-container .rmb label { font-size: 14px; }
    .form-box .inputfield label { font-size: 17px; margin-bottom: 8px; }
    .account-container .left-form-box .login-img { left: 50%; transform: translate(-40%, 0); }
}

@media (max-width: 1366px) {
    .account-container .form-box form { width: 100%; margin: 0 auto; }
    .account-container .logo { width: 115px; }
}

@media (max-width: 1024px) {
    .account-container .loop-img { width: 14%; right: -6%; }
}

@media (max-width: 991px) {
    .account-container .submit { margin-top: 40px; }
    .account-container .left-form-box .login-img { width: 210px; }
    .account-container .logo { width: 90px; }
    .account-container .form-head .title { font-size: 19px; }
    .account-container .form-box { padding: 26px 45px; }
    .account-container .form-box .inputfield label { font-size: 14px; }
    .account-container .form-box .inputfield input {
        font-size: 14px;
        padding: 6px 62px 6px 16px;
        height: 46px;
        border-radius: 12px;
    }
    .account-container .form-box .inputfield { margin-bottom: 14px; }
    .account-container .form-box .inputfield .icon { width: 18px; right: 19px; }
    .account-container .rmb label { line-height: normal; width: 20px; height: 20px; }
    .account-container .loop-img { right: 0; top: -25%; }
    .top-left-img { width: 340px; }
}

@media (max-width: 768px) {
    .account-container .form-box .inputfield .icon { width: 20px; }
    .account-container .form-box .inputfield input {
        padding: 9px 62px 9px 16px;
        font-size: 14px;
        height: 52px;
    }
    .account-container { width: 100%; }
    .account-container .loop-img { top: -21%; right: 0; }
    .account-container .psd a { font-size: 14px; }
    .account-container .left-form-box { width: 42%; }
    .top-left-img { width: 340px; }
    .top-right-img { width: 120px; }
    .bottom-left-img { width: 284px; }
    .bottom-right-img { width: 270px; }
}

@media (max-width: 680px) {
    .account-container .form-box { padding: 38px 33px; }
}

@media (max-width: 575px) {
    .account-container {
        display: block;
        transform: none;
        margin: 0 auto;
    }
    .account-container .left-form-box {
        width: 78%;
        border-radius: 40px;
        padding: 120px 30px;
        margin: 0 auto;
    }
    .account-container .form-box {
        width: 78%;
        border-radius: 40px;
        position: relative;
        z-index: 1;
        margin: 0 auto;
        margin-top: -50px;
        padding: 30px 33px;
    }
    .account-container .wave-bg-right { width: 24%; height: 100%; }
    .account-container .loop-img { top: -54px; z-index: 2; }
    .account-container .logo { width: 70px; }
    .account-container .left-form-box .login-img { width: 166px; }
    .account-bg { padding: 84px 24px; min-height: auto; }
    .account-container .wave-bg-left { height: 88%; }
    .account-container .form-box .inputfield .icon { width: 15px; }
    .account-container .form-box .inputfield input {
        padding: 7px 46px 7px 16px;
        height: 45px;
        font-size: 13px;
    }
    .account-container .form-box .inputfield { margin-bottom: 14px; }
    .account-container .psd a { font-size: 13px; }
    .account-container .rmb label { font-size: 13px; }
    .account-container .submit { margin-top: 18px; }
    .account-container .form-head .title { font-size: 18px; line-height: normal; }
    .account-container .form-box .inputfield label {
        font-size: 13px;
        margin-bottom: 8px;
        line-height: normal;
    }
    .bottom-left-img { width: 303px; }
    .bottom-right-img { width: 220px; }
    .top-left-img { width: 260px; }
    .top-right-img { width: 70px; }
}

/* === Height-based responsive: reduce vertical spacing on short viewports === */

@media (max-height: 750px) {
    .account-container .left-form-box { padding-top: 60px; padding-bottom: 60px; }
    .account-container .form-box { padding-top: 18px; padding-bottom: 14px; }
    .form-head { margin-bottom: 8px; }
    .form-head .title { line-height: 36px; }
    .submit { margin-top: 20px; margin-bottom: 10px; }
    .social-divider { margin: 0.5rem 0; }
    .signup-prompt { margin-top: 0; margin-bottom: 0; }
    .register-form .submit { margin-top: 10px; margin-bottom: 6px; }
    .form-box hr { margin: 0.5rem 0; }
}

@media (max-height: 600px) {
    .account-container .left-form-box { padding-top: 36px; padding-bottom: 36px; }
    .account-container .form-box { padding-top: 10px; padding-bottom: 8px; }
    .form-head { margin-bottom: 4px; }
    .form-head .title { font-size: 18px; line-height: 28px; }
    .form-head .subtitle { margin-bottom: 0; font-size: 0.8125rem; }
    .submit { margin-top: 10px; margin-bottom: 4px; }
    .register-form .submit { margin-top: 6px; margin-bottom: 2px; }
    .social-divider { margin: 0.25rem 0; }
    .login-form .inputfield input,
    .register-form .inputfield input { height: 36px; }
    .inputfield { margin-bottom: 4px; }
    .form-box hr { margin: 0.25rem 0; }
    .signup-prompt { margin-top: 0; margin-bottom: 0; font-size: 0.8125rem; }
    .account-container .loop-img { top: -12%; }
}

@media (max-width: 480px) {
    .account-container .psd p { font-size: 13px; }
    .account-container .rmb label {
        font-size: 13px;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .account-container .form-box {
        padding: 30px 20px;
        width: 100%;
        border-radius: 28px;
    }
    .account-container .left-form-box { width: 100%; border-radius: 28px; }
    .account-container .left-form-box .login-img { transform: translate(-40%, -13%); }
    .account-container .loop-img {
        top: -70px;
        width: 16%;
        right: 20px;
        transform: translate(0, 10%);
    }
    .account-container .logo { width: 60px; }
}
