/* ============================================
   Login Page - Metron Theme Dual Theme
   v4.0 - Light & Dark theme with CSS Variables
   ============================================ */

/* ========== Theme Variables ========== */
:root {
    /* Light Theme (default) */
    --auth-bg: #e8e9ef;
    --auth-card-bg: #ffffff;
    --auth-card-border: #ebedf3;
    --auth-card-shadow: rgba(0, 0, 0, 0.06);
    --auth-input-bg: #f5f8fa;
    --auth-input-border: #e4e6ef;
    --auth-input-focus-bg: #ffffff;
    --auth-input-color: #3f4254;
    --auth-input-placeholder: #b5b5c3;
    --auth-autofill-bg: #f5f8fa;
    --auth-title-color: #212121;
    --auth-label-color: #7e8299;
    --auth-muted-color: #b5b5c3;
    --auth-primary: #6993FF;
    --auth-primary-hover: #5A7EF0;
    --auth-primary-active: #4A6EE0;
    --auth-primary-glow: rgba(105, 147, 255, 0.12);
    --auth-primary-soft: rgba(105, 147, 255, 0.08);
    --auth-teal-soft: rgba(27, 197, 189, 0.05);
    --auth-checkbox-border: #d1d3e0;
    --auth-checkbox-bg: #ffffff;
    --auth-divider: #ebedf3;
    --auth-logo-shadow: rgba(105, 147, 255, 0.15);
    --auth-logo-bg: #ffffff;
    --auth-particle-1: rgba(105, 147, 255, 0.15);
    --auth-particle-2: rgba(27, 197, 189, 0.1);
    --auth-particle-3: rgba(137, 80, 252, 0.08);
    --auth-select-option-bg: #ffffff;
    --auth-captcha-hover-bg: #eef0f8;
    --auth-switch-bg: #dddfe7;
    --auth-switch-icon: #7e8299;
}

[data-auth-theme="dark"] {
    /* Dark Theme */
    --auth-bg: #0a1628;
    --auth-card-bg: rgba(15, 30, 60, 0.85);
    --auth-card-border: rgba(105, 147, 255, 0.12);
    --auth-card-shadow: rgba(0, 0, 0, 0.3);
    --auth-input-bg: rgba(255, 255, 255, 0.06);
    --auth-input-border: rgba(255, 255, 255, 0.1);
    --auth-input-focus-bg: rgba(255, 255, 255, 0.1);
    --auth-input-color: #e0e3f0;
    --auth-input-placeholder: rgba(255, 255, 255, 0.35);
    --auth-autofill-bg: rgba(15, 30, 60, 0.9);
    --auth-title-color: #ffffff;
    --auth-label-color: rgba(255, 255, 255, 0.55);
    --auth-muted-color: rgba(255, 255, 255, 0.4);
    --auth-primary: #6993FF;
    --auth-primary-hover: #5A7EF0;
    --auth-primary-active: #4A6EE0;
    --auth-primary-glow: rgba(105, 147, 255, 0.25);
    --auth-primary-soft: rgba(105, 147, 255, 0.12);
    --auth-teal-soft: rgba(27, 197, 189, 0.08);
    --auth-checkbox-border: rgba(255, 255, 255, 0.2);
    --auth-checkbox-bg: rgba(255, 255, 255, 0.05);
    --auth-divider: rgba(255, 255, 255, 0.08);
    --auth-logo-shadow: rgba(105, 147, 255, 0.25);
    --auth-logo-bg: rgba(15, 30, 60, 0.6);
    --auth-particle-1: rgba(105, 147, 255, 0.2);
    --auth-particle-2: rgba(27, 197, 189, 0.15);
    --auth-particle-3: rgba(137, 80, 252, 0.12);
    --auth-select-option-bg: #0f1e3c;
    --auth-captcha-hover-bg: rgba(255, 255, 255, 0.1);
    --auth-switch-bg: rgba(255, 255, 255, 0.1);
    --auth-switch-icon: #e0e3f0;
}

/* ========== Dark Theme Specials ========== */
[data-auth-theme="dark"] .login-card {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

/* ========== Theme Switch Button ========== */
.theme-switch-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 5;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid var(--auth-card-border);
    background: var(--auth-switch-bg);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
    outline: none;
    opacity: 0.6;
}

.theme-switch-btn:hover {
    opacity: 1;
    border-color: var(--auth-primary);
    box-shadow: 0 2px 8px var(--auth-primary-glow);
}

.theme-switch-btn i {
    font-size: 16px;
    color: var(--auth-switch-icon);
    transition: color 0.3s ease;
    line-height: 1;
}

