/**
 * 爱抓马创意工具 - 登录认证系统样式
 * 设计风格：现代SaaS、科技感、深蓝+亮蓝配色
 */

/* ========================================
   CSS 变量 - 设计令牌
   ======================================== */
:root {
    /* 主色调 */
    --auth-primary: #3b82f6;
    --auth-primary-dark: #2563eb;
    --auth-primary-light: #60a5fa;
    --auth-primary-bg: rgba(59, 130, 246, 0.1);
    
    /* 背景色 */
    --auth-bg-dark: #1a202c;
    --auth-bg-light: #f8fafc;
    --auth-bg-modal: rgba(15, 23, 42, 0.6);
    --auth-bg-card: #ffffff;
    
    /* 文字色 */
    --auth-text-primary: #1e293b;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-text-light: #cbd5e1;
    
    /* 边框色 */
    --auth-border: #e2e8f0;
    --auth-border-focus: #3b82f6;
    --auth-border-error: #ef4444;
    
    /* 状态色 */
    --auth-success: #22c55e;
    --auth-warning: #f59e0b;
    --auth-error: #ef4444;
    
    /* 社交登录色 */
    --auth-wechat: #07c160;
    --auth-qq: #12b7f5;
    --auth-google: #ea4335;
    
    /* 阴影 */
    --auth-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --auth-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --auth-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --auth-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --auth-shadow-modal: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    
    /* 圆角 */
    --auth-radius-sm: 6px;
    --auth-radius-md: 10px;
    --auth-radius-lg: 16px;
    --auth-radius-xl: 24px;
    --auth-radius-full: 9999px;
    
    /* 过渡 */
    --auth-transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --auth-transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --auth-transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* 字体 */
    --auth-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}

/* 深色模式 */
@media (prefers-color-scheme: dark) {
    :root {
        --auth-bg-light: #0f172a;
        --auth-bg-card: #1e293b;
        --auth-text-primary: #f1f5f9;
        --auth-text-secondary: #94a3b8;
        --auth-border: #334155;
    }
}

/* ========================================
   登录按钮（侧边栏）
   ======================================== */
.auth-sidebar-login {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin: 8px 12px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    border: none;
    border-radius: var(--auth-radius-md);
    color: #fff;
    font-family: var(--auth-font-sans);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--auth-transition-normal);
    box-shadow: var(--auth-shadow-md);
}

.auth-sidebar-login:hover {
    transform: translateY(-2px);
    box-shadow: var(--auth-shadow-lg), 0 0 20px rgba(59, 130, 246, 0.4);
}

.auth-sidebar-login:active {
    transform: translateY(0);
}

.auth-sidebar-login__icon {
    width: 20px;
    height: 20px;
    opacity: 0.9;
}

/* ========================================
   用户菜单（已登录状态）
   ======================================== */
.auth-user-menu {
    position: relative;
    margin: 8px 12px;
}

.auth-user-menu__trigger {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--auth-radius-md);
    cursor: pointer;
    transition: all var(--auth-transition-fast);
}

.auth-user-menu__trigger:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
}

.auth-user-menu__avatar {
    width: 36px;
    height: 36px;
    border-radius: var(--auth-radius-full);
    background: linear-gradient(135deg, var(--auth-primary-light) 0%, var(--auth-primary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    overflow: hidden;
}

.auth-user-menu__avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.auth-user-menu__info {
    flex: 1;
    text-align: left;
}

.auth-user-menu__name {
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
}

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

.auth-user-menu__arrow {
    color: var(--auth-text-muted);
    transition: transform var(--auth-transition-fast);
}

.auth-user-menu.is-open .auth-user-menu__arrow {
    transform: rotate(180deg);
}

/* 下拉菜单 */
.auth-user-menu__dropdown {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 0;
    right: 0;
    background: var(--auth-bg-card);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    box-shadow: var(--auth-shadow-xl);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all var(--auth-transition-fast);
    z-index: 100;
}

.auth-user-menu.is-open .auth-user-menu__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.auth-user-menu__item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: var(--auth-text-primary);
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--auth-transition-fast);
}

.auth-user-menu__item:first-child {
    border-radius: var(--auth-radius-md) var(--auth-radius-md) 0 0;
}

