/* DeepLaw AI 样式表 */
:root {
    --primary: #1a237e;
    --primary-hover: #0d1b60;
    --accent: #ffab00;
    --bg-main: #f8fafc;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-sub: #64748b;
    --border: #e2e8f0;
    --risk-high: #ef4444;
    --risk-med: #f59e0b;
    --risk-low: #3b82f6;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

body { margin: 0; padding: 0; font-family: "Segoe UI", system-ui, sans-serif; background: var(--bg-main); color: var(--text-main); height: 100vh; overflow: hidden; }
.app-container { display: flex; flex-direction: column; height: 100vh; }

/* Header */
.app-header { padding: 12px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border); display: flex; align-items: center; flex-shrink: 0; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--primary); font-size: 16px; }
.quota-badge { font-size: 11px; background: #eff6ff; color: var(--primary); padding: 4px 10px; border-radius: 12px; font-weight: 600; }

/* Tabs */
.nav-tabs { display: flex; background: var(--bg-card); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.nav-item { flex: 1; text-align: center; padding: 12px 0; font-size: 13px; font-weight: 600; color: var(--text-sub); cursor: pointer; border-bottom: 3px solid transparent; transition: 0.2s; display: flex; align-items: center; justify-content: center; gap: 6px; }
.nav-item:hover { background: #f8fafc; color: var(--primary); }
.nav-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Main */
main#app-body { flex: 1; padding: 16px; overflow-y: auto; scrollbar-width: none; }
main#app-body::-webkit-scrollbar { display: none; }

/* Cards */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 16px; box-shadow: var(--shadow-sm); overflow: hidden; padding: 16px; }
.card-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: 14px; font-weight: 700; color: var(--primary); }
.card-header-sm { font-size: 12px; font-weight: 700; color: #be123c; display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.privacy-card { border-left: 4px solid #f43f5e; background: linear-gradient(to right, #fff5f5 0%, #fff 100%); }

/* Inputs */
.form-group { margin-bottom: 14px; }
label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 600; color: var(--text-main); }
.modern-input { width: 100%; padding: 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 13px; background: #fff; font-family: inherit; box-sizing: border-box; }
.modern-input:focus { outline: none; border-color: var(--primary); }
textarea.modern-input { resize: vertical; }

/* Checkbox Group */
.checkbox-group { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 15px; }
.chip { padding: 6px 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; font-size: 11px; color: var(--text-sub); cursor: pointer; display: flex; align-items: center; gap: 6px; transition: 0.2s; }
.chip:has(input:checked) { background: #eff6ff; border-color: var(--primary); color: var(--primary); font-weight: 600; }
.chip input { display: none; }

/* Buttons */
.btn { width: 100%; border: none; border-radius: 8px; padding: 10px 16px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px; transition: 0.2s; }
.btn-sm { padding: 6px 12px; font-size: 12px; width: auto; }
.btn-primary { background: var(--primary); color: white; box-shadow: var(--shadow-md); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: #fff; border: 1px solid #d9534f; color: #d9534f; }
.btn-success { background: #10b981; color: white; }
.btn-outline { background: #fff; border: 1px solid #ddd; color: #666; }
.btn-icon { background: none; border: none; cursor: pointer; color: var(--text-sub); font-size: 12px; display: flex; align-items: center; gap: 4px; }

/* Dashboard & Review */
.review-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid #f0f0f0; }
.risk-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px; box-shadow: var(--shadow-sm); margin-bottom: 16px; }
.risk-type-badge { display: inline-block; background: var(--accent); color: #fff; padding: 2px 8px; border-radius: 6px; font-size: 10px; font-weight: 700; margin-bottom: 8px; }
.quote-box { background: #fff7ed; border-left: 3px solid #fdba74; padding: 10px; font-size: 12px; color: #9a3412; margin-bottom: 12px; }
.ai-msg { background: #f0f4f8; padding: 12px; border-radius: 8px; font-size: 13px; line-height: 1.6; }
.suggestion-box { background: #f0fdf4; border: 1px dashed #27ae60; padding: 10px; border-radius: 6px; margin-top: 10px; display: none; }

/* Stats */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin: 16px 0; }
.stat-item { background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 8px; text-align: center; }
.stat-item .count { display: block; font-size: 18px; font-weight: 700; }
.risk-list-item { display: flex; justify-content: space-between; align-items: center; padding: 12px; border-bottom: 1px solid #eee; cursor: pointer; font-size: 13px; }
.risk-list-item:hover { background: #f8fafc; }
.risk-list-item:hover .risk-action-btn { transform: translateX(2px); box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4), 0 2px 6px rgba(118, 75, 162, 0.3); }
.risk-dot { width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; display: inline-block; }

/* 风险卡片操作按钮 */
.risk-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
    white-space: nowrap;
}

.risk-action-btn:hover {
    background: linear-gradient(135deg, #5568d3 0%, #653a8a 100%);
    transform: translateX(2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4), 0 2px 6px rgba(118, 75, 162, 0.3);
}

.risk-action-btn:active {
    transform: translateX(2px) scale(0.98);
}

.risk-action-btn span {
    line-height: 1;
}

.risk-action-btn i {
    stroke-width: 2.5;
}

/* Modal & Payment */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 9999; display: none; align-items: center; justify-content: center; padding: 20px; }
.pay-card { background: #fff; width: 100%; max-width: 340px; border-radius: 16px; padding: 24px; text-align: center; position: relative; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.close-modal-btn { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border-radius: 50%; border: none; background: #f1f5f9; cursor: pointer; font-size: 16px; color: #666; display: flex; align-items: center; justify-content: center; }
.vip-badge { background: linear-gradient(90deg, #ffab00, #ff6d00); color: #fff; padding: 4px 12px; border-radius: 20px; font-size: 10px; font-weight: 800; display: inline-block; margin-bottom: 10px; }
.price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 20px 0; }
.price-item { border: 2px solid #f1f5f9; border-radius: 10px; padding: 12px 5px; cursor: pointer; transition: 0.2s; }
.price-item.active { border-color: var(--primary); background: #eff6ff; }
.p-tag { display: block; font-size: 11px; color: var(--text-sub); }
.p-val { display: block; font-size: 16px; font-weight: 800; color: var(--primary); }
.pay-btn { background: #1677ff; color: #fff; width: 100%; padding: 12px; border-radius: 8px; border: none; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 14px; }

/* Log */
#result-log { display: none; margin-top: 20px; padding: 10px; background: #fff; font-size: 11px; color: #666; border-top: 1px solid #eee; max-height: 100px; overflow-y: auto; }
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ==================== 新设计样式 ==================== */

/* 隐私盾按钮 - 大按钮样式 */
.btn-privacy-action {
    width: 100%;
    border: none;
    border-radius: 10px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    margin-top: 12px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-privacy-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-privacy-action.btn-restore {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 4px 15px rgba(17, 153, 142, 0.4);
}

.btn-privacy-action.btn-restore:hover {
    box-shadow: 0 6px 20px rgba(17, 153, 142, 0.5);
}

/* 模式切换按钮组 - 高端设计 */
.mode-toggle {
    display: flex;
    gap: 0;
    margin-top: 8px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 4px;
    border-radius: 12px;
    box-shadow: 
        inset 0 2px 4px rgba(0, 0, 0, 0.06),
        0 1px 2px rgba(0, 0, 0, 0.05);
    position: relative;
}

.mode-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    border: none;
    border-radius: 10px;
    background: transparent;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 13px;
    font-weight: 600;
    color: #6b7280;
    position: relative;
    z-index: 1;
    letter-spacing: 0.3px;
}

.mode-btn:hover:not(.active) {
    color: #374151;
    transform: translateY(-1px);
}

.mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 
        0 4px 12px rgba(102, 126, 234, 0.35),
        0 2px 6px rgba(118, 75, 162, 0.25),
        inset 0 -2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.25);
    transform: translateY(0);
}

.mode-btn.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0) 50%, rgba(0, 0, 0, 0.1) 100%);
    pointer-events: none;
}

.mode-btn.active:hover {
    box-shadow: 
        0 6px 16px rgba(102, 126, 234, 0.45),
        0 3px 8px rgba(118, 75, 162, 0.3),
        inset 0 -2px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 2px rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.mode-btn i {
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.mode-btn.active i {
    transform: scale(1.1);
}

/* 添加选中状态的勾选标记 */
.mode-btn.active::after {
    content: '✓';
    position: absolute;
    top: 2px;
    right: 6px;
    font-size: 10px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    background: rgba(255, 255, 255, 0.2);
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: checkmarkPop 0.3s ease;
}

@keyframes checkmarkPop {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0);
        opacity: 1;
    }
}

/* 悬停提示效果 */
.mode-btn:not(.active):hover {
    background: rgba(255, 255, 255, 0.6);
}

/* 模式描述文字 */
.mode-description {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    padding: 10px 12px;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
    font-size: 12px;
    color: #1e40af;
    line-height: 1.5;
    transition: all 0.3s ease;
}

.mode-description i {
    flex-shrink: 0;
    color: #3b82f6;
}

.mode-description {
    transition: opacity 0.3s ease, transform 0.3s ease, background 0.3s ease;
}

/* 加载状态遮罩 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 40px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #f3f4f6;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-text {
    font-size: 14px;
    font-weight: 600;
    color: #1a237e;
    text-align: center;
    max-width: 250px;
    line-height: 1.5;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.6;
    }
}

/* 底部 PRO 会员卡片 - 高级设计 */
.premium-section {
    padding: 20px 0;
    text-align: center;
}

.premium-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    padding: 24px;
    color: white;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
}

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

@keyframes shimmer {
    0%, 100% { transform: translate(0, 0); }
    50% { transform: translate(-30px, -30px); }
}

.premium-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}

.premium-title {
    font-size: 18px;
    font-weight: 800;
    margin: 0 0 16px 0;
    color: white;
}

.premium-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    text-align: left;
}

.premium-features li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.95);
}

.premium-features li i {
    color: #38ef7d;
}

.btn-premium {
    width: 100%;
    background: white;
    color: #667eea;
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 1;
}

.btn-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.btn-premium-text {
    font-size: 15px;
}

.btn-premium-price {
    font-size: 11px;
    opacity: 0.8;
}

.premium-note {
    margin: 12px 0 0 0;
    font-size: 11px;
    opacity: 0.8;
}

/* 支付模态框 - 重新设计 */
.modal-header {
    text-align: center;
    margin-bottom: 24px;
}

.modal-icon {
    width: 56px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    color: white;
}

.modal-title {
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 8px 0;
    color: #1e293b;
}

.modal-subtitle {
    font-size: 13px;
    color: #64748b;
    margin: 0;
}

/* 价格卡片 - 新设计 */
.price-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 24px 0;
}

.price-item {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    background: white;
}

.price-item:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.price-item.active {
    border-color: #667eea;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
}

/* recommended 类只用于显示推荐标签,不影响选中状态 */

.recommend-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 700;
}

.price-header {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 8px;
}

.price-period {
    font-size: 13px;
    color: #475569;
    font-weight: 600;
}

.price-save {
    font-size: 10px;
    color: #ef4444;
    font-weight: 600;
}

.price-amount {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
}

/* 支付按钮 - 高级设计 */
.btn-pay-premium {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.3s ease;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    margin-top: 8px;
}

.btn-pay-premium:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

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