/* Icon toggling */
.theme-switch-btn .icon-moon {
    display: block;
}

.theme-switch-btn .icon-sun {
    display: none;
}

[data-auth-theme="dark"] .theme-switch-btn .icon-moon {
    display: none;
}

[data-auth-theme="dark"] .theme-switch-btn .icon-sun {
    display: block;
}

/* ========== Reset & Base ========== */
.login-new-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg);
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
    padding: 20px 0;
    transition: background 0.4s ease;
}

.login-new-page::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, var(--auth-primary-soft) 0%, transparent 70%);
    animation: float-bg 15s ease-in-out infinite;
}

.login-new-page::after {
    content: '';
    position: absolute;
    bottom: -30%;
    left: -30%;
    width: 80%;
    height: 80%;
    background: radial-gradient(circle, var(--auth-teal-soft) 0%, transparent 70%);
    animation: float-bg 20s ease-in-out infinite reverse;
}

@keyframes float-bg {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(5deg); }
    66% { transform: translate(-20px, 20px) rotate(-3deg); }
}

/* ========== Card Container ========== */
.login-card-wrapper {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 420px;
    padding: 15px;
}

.login-card-wrapper.register-wide {
    max-width: 480px;
}

.login-card {
    position: relative;
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-card-border);
    border-radius: 20px;
    padding: 36px 32px 32px;
    box-shadow: 0 2px 20px var(--auth-card-shadow);
    transition: background 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease;
}

/* ========== Logo ========== */
.login-logo {
    text-align: center;
    margin-bottom: 20px;
}

.login-logo img {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--auth-logo-bg);
    padding: 3px;
    box-shadow: 0 4px 15px var(--auth-logo-shadow);
    transition: transform 0.3s ease, box-shadow 0.4s ease, background 0.4s ease;
    object-fit: cover;
}

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

/* ========== Title ========== */
.login-title {
    text-align: center;
    margin-bottom: 28px;
}

.login-title h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--auth-title-color);
    margin: 0 0 4px;
    letter-spacing: 0.3px;
    transition: color 0.4s ease;
}

.login-title p {
    color: var(--auth-muted-color);
    font-size: 13px;
    margin: 0;
    transition: color 0.4s ease;
}

/* ========== Form Groups ========== */
.login-form-group {
    margin-bottom: 16px;
    position: relative;
}

.login-form-group .field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-label-color);
    margin-bottom: 6px;
    padding-left: 2px;
    transition: color 0.4s ease;
}

/* Icon inside input wrapper */
.input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrap .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--auth-muted-color);
    line-height: 1;
    pointer-events: none;
    transition: color 0.25s ease;
    z-index: 2;
    font-size: 15px;
}

/* ========== Input Fields ========== */
.login-input {
    width: 100%;
    height: 44px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    padding: 0 14px 0 42px;
    font-size: 13px;
    color: var(--auth-input-color);
    font-family: 'Poppins', sans-serif;
    transition: all 0.25s ease;
    outline: none;
    box-sizing: border-box;
}

.login-input.no-icon {
    padding-left: 14px;
}

.login-input::placeholder {
    color: var(--auth-input-placeholder);
    font-size: 13px;
}

.login-input:focus {
    border-color: var(--auth-primary);
    background: var(--auth-input-focus-bg);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
}

.input-wrap:focus-within .input-icon {
    color: var(--auth-primary);
}

/* Select dropdown styling */
.login-input-select {
    width: 100%;
    height: 44px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    padding: 0 30px 0 14px;
    font-size: 13px;
    color: var(--auth-input-color);
    font-family: 'Poppins', sans-serif;
    transition: all 0.25s ease;
    outline: none;
    box-sizing: border-box;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23b5b5c3' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.login-input-select option {
    background: var(--auth-select-option-bg);
    color: var(--auth-input-color);
    padding: 8px;
}

.login-input-select:focus {
    border-color: var(--auth-primary);
    background-color: var(--auth-input-focus-bg);
    box-shadow: 0 0 0 3px var(--auth-primary-glow);
}

/* Joined input group (email + postfix, code + button) */
.input-joined {
    display: flex;
    align-items: stretch;
}

.input-joined .input-wrap {
    flex: 1;
    min-width: 0;
}

.input-joined .input-wrap .login-input {
    border-radius: 10px 0 0 10px;
    border-right: none;
}

.input-joined .login-input-select {
    border-radius: 0 10px 10px 0;
    width: auto;
    min-width: 115px;
    flex-shrink: 0;
    border-left: 1px solid var(--auth-input-border);
}