.auth-user-menu__item:last-child {
    border-radius: 0 0 var(--auth-radius-md) var(--auth-radius-md);
}

.auth-user-menu__item:hover {
    background: var(--auth-primary-bg);
}

.auth-user-menu__item--danger {
    color: var(--auth-error);
}

.auth-user-menu__item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

.auth-user-menu__divider {
    height: 1px;
    background: var(--auth-border);
    margin: 4px 0;
}

/* ========================================
   登录弹窗
   ======================================== */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--auth-bg-modal);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--auth-transition-normal);
}

.auth-modal-overlay.is-visible {
    opacity: 1;
    visibility: visible;
}

.auth-modal {
    width: 100%;
    max-width: 420px;
    max-height: 90vh;
    background: var(--auth-bg-card);
    border-radius: var(--auth-radius-xl);
    box-shadow: var(--auth-shadow-modal);
    transform: scale(0.95) translateY(20px);
    transition: all var(--auth-transition-normal);
    overflow: hidden;
}

.auth-modal-overlay.is-visible .auth-modal {
    transform: scale(1) translateY(0);
}

/* 弹窗头部 */
.auth-modal__header {
    position: relative;
    padding: 28px 28px 20px;
    text-align: center;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
}

.auth-modal__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    border-radius: var(--auth-radius-sm);
    transition: all var(--auth-transition-fast);
}

.auth-modal__close:hover {
    background: var(--auth-border);
    color: var(--auth-text-primary);
}

.auth-modal__logo {
    width: 56px;
    height: 56px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, var(--auth-primary-light) 0%, var(--auth-primary-dark) 100%);
    border-radius: var(--auth-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    box-shadow: var(--auth-shadow-md);
}

.auth-modal__title {
    color: var(--auth-text-primary);
    font-size: 22px;
    font-weight: 600;
    margin: 0 0 4px;
    font-family: var(--auth-font-sans);
}

.auth-modal__subtitle {
    color: var(--auth-text-secondary);
    font-size: 14px;
    margin: 0;
}

/* 标签页 */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid var(--auth-border);
    padding: 0 28px;
}

.auth-tabs__item {
    flex: 1;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--auth-text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    position: relative;
    transition: color var(--auth-transition-fast);
}

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

.auth-tabs__item.is-active {
    color: var(--auth-primary);
}

.auth-tabs__item::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--auth-primary);
    border-radius: 1px;
    transform: translateX(-50%);
    transition: width var(--auth-transition-fast);
}

.auth-tabs__item.is-active::after {
    width: 60%;
}

/* 表单内容 */
.auth-modal__body {
    padding: 24px 28px 28px;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 输入框组 */
.auth-input-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.auth-input-group__label {
    color: var(--auth-text-primary);
    font-size: 14px;
    font-weight: 500;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    padding: 12px 16px;
    background: var(--auth-bg-light);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    color: var(--auth-text-primary);
    font-size: 15px;
    font-family: var(--auth-font-sans);
    transition: all var(--auth-transition-fast);
}

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

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

.auth-input.is-error {
    border-color: var(--auth-error);
}

.auth-input.is-error:focus {
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* 带前缀的输入框 */
.auth-input--with-prefix {
    padding-left: 80px;
}

.auth-input-prefix {
    position: absolute;
    left: 1px;
    top: 1px;
    bottom: 1px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--auth-border);
    border-radius: var(--auth-radius-md) 0 0 var(--auth-radius-md);
    color: var(--auth-text-secondary);
    font-size: 14px;
    cursor: pointer;
}

/* 带后缀按钮的输入框 */
.auth-input--with-suffix {
    padding-right: 120px;
}

.auth-input-suffix {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

.auth-code-btn {
    padding: 8px 14px;
    background: var(--auth-primary-bg);
    border: none;
    border-radius: var(--auth-radius-sm);
    color: var(--auth-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--auth-transition-fast);
    white-space: nowrap;
}

.auth-code-btn:hover:not(:disabled) {
    background: var(--auth-primary);
    color: #fff;
}

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

/* 密码显示切换 */
.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 4px;
    transition: color var(--auth-transition-fast);
}

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

/* 错误信息 */
.auth-error-msg {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--auth-error);
    font-size: 13px;
    margin-top: 4px;
}

