/* ========================================
   Login Modal Styles
   ======================================== */

/* ----------------------------------------
   Base Layout & Form Styles (From main.css)
   ---------------------------------------- */
.login-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.login-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.login-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 400px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.login-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

.login-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
}

.login-modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
}

.login-modal-close {
    background: transparent;
    border: none;
    color: #64748b;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-close:hover {
    background: #f1f5f9;
    color: #1e293b;
}

.login-modal-body {
    padding: 24px;
}

.login-modal-form .modal-form-group {
    margin-bottom: 16px;
}

.login-modal-form input[type="text"],
.login-modal-form input[type="password"],
.login-modal-form input[type="tel"],
.login-modal-form input[type="email"] {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
    box-sizing: border-box;
}

.login-modal-form input:focus {
    outline: none;
    border-color: var(--color-primary, #0ea5e9);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.modal-form-message {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: none;
}

.modal-form-message:not(:empty) {
    display: block;
}

.modal-form-message.success {
    background: #ecfdf5;
    color: #059669;
}

.modal-form-message.error {
    background: #fef2f2;
    color: #dc2626;
}

.login-modal-submit {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--color-primary, #0ea5e9), var(--color-primary-dark, #10b981));
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-modal-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 25px rgba(14, 165, 233, 0.4);
}

.login-modal-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.login-modal-footer {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #e2e8f0;
}

.login-modal-footer a {
    color: var(--color-primary, #0ea5e9);
    text-decoration: none;
    font-size: 0.9rem;
    transition: opacity 0.3s;
}

.login-modal-footer a:hover {
    opacity: 0.8;
}
#weixin-back-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 10px;
    border: 1px solid #c7d2fe;
    background: linear-gradient(135deg, #f8fafc 0%, #eef2ff 100%);
    color: #1e3a8a;
    font-weight: 600;
    text-decoration: none;
}
#weixin-back-btn:hover {
    opacity: 1;
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border-color: #93c5fd;
}

/* Weixin Login */
.login-modal-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 40px;
}
.login-weixin-toggle {
    position: absolute;
    right: 12px;
    top: 8px;
    width: 52px;
    height: 52px;
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
.login-weixin-toggle::before {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 0;
    border-top: 52px solid #22c55e;
    border-left: 52px solid transparent;
}
.login-weixin-toggle::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 0;
    height: 0;
    border-top: 52px solid rgba(255, 255, 255, 0.16);
    border-left: 52px solid transparent;
    transform: translate(-6px, 6px);
}
.login-weixin-toggle .corner-icon {
    position: absolute;
    right: 8px;
    top: 12px;
    width: 16px;
    height: 16px;
    border-radius: 4px;
    background: #fff;
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}
.login-weixin-toggle .weixin-icon {
    box-shadow: inset 0 0 0 2px #16a34a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2316a34a'%3E%3Crect x='3' y='3' width='7' height='7'/%3E%3Crect x='14' y='3' width='7' height='7'/%3E%3Crect x='3' y='14' width='7' height='7'/%3E%3Crect x='14' y='14' width='3' height='3'/%3E%3Crect x='18' y='14' width='3' height='3'/%3E%3Crect x='14' y='18' width='3' height='3'/%3E%3Crect x='18' y='18' width='3' height='3'/%3E%3C/svg%3E");
}
.login-weixin-toggle .pc-icon {
    display: none;
    box-shadow: inset 0 0 0 2px #0f172a;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%230f172a'%3E%3Crect x='3' y='4' width='18' height='12' rx='1'/%3E%3Crect x='8' y='18' width='8' height='2'/%3E%3Crect x='6' y='20' width='12' height='2'/%3E%3C/svg%3E");
}
.login-modal.weixin-active .login-weixin-toggle::before {
    border-top-color: #94a3b8;
}
.login-modal.weixin-active .login-weixin-toggle .weixin-icon {
    display: none;
}
.login-modal.weixin-active .login-weixin-toggle .pc-icon {
    display: block;
}
.login-modal-social {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed #e2e8f0;
    text-align: center;
}
.login-modal-social .social-title {
    font-size: 12px;
    color: #94a3b8;
    margin-bottom: 10px;
}
.login-modal-social .social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-radius: 20px;
    border: 1px solid #bbf7d0;
    background: #ecfdf3;
    color: #16a34a;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.login-modal-social .qs-icon {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.login-modal-social .social-btn:hover {
    background: #dcfce7;
}
.login-modal-social .social-icon {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #22c55e;
    position: relative;
}
.login-modal-social .social-icon::after {
    content: '';
    position: absolute;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #fff;
    right: 3px;
    top: 4px;
}