.input-joined .btn-send-code {
    border-radius: 0 10px 10px 0;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Side-by-side fields */
.fields-row {
    display: flex;
    gap: 10px;
}

.fields-row .login-form-group {
    flex: 1;
    min-width: 0;
}

/* Autofill override */
.login-input:-webkit-autofill,
.login-input:-webkit-autofill:hover,
.login-input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--auth-input-color) !important;
    -webkit-box-shadow: 0 0 0px 1000px var(--auth-autofill-bg) inset !important;
    transition: background-color 99999s ease-in-out 0s;
    border-color: rgba(105, 147, 255, 0.3);
    caret-color: var(--auth-input-color);
}

/* Number input spinner hide */
.login-input[type="number"]::-webkit-outer-spin-button,
.login-input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.login-input[type="number"] {
    -moz-appearance: textfield;
}

/* ========== Captcha ========== */
.login-captcha {
    margin-bottom: 16px;
}

.login-captcha .embed-captcha .geetest_btn .geetest_radar_btn,
.login-captcha .embed-captcha .geetest_btn .geetest_success_btn {
    border-radius: 10px !important;
}

.login-captcha .embed-captcha .geetest_holder.geetest_wind .geetest_radar_btn {
    background: var(--auth-input-bg) !important;
    border: 1px solid var(--auth-input-border) !important;
    border-radius: 10px !important;
}

.login-captcha .embed-captcha .geetest_holder.geetest_wind .geetest_radar_tip,
.login-captcha .embed-captcha .geetest_holder.geetest_wind .geetest_success_radar_tip {
    color: var(--auth-muted-color);
}

.login-captcha .embed-captcha .geetest_holder.geetest_wind .geetest_logo,
.login-captcha .embed-captcha .geetest_holder.geetest_wind .geetest_success_logo {
    display: none !important;
}

/* Tencent / Generic Captcha Button */
.btn-captcha-new {
    width: 100%;
    height: 44px;
    background: var(--auth-input-bg);
    border: 1px solid var(--auth-input-border);
    border-radius: 10px;
    color: var(--auth-label-color);
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-captcha-new:hover {
    background: var(--auth-captcha-hover-bg);
    border-color: rgba(105, 147, 255, 0.4);
    color: var(--auth-primary);
}

.btn-captcha-new.verified {
    background: rgba(27, 197, 189, 0.08);
    border-color: rgba(27, 197, 189, 0.3);
    color: #1BC5BD;
}

/* ========== Options Row ========== */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 20px 0 24px;
    flex-wrap: wrap;
}

.login-options .fv-plugins-message-container {
    width: 100%;
    order: 99;
}

/* Custom checkbox */
.login-remember {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--auth-label-color);
    user-select: none;
    line-height: 1;
    margin: 0;
    transition: color 0.4s ease;
}

.login-remember input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
    pointer-events: none;
}

.login-remember .checkmark {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--auth-checkbox-border);
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    position: relative;
    background: var(--auth-checkbox-bg);
}

.login-remember input[type="checkbox"]:checked + .checkmark {
    background: var(--auth-primary);
    border-color: var(--auth-primary);
}

.login-remember input[type="checkbox"]:checked + .checkmark::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(45deg);
    margin-top: -1px;
}

.login-remember a {
    color: var(--auth-primary) !important;
    text-decoration: none;
    font-weight: 500;
}

.login-remember a:hover {
    text-decoration: underline;
}

.login-forgot {
    font-size: 13px;
    color: var(--auth-muted-color);
    text-decoration: none;
    transition: color 0.25s ease;
}

.login-forgot:hover {
    color: var(--auth-primary);
    text-decoration: none;
}

/* ========== Submit Button ========== */
.login-submit-btn {
    width: 100%;
    height: 44px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-hover) 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    letter-spacing: 1px;
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, var(--auth-primary-hover) 0%, var(--auth-primary-active) 100%);
    box-shadow: 0 6px 20px rgba(105, 147, 255, 0.3);
    transform: translateY(-1px);
}

.login-submit-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(105, 147, 255, 0.2);
}

/* Send code button variant */
.btn-send-code {
    height: 44px;
    padding: 0 16px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-hover) 100%);
    border: none;
    border-radius: 10px;
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-send-code:hover {
    background: linear-gradient(135deg, var(--auth-primary-hover) 0%, var(--auth-primary-active) 100%);
}

.btn-send-code:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ========== Register Link ========== */
.login-register-link {
    text-align: center;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--auth-divider);
    transition: border-color 0.4s ease;
}

.login-register-link span {
    color: var(--auth-muted-color);
    font-size: 13px;
    transition: color 0.4s ease;
}

.login-register-link a {
    color: var(--auth-primary);
    font-weight: 500;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.25s ease;
    margin-left: 2px;
}

