/* ============================================================
   OSINT 商业情报系统 - 组件样式
   遵循 design-style-guide.md Modern Minimal 风格
   ============================================================ */

/* ========== 按钮 ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font: var(--font-btn);
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    text-decoration: none;
    line-height: 1.2;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: var(--shadow-focus);
}

.btn-secondary {
    background: var(--white);
    color: var(--gray-700);
    border: 1px solid var(--gray-300);
}
.btn-secondary:hover:not(:disabled) {
    background: var(--gray-50);
    border-color: var(--gray-400);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover:not(:disabled) {
    background: var(--primary-ring);
}

.btn-ghost {
    background: transparent;
    color: var(--gray-700);
    border: none;
}
.btn-ghost:hover:not(:disabled) {
    background: var(--gray-50);
}

.btn-danger {
    background: var(--error);
    color: var(--white);
}
.btn-danger:hover:not(:disabled) {
    background: #DC2626;
}

.btn-success {
    background: var(--success);
    color: var(--white);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.btn-block {
    display: flex;
    width: 100%;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: var(--radius-md);
}

/* ========== 输入框 ========== */
.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.form-label {
    font: var(--font-label);
    color: var(--gray-700);
    margin-bottom: var(--space-1);
}

.form-input,
.form-select,
.form-textarea {
    padding: 10px 14px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font: var(--font-body);
    color: var(--gray-900);
    background: var(--white);
    transition: all 0.2s ease;
    width: 100%;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--shadow-focus);
}

.form-input::placeholder {
    color: var(--gray-400);
}

.form-input.error {
    border-color: var(--error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-hint {
    font-size: 12px;
    color: var(--gray-400);
}

.form-error {
    font-size: 12px;
    color: var(--error);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

/* 验证码输入组 */
.captcha-group {
    display: flex;
    gap: var(--space-2);
    align-items: stretch;
}

.captcha-group .form-input {
    flex: 1;
}

.captcha-img {
    height: 42px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid var(--gray-200);
}

/* ========== 卡片 ========== */
.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--space-6);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
    padding-bottom: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
}

.card-title {
    font: var(--font-h3);
    color: var(--gray-900);
}

.card-body {
    padding: 0;
}

.card-footer {
    margin-top: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--gray-100);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* ========== 表格 ========== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead {
    background: var(--gray-50);
}

.data-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-700);
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 1px solid var(--gray-200);
}

.data-table td {
    padding: 12px 16px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
}

.data-table tbody tr:hover {
    background: var(--gray-50);
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== 标签 ========== */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
}

.tag-primary { background: var(--primary-ring); color: var(--primary); }
.tag-success { background: #D1FAE5; color: #065F46; }
.tag-warning { background: #FEF3C7; color: #92400E; }
.tag-error { background: #FEE2E2; color: #991B1B; }
.tag-info { background: #DBEAFE; color: #1E40AF; }
.tag-gray { background: var(--gray-100); color: var(--gray-500); }

/* ========== 模态框 ========== */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-modal);
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.25s ease;
}

@keyframes modalIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-6);
    border-bottom: 1px solid var(--gray-100);
}

.modal-title {
    font: var(--font-h3);
    color: var(--gray-900);
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray-400);
    padding: var(--space-1);
    font-size: 20px;
    line-height: 1;
}
.modal-close:hover { color: var(--gray-700); }

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
}

/* ========== 下拉菜单 ========== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 160px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--gray-200);
    padding: var(--space-1) 0;
    z-index: 50;
}

.dropdown-menu.active {
    display: block;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 14px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
}
.dropdown-item:hover {
    background: var(--gray-50);
    color: var(--primary);
    text-decoration: none;
}

/* ========== 分页 ========== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-1);
    margin-top: var(--space-6);
}

.pagination-btn {
    min-width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    background: var(--white);
    color: var(--gray-700);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    padding: 0 10px;
}
.pagination-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    text-decoration: none;
}
.pagination-btn.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}
.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: var(--space-12) var(--space-6);
}

.empty-state-icon {
    font-size: 48px;
    color: var(--gray-300);
    margin-bottom: var(--space-4);
}

.empty-state-title {
    font: var(--font-h3);
    color: var(--gray-700);
    margin-bottom: var(--space-2);
}

.empty-state-desc {
    color: var(--gray-500);
    font-size: 14px;
}

/* ========== 加载状态 ========== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--gray-200);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg { width: 32px; height: 32px; border-width: 3px; }

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-8);
    color: var(--gray-500);
    font-size: 14px;
}

/* ========== Tab ========== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--gray-200);
    margin-bottom: var(--space-6);
    overflow-x: auto;
}

.tab-item {
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-500);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: all 0.2s;
    text-decoration: none;
}
.tab-item:hover {
    color: var(--primary);
    text-decoration: none;
}
.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ========== 折叠面板 ========== */
.collapse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-3) 0;
    cursor: pointer;
    font-weight: 500;
    color: var(--gray-700);
}
.collapse-header:hover { color: var(--primary); }

.collapse-icon {
    transition: transform 0.2s;
    font-size: 12px;
}

.collapse-header.active .collapse-icon {
    transform: rotate(180deg);
}

.collapse-body {
    display: none;
    padding: var(--space-3) 0;
}

.collapse-body.active {
    display: block;
}

/* ========== 头像 ========== */
.avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--primary-ring);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.avatar-sm { width: 24px; height: 24px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }

.avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* ========== 搜索联想 ========== */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-dropdown);
    max-height: 240px;
    overflow-y: auto;
    z-index: 50;
    display: none;
}

.autocomplete-list.active {
    display: block;
}

.autocomplete-item {
    padding: 10px 14px;
    font-size: 14px;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.15s;
}
.autocomplete-item:hover,
.autocomplete-item.highlighted {
    background: var(--gray-50);
    color: var(--primary);
}

/* ========== 文件上传 ========== */
.file-upload {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.file-upload-input {
    display: none;
}

.file-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 8px 16px;
    border: 1px dashed var(--gray-300);
    border-radius: var(--radius-md);
    background: var(--gray-50);
    color: var(--gray-500);
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}
.file-upload-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-ring);
}

.file-upload-info {
    font-size: 12px;
    color: var(--gray-400);
}

/* ========== 进度条 ========== */
.progress-bar {
    height: 6px;
    background: var(--gray-200);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ========== 统计数字 ========== */
.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--gray-900);
    line-height: 1.2;
}

.stat-label {
    font-size: 14px;
    color: var(--gray-500);
    margin-top: var(--space-1);
}

.stat-card {
    text-align: center;
    padding: var(--space-6);
}

/* ========== 时间线 ========== */
.timeline {
    position: relative;
    padding-left: var(--space-8);
}

.timeline::before {
    content: '';
    position: absolute;
    left: 11px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: var(--gray-200);
}

.timeline-item {
    position: relative;
    padding-bottom: var(--space-6);
}

.timeline-item:last-child {
    padding-bottom: 0;
}

.timeline-dot {
    position: absolute;
    left: -28px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--primary);
}

.timeline-dot.success { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-dot.warning { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }

.timeline-content {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: var(--space-4);
}

.timeline-time {
    font-size: 12px;
    color: var(--gray-400);
}

.timeline-title {
    font-weight: 500;
    color: var(--gray-900);
    font-size: 14px;
}

.timeline-desc {
    font-size: 13px;
    color: var(--gray-500);
    margin-top: var(--space-1);
}
