/**
 * 身份验证器主样式表
 * Version: 2.0.0
 * 从 authenticator.html 提取的完整样式
 */

/* ========== 基础样式 ========== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol';
    background: #0f172a;
    min-height: 100vh;
    padding: 20px;
    color: #e2e8f0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* ========== 头部样式 ========== */

.header {
    text-align: center;
    margin-bottom: 40px;
    padding: 40px 20px;
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border-radius: 20px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    position: relative;
}

.header h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Emoji 保持原色 */
.header h1 .emoji {
    color: #f59e0b;
    filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.3));
    font-style: normal;
}

/* 文字部分使用渐变 */
.header h1 .title-text {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 50%, #f472b6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header p {
    font-size: 1.1rem;
    color: #94a3b8;
}

/* ========== 语言切换器 ========== */

.language-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 8px;
    background: rgba(30, 41, 59, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 12px;
    padding: 4px;
    backdrop-filter: blur(10px);
}

.language-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.language-btn:hover {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.language-btn.active {
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* ========== 布局 ========== */

.main-grid {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 30px;
    align-items: start;
}

.sidebar {
    position: sticky;
    top: 20px;
}

/* ========== 卡片样式 ========== */

.card {
    background: #1e293b;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.1);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ========== 按钮样式 ========== */

.btn {
    padding: 12px 20px;
    border: none;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    justify-content: center;
    white-space: nowrap;
    min-width: fit-content;
}

.btn-primary {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(59, 130, 246, 0.4);
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.3);
    border-color: rgba(148, 163, 184, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 1.1rem;
}

.btn-icon:hover {
    transform: scale(1.1);
}

/* ========== 动画 ========== */

@keyframes copySuccess {
    0% { 
        transform: scale(1); 
    }
    50% { 
        transform: scale(1.3) rotate(5deg); 
    }
    100% { 
        transform: scale(1) rotate(0deg); 
    }
}

.btn-icon.copy-success {
    animation: copySuccess 0.6s ease-in-out;
}

@keyframes shimmer {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== 表单样式 ========== */

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #cbd5e1;
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 12px 14px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-size: 0.95rem;
    color: #e2e8f0;
    transition: all 0.3s;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 🆕 v2.2.8: 禁用的选项保持白色字体 */
.form-group select option:disabled {
    color: #e2e8f0 !important;
    opacity: 0.7;
}

/* 针对不同浏览器的兼容性 */
.form-group select option[disabled] {
    color: #e2e8f0 !important;
    -webkit-text-fill-color: #e2e8f0 !important;
}

/* ========== 密码输入框 ========== */

.password-input-wrapper {
    position: relative;
}

.password-input-wrapper input {
    padding-right: 45px;
}

.toggle-password-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.toggle-password-btn:hover {
    color: #cbd5e1;
}

.toggle-password-btn svg {
    width: 20px;
    height: 20px;
}

/* ========== 密码强度指示器 ========== */

.password-strength {
    margin-top: 10px;
}

.password-strength-bar {
    height: 4px;
    background: rgba(148, 163, 184, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 8px;
}

.password-strength-progress {
    height: 100%;
    width: 0%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.password-strength-progress.veryWeak {
    width: 20%;
    background: linear-gradient(90deg, #dc2626, #b91c1c);
}

.password-strength-progress.weak {
    width: 40%;
    background: linear-gradient(90deg, #ef4444, #dc2626);
}

.password-strength-progress.medium {
    width: 60%;
    background: linear-gradient(90deg, #f59e0b, #d97706);
}

.password-strength-progress.strong {
    width: 80%;
    background: linear-gradient(90deg, #10b981, #059669);
}

.password-strength-progress.veryStrong {
    width: 100%;
    background: linear-gradient(90deg, #059669, #047857);
}

.password-strength-text {
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.password-strength-text.veryWeak {
    color: #dc2626;
}

.password-strength-text.weak {
    color: #ef4444;
}

.password-strength-text.medium {
    color: #f59e0b;
}

.password-strength-text.strong {
    color: #10b981;
}

.password-strength-text.veryStrong {
    color: #059669;
}

.password-requirements {
    margin-top: 10px;
    padding: 12px;
    background: rgba(148, 163, 184, 0.05);
    border-radius: 8px;
    font-size: 0.85rem;
}

.password-requirements ul {
    margin: 8px 0 0 0;
    padding-left: 20px;
    color: #94a3b8;
}

.password-requirements li {
    margin: 4px 0;
    transition: color 0.2s;
}

.password-requirements li.met {
    color: #10b981;
}

.password-requirements li.met::marker {
    content: '✓ ';
}

.password-requirements li:not(.met)::marker {
    content: '○ ';
}

/* ========== 分组列表 ========== */

.group-list {
    margin-bottom: 20px;
}

.group-item {
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.group-item:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
}

.group-item.active {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.2) 0%, rgba(139, 92, 246, 0.2) 100%);
    border-color: #3b82f6;
}

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

.group-icon {
    font-size: 1.3rem;
}

.group-name {
    font-weight: 600;
    color: #f1f5f9;
}

.group-count {
    background: rgba(100, 116, 139, 0.3);
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    color: #94a3b8;
}

.group-actions {
    display: flex;
    gap: 4px;
}

/* ========== 账户区域 ========== */

.accounts-section {
    min-height: 400px;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 12px;
}

.accounts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* ========== 账户卡片 ========== */

.account-card {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.15);
    border-radius: 16px;
    padding: 16px;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.account-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
    opacity: 0;
    transition: opacity 0.3s;
}

.account-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    border-color: rgba(59, 130, 246, 0.4);
}

.account-card:hover::before {
    opacity: 1;
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.account-info h3 {
    font-size: 1rem;
    color: #f1f5f9;
    margin-bottom: 2px;
    font-weight: 600;
}

.account-info p {
    color: #94a3b8;
    font-size: 0.75rem;
}

.account-actions {
    display: flex;
    gap: 6px;
}

.account-actions button[data-action="edit"] {
    display: none;
}

/* ========== TOTP 显示 ========== */

.totp-display {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    padding: 16px;
    border-radius: 12px;
    text-align: center;
    margin-bottom: 10px;
    position: relative;
    overflow: hidden;
}

.totp-display::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

.totp-code {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 8px;
    font-family: 'Courier New', monospace;
    color: white;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.totp-timer {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.totp-seconds {
    flex-shrink: 0;
    min-width: 30px;
}

.totp-progress {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
    overflow: hidden;
}

.totp-progress-bar {
    height: 100%;
    background: white;
    transition: width 1s linear;
    border-radius: 3px;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

/* ========== 账户分组标签 ========== */

.account-group-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(100, 116, 139, 0.15);
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 0.85rem;
    color: #94a3b8;
    margin-top: 8px;
}

.account-group-badge span:first-child {
    font-size: 1rem;
}

/* ========== 空状态 ========== */

.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: #64748b;
}

.empty-state-icon {
    font-size: 5rem;
    margin-bottom: 24px;
    opacity: 0.3;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 12px;
    color: #94a3b8;
}

/* ========== 模态框 ========== */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal.active {
    display: flex;
}

/* 确认模态框需要更高层级 */
#confirmModal {
    z-index: 10001;
}

/* 错误模态框需要最高层级 */
#errorModal {
    z-index: 10002;
}

/* 安全删除确认模态框需要更高层级 */
.modal[style*="z-index: 10003"],
.modal[style*="z-index: 10004"] {
    z-index: inherit !important;
}

.modal-content {
    background: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 20px;
    max-width: 500px;
    width: 100%;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.75rem;
    color: #f1f5f9;
    font-weight: 700;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.modal-close:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.modal-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    flex-wrap: nowrap;
}

.modal-footer .btn {
    flex: 0 1 auto;
    min-width: 80px;
    padding: 10px 16px;
}

/* ========== 提示消息 ========== */

.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    z-index: 20000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
}

.toast.warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
}

/* ========== 图标 ========== */

.icon {
    display: inline-block;
    vertical-align: middle;
    color: currentColor;
    fill: currentColor;
}

.icon-option {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ========== 响应式设计 ========== */

@media (max-width: 1024px) {
    .main-grid {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }
}

@media (max-width: 768px) {
    .header h1 {
        font-size: 2rem;
    }

    .accounts-grid {
        grid-template-columns: 1fr;
    }

    .totp-code {
        font-size: 1.8rem;
        letter-spacing: 4px;
    }
}

/* ========== Toggle开关样式 ========== */

.toggle-switch {
    position: relative;
    width: 50px;
    height: 26px;
    background: rgba(148, 163, 184, 0.3);
    border-radius: 13px;
    transition: background 0.3s;
}

.toggle-switch input[type="checkbox"] {
    display: none;
}

.toggle-slider {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s;
}

/* 当checkbox选中时，滑块向右移动 */
.toggle-switch:has(input[type="checkbox"]:checked) .toggle-slider {
    transform: translateX(24px);
}

/* 当checkbox选中时，背景变蓝 */
.toggle-switch:has(input[type="checkbox"]:checked) {
    background: #3b82f6;
}

/* label悬停效果 */
label:has(.toggle-switch):hover .toggle-switch {
    opacity: 0.9;
}

/* ========== 屏幕保护样式（从screen-protection.js使用） ========== */

.screen-protected {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.blur-sensitive {
    filter: blur(8px);
    transition: filter 0.3s ease;
}

.unblur-sensitive {
    filter: blur(0px);
}

.protection-overlay {
    pointer-events: none;
    user-select: none;
}

.no-touch-callout {
    -webkit-touch-callout: none;
}


/* ==========  ?????? v2.3.2 ========== */

/* ??????? */
.bulk-action-bar {
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(99, 102, 241, 0.1) 100%);
    border: 2px solid rgba(139, 92, 246, 0.3);
    border-radius: 16px;
    padding: 16px 24px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    animation: slideDown 0.3s ease;
}

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

.bulk-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    color: #e2e8f0;
}

.bulk-icon {
    font-size: 1.5rem;
}

.bulk-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: #8b5cf6;
    min-width: 32px;
    text-align: center;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bulk-action-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 0.9rem;
    white-space: nowrap;
}

.bulk-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.bulk-divider {
    width: 1px;
    height: 24px;
    background: rgba(148, 163, 184, 0.3);
    margin: 0 4px;
}

/* ????????? */
.account-checkbox {
    display: none;
    position: absolute;
    top: 12px;
    left: 12px;
    width: 24px;
    height: 24px;
    cursor: pointer;
    z-index: 10;
    accent-color: #8b5cf6;
}

body.bulk-mode .account-checkbox {
    display: block;
}

/* ????????????? */
body.bulk-mode .account-card {
    position: relative;
    padding-left: 48px;
}

body.bulk-mode .account-card .account-header {
    padding-left: 8px;
}

/* ??????? */
body.bulk-mode {
    --bulk-indicator-color: #8b5cf6;
}

body.bulk-mode .accounts-section {
    border-left: 4px solid var(--bulk-indicator-color);
    padding-left: 16px;
    transition: all 0.3s ease;
}

/* ????????? */
.account-card.selected {
    background: rgba(139, 92, 246, 0.2) !important;
    border-color: rgba(139, 92, 246, 0.5) !important;
    box-shadow: 0 0 0 2px rgba(139, 92, 246, 0.3);
}

/* ???????? */
.btn-sm {
    padding: 6px 12px;
    font-size: 0.875rem;
    min-width: auto;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-danger:active {
    background: rgba(239, 68, 68, 0.3);
}

/* ??????????? */
#bulkMoveModal .form-control {
    transition: all 0.3s ease;
}

#bulkMoveModal .form-control:focus {
    border-color: #8b5cf6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

/* ????? - ???? */
@media (max-width: 768px) {
    .bulk-action-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 12px 16px;
    }
    
    .bulk-info {
        justify-content: center;
        padding-bottom: 8px;
        border-bottom: 1px solid rgba(148, 163, 184, 0.2);
    }
    
    .bulk-actions {
        justify-content: center;
        gap: 6px;
    }
    
    .bulk-action-btn {
        padding: 6px 12px;
        font-size: 0.85rem;
    }
    
    .bulk-action-btn span:not(.icon) {
        display: none;
    }
    
    .bulk-divider {
        display: none;
    }
    
    body.bulk-mode .account-card {
        padding-left: 42px;
    }
    
    .account-checkbox {
        width: 20px;
        height: 20px;
        top: 10px;
        left: 10px;
    }
}

@media (max-width: 480px) {
    .bulk-action-btn {
        padding: 4px 8px;
        min-width: 36px;
        justify-content: center;
    }
}