.login-register-link a:hover {
    color: var(--auth-primary-active);
    text-decoration: underline;
}

/* ========== 2FA Section ========== */
.login-2fa-section {
    display: none;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: var(--auth-muted-color);
    font-size: 12px;
    text-decoration: none;
    margin-top: 6px;
    transition: color 0.25s ease;
}

.back-link:hover {
    color: var(--auth-primary);
    text-decoration: none;
}

/* ========== Validation ========== */
.fv-plugins-message-container .fv-help-block {
    color: #F64E60 !important;
    font-size: 11px;
    margin-top: 4px;
    padding-left: 2px;
}

/* ========== Particles ========== */
.login-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
    pointer-events: none;
}

.login-particles .particle {
    position: absolute;
    background: var(--auth-particle-1);
    border-radius: 50%;
    animation: particle-float linear infinite;
}

.login-particles .particle:nth-child(1) { left: 10%; top: 20%; width: 3px; height: 3px; animation-duration: 25s; }
.login-particles .particle:nth-child(2) { left: 30%; top: 60%; width: 4px; height: 4px; animation-duration: 20s; animation-delay: -5s; background: var(--auth-particle-2); }
.login-particles .particle:nth-child(3) { left: 60%; top: 30%; width: 3px; height: 3px; animation-duration: 30s; animation-delay: -10s; }
.login-particles .particle:nth-child(4) { left: 80%; top: 70%; width: 3px; height: 3px; animation-duration: 22s; animation-delay: -3s; background: var(--auth-particle-3); }
.login-particles .particle:nth-child(5) { left: 50%; top: 10%; width: 2px; height: 2px; animation-duration: 28s; animation-delay: -7s; }
.login-particles .particle:nth-child(6) { left: 90%; top: 45%; width: 4px; height: 4px; animation-duration: 18s; animation-delay: -12s; background: var(--auth-particle-1); }

@keyframes particle-float {
    0%   { transform: translate(0, 0) scale(1); opacity: 0; }
    10%  { opacity: 0.6; }
    90%  { opacity: 0.6; }
    100% { transform: translate(-80px, -160px) scale(0); opacity: 0; }
}

/* ========== Responsive ========== */
@media (max-width: 575.98px) {
    .login-card-wrapper,
    .login-card-wrapper.register-wide {
        max-width: 100%;
        padding: 10px;
    }

    .login-card {
        padding: 28px 20px 24px;
        border-radius: 16px;
    }

    .login-title h3 {
        font-size: 18px;
    }

    .login-input,
    .login-input-select,
    .btn-captcha-new {
        height: 42px;
        font-size: 13px;
    }

    .login-submit-btn,
    .btn-send-code {
        height: 42px;
        font-size: 13px;
    }

    .fields-row {
        gap: 8px;
    }

    .login-logo img {
        width: 56px;
        height: 56px;
    }
}

@media (max-width: 360px) {
    .login-card {
        padding: 24px 16px 20px;
    }

    .fields-row {
        flex-direction: column;
        gap: 0;
    }
}

/* ========== Toast fix ========== */
.toast-top-center {
    top: 20px;
}

/* ========== Override style-1.css conflicts ========== */
.login-new-page .login-form,
.login-new-page .login-signin,
.login-new-page .login-signup,
.login-new-page .register-signin {
    display: block !important;
    max-width: none !important;
    width: auto !important;
}

/* ========== Select Arrow Fix for Dark Theme ========== */
[data-auth-theme="dark"] .login-input-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff60' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

/* ========== Password Rules ========== */
.pwd-rules {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 4px 12px;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 8px;
    background: var(--auth-input-bg, rgba(255,255,255,0.06));
    border: 1px solid var(--auth-input-border, rgba(255,255,255,0.1));
}
.pwd-rules-visible {
    display: grid;
}
.pwd-rule {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11.5px;
    color: var(--auth-text-muted, rgba(255,255,255,0.4));
    transition: color 0.2s;
}
.pwd-rule i {
    font-size: 13px;
    flex-shrink: 0;
    transition: color 0.2s;
}
.pwd-rule.pwd-rule-ok {
    color: #1BC5BD;
}
.pwd-rule.pwd-rule-ok i {
    color: #1BC5BD;
}
.pwd-rule.pwd-rule-err {
    color: #F64E60;
}
.pwd-rule.pwd-rule-err i {
    color: #F64E60;
}
/* Light theme */
:root:not([data-auth-theme="dark"]) .pwd-rules {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.08);
}
:root:not([data-auth-theme="dark"]) .pwd-rule {
    color: rgba(0,0,0,0.35);
}
