/**
 * BankBot 客户端基础样式
 * 共享变量、主题、排版规范
 */

/* ========== CSS变量 - 主题 ========== */
:root {
    /* 亮色主题（默认） */
    --bg-primary: #FFFFFF;
    --bg-secondary: #F8FAFC;
    --bg-card: #FFFFFF;
    --bg-gradient: linear-gradient(135deg, #2563EB 0%, #7C3AED 100%);
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-muted: #94A3B8;
    --accent: #2563EB;
    --accent-hover: #1D4ED8;
    --accent-light: rgba(37, 99, 235, 0.1);
    --success: #16A34A;
    --success-bg: #DCFCE7;
    --danger: #DC2626;
    --danger-bg: #FEE2E2;
    --warning: #EA580C;
    --warning-bg: #FFF7ED;
    --border: #E2E8F0;
    --border-light: #F1F5F9;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --input-bg: #FFFFFF;
    --overlay: rgba(0, 0, 0, 0.5);
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

[data-theme="dark"] {
    /* 暗色主题 */
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-card: #1E293B;
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --accent: #3B82F6;
    --accent-hover: #60A5FA;
    --accent-light: rgba(59, 130, 246, 0.15);
    --success: #22C55E;
    --success-bg: rgba(34, 197, 94, 0.15);
    --danger: #EF4444;
    --danger-bg: rgba(239, 68, 68, 0.15);
    --warning: #F97316;
    --warning-bg: rgba(249, 115, 22, 0.15);
    --border: #334155;
    --border-light: #1E293B;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --input-bg: #0F172A;
    --overlay: rgba(0, 0, 0, 0.7);
}

/* ========== 基础重置 ========== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
        'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    background: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--accent-hover);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== 通用组件 ========== */

/* 按钮 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #FFFFFF;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: var(--border-light);
}

.btn-danger {
    background: var(--danger);
    color: #FFFFFF;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
}

/* 表单 */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 15px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 44px;
}

/* 卡片 */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-body {
    padding: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 16px;
    font-weight: 600;
}

/* 徽章 */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 20px;
}

.badge-pending {
    background: var(--warning-bg);
    color: var(--warning);
}

.badge-approved,
.badge-success {
    background: var(--success-bg);
    color: var(--success);
}

.badge-rejected,
.badge-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

/* 图标按钮 */
.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.icon-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.icon-btn svg {
    width: 22px;
    height: 22px;
}

/* 加载状态 */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 16px;
    color: var(--text-muted);
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 14px;
}

/* 头像 */
.avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFFFFF;
    font-weight: 600;
    font-size: 16px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

/* 分隔线 */
.divider {
    height: 1px;
    background: var(--border);
    margin: 16px 0;
}

/* 工具类 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-muted {
    color: var(--text-muted);
}

.text-success {
    color: var(--success);
}

.text-danger {
    color: var(--danger);
}

.text-sm {
    font-size: 13px;
}

.text-lg {
    font-size: 18px;
}

.font-bold {
    font-weight: 700;
}

.mt-4 {
    margin-top: 4px;
}

.mt-8 {
    margin-top: 8px;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mt-32 {
    margin-top: 32px;
}

.mb-4 {
    margin-bottom: 4px;
}

.mb-8 {
    margin-bottom: 8px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.justify-center {
    justify-content: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.hidden {
    display: none !important;
}

/* 主题切换开关 */
.theme-switch {
    position: relative;
    width: 52px;
    height: 28px;
    background: var(--border);
    border-radius: 14px;
    cursor: pointer;
    transition: background 0.3s;
}

.theme-switch.active {
    background: var(--accent);
}

.theme-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 24px;
    height: 24px;
    background: #FFFFFF;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: var(--shadow-sm);
}

.theme-switch.active::after {
    transform: translateX(24px);
}