/* 主按钮 */
.auth-btn-primary {
    width: 100%;
    padding: 14px 24px;
    background: linear-gradient(135deg, var(--auth-primary) 0%, var(--auth-primary-dark) 100%);
    border: none;
    border-radius: var(--auth-radius-md);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--auth-transition-normal);
    box-shadow: var(--auth-shadow-md);
    margin-top: 8px;
}

.auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--auth-shadow-lg), 0 0 25px rgba(59, 130, 246, 0.4);
}

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

.auth-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* 加载状态 */
.auth-btn-primary.is-loading {
    position: relative;
    color: transparent;
}

.auth-btn-primary.is-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: auth-spin 0.8s linear infinite;
}

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

/* 分隔线 */
.auth-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 20px 0;
    color: var(--auth-text-muted);
    font-size: 13px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--auth-border);
}

/* 社交登录 */
.auth-social {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.auth-social__btn {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--auth-bg-light);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-full);
    cursor: pointer;
    transition: all var(--auth-transition-fast);
}

.auth-social__btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--auth-shadow-md);
}

.auth-social__btn--wechat:hover {
    border-color: var(--auth-wechat);
    background: rgba(7, 193, 96, 0.1);
}

.auth-social__btn--google:hover {
    border-color: var(--auth-google);
    background: rgba(234, 67, 53, 0.1);
}

.auth-social__btn--qq:hover {
    border-color: var(--auth-qq);
    background: rgba(18, 183, 245, 0.1);
}

.auth-social__icon {
    width: 24px;
    height: 24px;
}

/* 协议勾选 */
.auth-agreement {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-top: 8px;
}

.auth-checkbox {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    accent-color: var(--auth-primary);
    cursor: pointer;
}

.auth-agreement__text {
    color: var(--auth-text-secondary);
    font-size: 13px;
    line-height: 1.5;
}

.auth-agreement__link {
    color: var(--auth-primary);
    text-decoration: none;
}

.auth-agreement__link:hover {
    text-decoration: underline;
}

/* 底部链接 */
.auth-modal__footer {
    text-align: center;
    padding-bottom: 4px;
}

.auth-switch-mode {
    color: var(--auth-text-secondary);
    font-size: 14px;
}

.auth-switch-mode__link {
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
}

.auth-switch-mode__link:hover {
    text-decoration: underline;
}

/* ========================================
   微信扫码登录
   ======================================== */
.auth-qrcode {
    text-align: center;
    padding: 20px 0;
}

.auth-qrcode__container {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-lg);
    box-shadow: var(--auth-shadow-sm);
}

.auth-qrcode__img {
    width: 100%;
    height: 100%;
}

.auth-qrcode__tip {
    color: var(--auth-text-secondary);
    font-size: 14px;
}

.auth-qrcode__tip strong {
    color: var(--auth-wechat);
}

/* 刷新二维码 */
.auth-qrcode__refresh {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 16px;
    background: none;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-md);
    color: var(--auth-text-secondary);
    font-size: 13px;
    cursor: pointer;
    transition: all var(--auth-transition-fast);
}

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

/* ========================================
   Toast 提示
   ======================================== */
.auth-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    background: var(--auth-bg-dark);
    color: #fff;
    border-radius: var(--auth-radius-md);
    font-size: 14px;
    box-shadow: var(--auth-shadow-lg);
    z-index: 1100;
    opacity: 0;
    transition: all var(--auth-transition-normal);
}

.auth-toast.is-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.auth-toast.is-success {
    background: var(--auth-success);
}

.auth-toast.is-error {
    background: var(--auth-error);
}

/* ========================================
   响应式设计
   ======================================== */
@media (max-width: 480px) {
    .auth-modal {
        max-width: 100%;
        margin: 16px;
        border-radius: var(--auth-radius-lg);
    }
    
    .auth-modal__header {
        padding: 24px 20px 16px;
    }
    
    .auth-modal__body {
        padding: 20px;
    }
    
    .auth-tabs {
        padding: 0 20px;
    }
    
    .auth-social {
        gap: 16px;
    }
    
    .auth-social__btn {
        width: 44px;
        height: 44px;
    }
}

/* ========================================
   动画关键帧
   ======================================== */
@keyframes auth-fade-in {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes auth-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.auth-input.is-shake {
    animation: auth-shake 0.5s ease-in-out;
}
