/**
 * Modern Authentication Pages Stylesheet
 * Matching the modern payment theme design
 */

/* CSS Variables */
:root {
    --primary: #635BFF;
    --primary-light: #7A73FF;
    --primary-dark: #4B45CC;
    --primary-50: #F5F4FF;
    --primary-100: #E8E7FF;
    --secondary: #0A2540;
    --accent: #00D4FF;
    --success: #30D158;
    --warning: #FFD60A;
    --error: #FF453A;
    --text-primary: #1A1F36;
    --text-secondary: #697386;
    --text-muted: #A3ACB9;
    --bg-primary: #FFFFFF;
    --bg-secondary: #F6F9FC;
    --border-color: #E6E8EB;
    --border-light: #F0F2F5;
    --gradient-primary: linear-gradient(135deg, #635BFF 0%, #7A73FF 50%, #00D4FF 100%);
    --gradient-secondary: linear-gradient(135deg, #0A2540 0%, #1A3A5C 100%);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.08), 0 10px 10px -5px rgba(0,0,0,0.02);
    --shadow-glow: 0 0 40px rgba(99,91,255,0.15);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* Reset & Base */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-secondary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

a {
    color: var(--primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-dark);
}

/* Auth Layout */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    position: relative;
    overflow: hidden;
}

.auth-bg {
    position: fixed;
    inset: 0;
    z-index: 0;
}

.auth-bg-gradient {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, #F5F4FF 0%, #E8F4FF 50%, #F6F9FC 100%);
}

.auth-bg-pattern {
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(circle at 20% 30%, rgba(99, 91, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(0, 212, 255, 0.08) 0%, transparent 50%);
}

.auth-bg-shapes {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.6;
    animation: authFloat 20s infinite ease-in-out;
}

.auth-shape-1 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 91, 255, 0.1) 0%, transparent 70%);
    top: -100px;
    right: -100px;
}

.auth-shape-2 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(0, 212, 255, 0.1) 0%, transparent 70%);
    bottom: -50px;
    left: -50px;
    animation-delay: -7s;
}

.auth-shape-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(99, 91, 255, 0.08) 0%, transparent 70%);
    top: 50%;
    left: 10%;
    animation-delay: -14s;
}

@keyframes authFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -30px) scale(1.05); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* Auth Container */
.auth-container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 440px;
}

/* Auth Card */
.auth-card {
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    overflow: hidden;
}

.auth-header {
    text-align: center;
    padding: 40px 40px 24px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
    text-decoration: none;
}

.auth-logo-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(99, 91, 255, 0.3);
}

.auth-logo-icon svg {
    width: 28px;
    height: 28px;
}

.auth-logo-text {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.auth-subtitle {
    font-size: 0.9375rem;
    color: var(--text-secondary);
}

/* Auth Body */
.auth-body {
    padding: 0 40px 40px;
}

/* Auth Tabs */
.auth-tabs {
    display: flex;
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.auth-tab {
    flex: 1;
    padding: 10px 16px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    text-align: center;
    text-decoration: none;
}

.auth-tab:hover {
    color: var(--text-primary);
}

.auth-tab.active {
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Form Groups */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    transition: all var(--transition-fast);
}

.form-input:hover {
    border-color: var(--border-dark, #D4D8DD);
}

.form-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.form-input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0px 1000px white inset;
    -webkit-text-fill-color: var(--text-primary);
}

/* Input Group */
.input-group {
    display: flex;
    gap: 0;
}

.input-group .form-input {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    flex: 1;
}

.input-group-append {
    display: flex;
}

.input-group-btn {
    padding: 12px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    background: var(--primary-50);
    border: 1.5px solid var(--primary);
    border-left: none;
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.input-group-btn:hover {
    background: var(--primary-100);
}

.input-group-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Select */
.form-select {
    width: 100%;
    padding: 12px 40px 12px 16px;
    font-size: 0.9375rem;
    color: var(--text-primary);
    background: var(--bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23697386' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    appearance: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-100);
}

/* Checkbox */
.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.form-checkbox-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.form-checkbox-label a {
    color: var(--primary);
    font-weight: 500;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 24px;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(99, 91, 255, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 91, 255, 0.4);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1.5px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1.5px solid var(--primary);
}

.btn-outline:hover {
    background: var(--primary-50);
}

.btn-link {
    background: transparent;
    color: var(--text-secondary);
    padding: 8px 16px;
}

.btn-link:hover {
    color: var(--primary);
    background: var(--primary-50);
}

/* Social Login */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

.auth-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border-color);
}

.auth-divider-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.social-login {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.social-btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.social-btn:hover {
    border-color: var(--primary);
    background: var(--primary-50);
    transform: translateY(-2px);
}

.social-btn img {
    width: 24px;
    height: 24px;
    object-fit: contain;
}

.social-btn i {
    font-size: 20px;
}

.social-btn .fa-qq {
    color: #12B7F5;
}

.social-btn .fa-wechat {
    color: #07C160;
}

/* Auth Links */
.auth-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-light);
}

.auth-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.auth-link:hover {
    color: var(--primary);
}

.auth-link i {
    font-size: 14px;
}

/* Auth Footer */
.auth-footer {
    text-align: center;
    padding: 24px 40px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-light);
}

.auth-footer-text {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.auth-footer-text a {
    color: var(--text-secondary);
}

.auth-footer-text a:hover {
    color: var(--primary);
}

/* Captcha */
.captcha-wrapper {
    margin-bottom: 20px;
    min-height: 50px;
}

#captcha {
    border-radius: var(--radius-md);
    overflow: hidden;
}

#captcha_text {
    font-size: 0.875rem;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
}

#captcha_wait {
    display: flex;
    justify-content: center;
    padding: 12px;
}

.loading {
    display: flex;
    gap: 6px;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: loadingDot 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dot:nth-child(3) { animation-delay: 0s; }
.loading-dot:nth-child(4) { animation-delay: 0.16s; }

@keyframes loadingDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Modal */
.modal-modern {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-modern.show {
    display: flex;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 37, 64, 0.5);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.modal-dialog {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    background: var(--bg-primary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    animation: modalSlideUp 0.3s ease;
}

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

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
}

.modal-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.modal-close:hover {
    background: var(--error-light, #FFE5E5);
    color: var(--error);
}

.modal-body {
    padding: 24px;
    max-height: 60vh;
    overflow-y: auto;
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    background: var(--bg-secondary);
}

/* Alerts */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    margin-bottom: 16px;
}

.alert-info {
    background: var(--primary-50);
    color: var(--primary-dark);
    border: 1px solid var(--primary-100);
}

.alert-warning {
    background: #FFFCE8;
    color: #B89800;
    border: 1px solid #FFE066;
}

.alert-error {
    background: #FFE5E5;
    color: var(--error);
    border: 1px solid #FFCDD2;
}

.alert-success {
    background: #E8FAE8;
    color: #248A3D;
    border: 1px solid #A5D6A7;
}

/* Responsive */
@media (max-width: 480px) {
    .auth-wrapper {
        padding: 20px 16px;
    }
    
    .auth-header {
        padding: 32px 24px 20px;
    }
    
    .auth-body {
        padding: 0 24px 32px;
    }
    
    .auth-footer {
        padding: 20px 24px;
    }
    
    .auth-logo-text {
        font-size: 1.25rem;
    }
    
    .auth-title {
        font-size: 1.25rem;
    }
    
    .social-login {
        flex-wrap: wrap;
    }
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease;
}

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