@media (max-width: 1366px), (max-height: 820px) {
    .login-modal {
        max-width: 360px;
        border-radius: 14px;
    }
    .login-modal-header {
        padding: 16px 20px;
    }
    .login-modal-header h3 {
        font-size: 1.1rem;
    }
    .login-modal-body {
        padding: 18px 20px;
    }
    .login-modal-form .modal-form-group {
        margin-bottom: 12px;
    }
    .login-modal-form input[type="text"],
    .login-modal-form input[type="password"],
    .login-modal-form input[type="tel"],
    .login-modal-form input[type="email"] {
        padding: 12px 14px;
        font-size: 0.95rem;
        border-radius: 9px;
    }
    .login-modal-submit {
        padding: 12px;
        font-size: 0.95rem;
        border-radius: 9px;
    }
    .login-modal-footer {
        margin-top: 5px;
        padding-top: 16px;
        gap: 16px;
    }
    .modal-sms-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    .modal-captcha .captcha-track {
        height: 38px;
    }
    .modal-captcha .captcha-slider {
        width: 38px;
        height: 38px;
        border-radius: 7px;
    }
    .modal-captcha .captcha-progress {
        width: 38px;
    }
    .login-modal-social {
        margin-top: 5px;
        padding-top: 5px;
    }
    .login-modal-social .social-btn {
        padding: 6px 12px;
        font-size: 12px;
    }
}

/* ----------------------------------------
   Component Styles (From inline CSS)
   ---------------------------------------- */

/* Tabs */
.modal-login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 3px;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 6px;
}

.modal-tab {
    flex: 1;
    padding: 8px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #666);
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-tab.active {
    background: var(--bg-primary, #fff);
    color: var(--color-primary, #2563eb);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.login-modal-form.hidden {
    display: none;
}

/* SMS Code Group */
.modal-sms-group {
    position: relative;
}

.modal-sms-group input {
    padding-right: 110px !important;
}

.modal-sms-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    padding: 7px 14px;
    border: none;
    background: linear-gradient(135deg, var(--color-primary, #2563eb) 0%, #7c3aed 100%);
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
    transition: all 0.3s;
}

.modal-sms-btn:hover:not(:disabled) {
    transform: translateY(-50%) scale(1.02);
    box-shadow: 0 3px 10px rgba(37, 99, 235, 0.4);
}

.modal-sms-btn:disabled {
    background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%);
    cursor: not-allowed;
    box-shadow: none;
}

/* Agreement Checkbox */
.modal-agreement-group {
    margin-top: 8px;
}

.modal-agreement-label {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
    font-size: 12px;
    color: var(--text-secondary, #666);
}

.modal-agreement-label input[type="checkbox"] {
    display: none;
}

.modal-checkmark {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border-color, #ddd);
    border-radius: 3px;
    flex-shrink: 0;
    margin-top: 1px;
    transition: all 0.2s;
    position: relative;
}

.modal-agreement-label input[type="checkbox"]:checked+.modal-checkmark {
    background: var(--color-primary, #2563eb);
    border-color: var(--color-primary, #2563eb);
}

.modal-agreement-label input[type="checkbox"]:checked+.modal-checkmark::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.modal-agreement-text a {
    color: var(--color-primary, #2563eb);
}

/* ----------------------------------------
   Slider Captcha (Moved from main.css)
   ---------------------------------------- */
.modal-captcha .captcha-track {
    height: 44px;
    background: #f1f5f9;
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    user-select: none;
}

.modal-captcha .captcha-slider {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--color-primary, #0ea5e9), var(--color-primary-dark, #10b981));
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
    border-radius: 8px;
    position: absolute;
    top: 0;
    left: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    z-index: 2;
    transition: left 0.3s;
}

.modal-captcha .captcha-slider:active {
    transform: scale(0.95);
}

.modal-captcha .captcha-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 44px;
    background: rgba(14, 165, 233, 0.1);
    z-index: 1;
    transition: width 0.3s;
}

.modal-captcha .captcha-text {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    color: #94a3b8;
    z-index: 0;
}

.modal-captcha.verified .captcha-slider {
    background: #10b981;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
    cursor: default;
}

.modal-captcha.verified .captcha-progress {
    background: rgba(16, 185, 129, 0.1);
}

.modal-captcha.verified .captcha-text {
    color: #10b981;
}

/* ----------------------------------------
   Dark Mode Support
   ---------------------------------------- */
html.dark-mode .login-modal {
    background: var(--dm-bg-card, #1e293b);
}

html.dark-mode .login-modal-header {
    border-bottom-color: var(--dm-border, #334155);
}

html.dark-mode .login-modal-header h3 {
    color: var(--dm-text, #f1f5f9);
}

html.dark-mode .login-modal-form input {
    background: var(--dm-bg, #0f172a);
    border-color: var(--dm-border, #334155);
    color: var(--dm-text, #f1f5f9);
}

html.dark-mode .login-modal-footer {
    border-top-color: var(--dm-border, #334155);
}

html.dark-mode .modal-login-tabs {
    background: var(--dm-bg, #0f172a);
}

html.dark-mode .modal-tab {
    color: var(--dm-text-muted, #94a3b8);
}

html.dark-mode .modal-tab.active {
    background: var(--dm-bg-card, #1e293b);
    color: var(--color-primary);
}

html.dark-mode .modal-agreement-label {
    color: var(--dm-text-muted, #94a3b8);
}

html.dark-mode .modal-captcha .captcha-track {
    background: var(--dm-bg, #0f172a);
}
