/* Login Modal & WeChat Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
}

.login-modal-container {
    background: var(--card-bg);
    border-radius: 12px;
    width: 380px;
    max-width: 90%;
    padding: 40px 30px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    text-align: center;
    color: var(--text-color);
}

.close-modal {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 28px; /* Slightly larger */
    cursor: pointer;
    color: #999;
    z-index: 9999; /* Ensure it's on top */
    width: 40px;   /* Larger click area */
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 1. PC Quick Login View */
.quick-login-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.quick-login-avatar {
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.quick-login-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.quick-login-name {
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 30px;
    color: var(--text-color);
}

.wechat-green-btn {
    background: #07c160;
    color: white;
    border: none;
    padding: 10px 40px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    font-weight: 500;
    margin-bottom: 20px;
    width: 200px;
    transition: background 0.2s;
}

.wechat-green-btn:hover {
    background: #06ad56;
}

.wechat-green-btn:disabled {
    background: #53c68a;
    cursor: not-allowed;
}

.wechat-green-btn.is-loading {
    pointer-events: none;
}

/* Email & OTP Input Styles */
.login-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    outline: none;
    background-color: #ffffff !important; /* Force white background */
    color: #000000 !important; /* Force black text */
    -webkit-text-fill-color: #000000 !important; /* Fix for some browsers */
}

.login-input::placeholder {
    color: #999 !important; /* Readable placeholder color */
}

#loginOtpInput {
    flex: 1;
    min-width: 0; /* Prevent overflow */
}

#sendOtpBtn {
    padding: 0 12px;
    width: 110px; /* Fixed width for better fit */
    height: 46px; /* Match input height */
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* Don't shrink */
    border-radius: 8px;
}

.login-view .input-wrapper {
    display: flex;
    align-items: center;
}

.login-mode-toggle {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 0 0 14px;
}

.login-mode-btn {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.03);
    color: var(--text-color);
    height: 40px;
    border-radius: 10px;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 12px;
    white-space: nowrap;
}

.login-mode-btn.is-active {
    background: #07c160;
    color: #fff;
    border-color: #07c160;
}

.login-email-row {
    margin-bottom: 12px;
}

.login-credential-row {
    margin-bottom: 18px;
    gap: 10px;
}

@media (max-width: 420px) {
    .login-modal-container {
        padding: 30px 20px;
    }

    .login-mode-toggle {
        gap: 8px;
    }

    .login-credential-row {
        flex-direction: column;
        align-items: stretch;
    }

    #sendOtpBtn {
        width: 100%;
    }
}

.wechat-green-btn.is-loading::before {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-right: 8px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #fff;
    border-radius: 50%;
    vertical-align: -2px;
    animation: login-btn-spin 0.75s linear infinite;
}

@keyframes login-btn-spin {
    to {
        transform: rotate(360deg);
    }
}

.login-submit-hint {
    min-height: 18px;
    margin: 0 0 6px;
    font-size: 12px;
    color: #8a8a8a;
}

.switch-login-link {
    color: #576b95;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
}

.switch-login-link:hover {
    text-decoration: underline;
}

/* 2. PC QR View */
.login-title {
    font-size: 20px;
    font-weight: normal;
    margin-bottom: 30px;
    color: var(--text-color);
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.qr-placeholder {
    width: 180px;
    height: 180px;
    border: 1px solid var(--border-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: white; /* QR always on white */
}

.qr-logo-center {
    position: absolute;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: white;
    padding: 2px;
}

.qr-tip {
    font-size: 14px;
    color: var(--text-color);
    margin-bottom: 5px;
}

.qr-subtip {
    font-size: 12px;
    color: var(--text-secondary);
}

/* 3. Mobile Auth View */
.auth-header-mobile {
    text-align: left;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 15px;
    margin-top: -10px;
}

.auth-app-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: bold;
    font-size: 16px;
}

.auth-app-info img {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.auth-body-mobile {
    text-align: left;
}

.auth-body-mobile h3 {
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 15px;
}

.auth-user-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 15px;
}

.auth-user-info {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auth-user-info img {
    width: 40px;
    height: 40px;
    border-radius: 4px;
}

.auth-user-text {
    display: flex;
    flex-direction: column;
}

.auth-user-text .name {
    font-weight: 500;
    font-size: 15px;
}

.auth-user-text .desc {
    font-size: 12px;
    color: var(--text-secondary);
}

.auth-check {
    color: #07c160;
    font-weight: bold;
    font-size: 18px;
}

.auth-other-info a {
    color: #576b95;
    font-size: 14px;
    text-decoration: none;
}

.auth-footer-mobile {
    display: flex;
    gap: 15px;
    margin-top: 30px;
}

.auth-btn-grey {
    flex: 1;
    background: var(--hover-bg);
    color: var(--text-color);
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

.auth-btn-green {
    flex: 1;
    background: #07c160;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
}

/* Mobile specific adjustment for modal */
@media (max-width: 768px) {
    .login-modal-container {
        position: fixed;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        border-radius: 16px 16px 0 0;
        padding: 30px 20px;
        margin: 0;
        transform: translateY(0);
        animation: slideUp 0.3s ease;
    }

    @keyframes slideUp {
        from { transform: translateY(100%); }
        to { transform: translateY(0); }
    }

    .close-modal {
        display: none; /* Usually mobile sheets don't have X, or it's different */
    }
}
