* { box-sizing: border-box; }
body { 
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft Yahei', sans-serif; 
    margin: 0; 
    padding: 0; 
    background: #f6f8fa; 
    color: #24292f;
    /* 移动端优化 */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

.container { 
    max-width: 1100px; 
    margin: 0 auto; 
    padding: 24px;
    /* 移动端自适应 */
    width: 100%;
}

h1 { 
    font-size: 22px; 
    margin: 0 0 16px 0;
}

.card { 
    background: #fff; 
    border: 1px solid #e1e4e8; 
    border-radius: 8px; 
    padding: 16px; 
    margin-bottom: 16px;
    /* 移动端优化 */
    overflow-x: auto;
}

.form-row { 
    display: flex; 
    align-items: center; 
    gap: 12px; 
    margin-bottom: 12px;
    /* 移动端自适应 */
    flex-wrap: wrap;
}

label { 
    min-width: 100px; 
    color: #57606a;
    /* 移动端优化 */
    font-size: 14px;
}

input[type="text"], 
input[type="url"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="file"], 
select { 
    flex: 1; 
    padding: 8px 10px; 
    border: 1px solid #d0d7de; 
    border-radius: 6px;
    /* 移动端优化 */
    font-size: 16px; /* 防止iOS自动缩放 */
    min-width: 0; /* 防止溢出 */
}

button { 
    background: #0969da; 
    color: #fff; 
    border: 0; 
    padding: 8px 14px; 
    border-radius: 6px; 
    cursor: pointer;
    /* 移动端优化 */
    font-size: 14px;
    min-height: 44px; /* iOS推荐的最小触摸区域 */
    touch-action: manipulation; /* 防止双击缩放 */
}

button:hover { 
    background: #0553b1; 
}

button:disabled { 
    background: #6e7781; 
    cursor: not-allowed; 
}

button.danger { 
    background: #b31d28; 
}

button.danger:hover { 
    background: #8c1820; 
}

.muted { 
    color: #6e7781; 
}

.error { 
    color: #b31d28; 
}

/* 每页显示条数选择器样式 */
.page-size-select {
    min-width: 120px;
    flex: 0 0 auto;
}

/* 上传模式选择器样式 */
.upload-mode-selector {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    /* 移动端优化 */
    min-height: 44px;
}

.radio-label:hover {
    background-color: #f6f8fa;
}

.radio-label input[type="radio"] {
    margin: 0;
    cursor: pointer;
    /* 移动端优化 */
    min-width: 20px;
    min-height: 20px;
}

.radio-label span {
    font-size: 14px;
    color: #24292f;
    cursor: pointer;
}

/* 调试信息样式 */
.debug-info {
    margin-top: 20px;
    padding: 16px;
    background: #f8f9fa;
    border: 1px solid #e1e4e8;
    border-radius: 8px;
    font-size: 14px;
}

.debug-info h4 {
    margin: 0 0 16px 0;
    color: #24292f;
    font-size: 16px;
}

.debug-section {
    margin-bottom: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #e1e4e8;
}

.debug-section:last-child {
    border-bottom: none;
}

.debug-section strong {
    color: #0969da;
    display: inline-block;
    min-width: 100px;
}

.sample-data {
    margin-top: 8px;
}

.sample-row {
    margin-bottom: 12px;
    padding: 8px;
    background: #fff;
    border-radius: 4px;
    border: 1px solid #d0d7de;
}

.sample-row strong {
    color: #1a7f37;
    display: block;
    margin-bottom: 6px;
}

.row-data {
    font-size: 13px;
    color: #57606a;
}

.col-item {
    display: inline-block;
    margin-right: 8px;
    padding: 2px 6px;
    background: #f6f8fa;
    border-radius: 3px;
    border: 1px solid #e1e4e8;
    cursor: help;
}

/* 数据表格样式 */
.data-table { 
    width: 100%; 
    border-collapse: collapse;
    /* 移动端优化 */
    font-size: 18px;
}

.data-table th, 
.data-table td { 
    border: 1px solid #d0d7de; 
    padding: 8px; 
    text-align: left;
    /* 移动端优化 */
    min-width: 80px;
    word-break: break-word;
}

/* 第一列（复选框）和最后一列（操作）的特殊样式 */
.data-table th:first-child,
.data-table td:first-child {
    min-width: auto;
    width: auto;
    max-width: none;
    padding: 4px 8px;
    text-align: center;
}

.data-table th:last-child,
.data-table td:last-child {
    min-width: auto;
    width: auto;
    max-width: none;
    padding: 4px 8px;
    text-align: center;
    white-space: nowrap;
}

.data-table thead { 
    background: #f3f4f6;
    /* 移动端优化 - 固定表头 */
    position: sticky;
    top: 0;
    z-index: 10;
}

/* 分页样式 */
.pagination { 
    display: flex; 
    gap: 6px; 
    margin-top: 8px; 
    flex-wrap: wrap;
    /* 移动端优化 */
    justify-content: center;
}

.page-btn { 
    background: #eaeef2; 
    color: #24292f;
    /* 移动端优化 */
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-btn.active { 
    background: #24292f; 
    color: #fff; 
}

/* 上传进度条样式 */
.upload-progress { 
    margin: 16px 0; 
    padding: 16px; 
    background: #f6f8fa; 
    border-radius: 8px; 
    border: 1px solid #e1e4e8; 
}

.progress-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 8px; 
    font-weight: 500;
    /* 移动端优化 */
    flex-wrap: wrap;
    gap: 8px;
}

.progress-bar { 
    width: 100%; 
    height: 8px; 
    background: #e1e4e8; 
    border-radius: 4px; 
    overflow: hidden; 
    margin-bottom: 8px; 
}

.progress-fill { 
    height: 100%; 
    background: linear-gradient(90deg, #0969da, #1a7f37); 
    width: 0%; 
    transition: width 0.3s ease; 
    border-radius: 4px; 
}

.progress-status { 
    font-size: 14px; 
    color: #57606a; 
    text-align: center; 
}

/* 上传结果样式 */
.upload-result { 
    margin-top: 16px; 
}

.result-message { 
    padding: 12px 16px; 
    border-radius: 6px; 
    font-weight: 500; 
    line-height: 1.4;
    /* 移动端优化 */
    word-break: break-word;
}

.result-message.success { 
    background: #dafbe1; 
    color: #1a7f37; 
    border: 1px solid #1a7f37; 
}

.result-message.error { 
    background: #ffebe9; 
    color: #b31d28; 
    border: 1px solid #b31d28; 
}

/* 文件选择提示 */
input[type="file"] + small { 
    display: block; 
    margin-top: 4px; 
    color: #6e7781; 
    font-size: 12px; 
}

/* 文件上传区域样式 */
.file-upload-area {
    flex: 1;
    position: relative;
    /* 移动端优化 */
    width: 100%;
}

.file-upload-area input[type="file"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    z-index: 2;
}

.file-drop-zone {
    border: 2px dashed #d0d7de;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #fafbfc;
    min-height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-drop-zone:hover {
    border-color: #0969da;
    background: #f6f8fa;
}

.file-drop-zone.drag-over {
    border-color: #1a7f37;
    background: #dafbe1;
    transform: scale(1.02);
}

.file-drop-zone.has-file {
    border-color: #1a7f37;
    background: #dafbe1;
}

.drop-zone-content {
    pointer-events: none;
}

.drop-zone-icon {
    font-size: 32px;
    margin-bottom: 8px;
    color: #6e7781;
}

.drop-zone-text {
    font-size: 16px;
    font-weight: 500;
    color: #24292f;
    margin-bottom: 4px;
}

.drop-zone-hint {
    font-size: 14px;
    color: #6e7781;
}

/* 文件已选择状态 */
.file-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 12px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #1a7f37;
    /* 移动端优化 */
    flex-wrap: wrap;
    gap: 8px;
}

.file-info {
    flex: 1;
    /* 移动端优化 */
    min-width: 0;
}

.file-name {
    font-weight: 500;
    color: #1a7f37;
    margin-bottom: 4px;
    word-break: break-all;
}

.file-size {
    font-size: 14px;
    color: #6e7781;
}

.remove-file {
    background: #ffebe9;
    color: #b31d28;
    border: 1px solid #b31d28;
    border-radius: 4px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    margin-left: 12px;
    flex-shrink: 0;
}

.remove-file:hover {
    background: #b31d28;
    color: #fff;
}

.cancel-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    margin-top: 10px;
    font-size: 14px;
    /* 移动端优化 */
    min-height: 44px;
}

.cancel-btn:hover {
    background: #c82333;
}

.cancel-btn:active {
    background: #bd2130;
}

.endpoint-info {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 3px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
}

.endpoint-info.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.endpoint-info.warning {
    background: #fff3cd;
    border-color: #ffeaa7;
    color: #856404;
} 

/* 公共导航样式 */
.header-bar {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    margin-bottom: 30px;
    padding: 20px 0;
    border-bottom: 2px solid #e1e5e9;
}

.header-bar h1 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 24px;
    width: 100%;
}

.home-link {
    color: #333;
    text-decoration: none;
    transition: color 0.3s;
}

.home-link:hover {
    color: #667eea;
}

.header-actions {
    display: flex;
    gap: 12px;
    align-items: center;
    align-self: flex-end;
}

.nav-link {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    /* 移动端优化 */
    min-height: 44px;
    white-space: nowrap;
}

.nav-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.logout-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
    /* 移动端优化 */
    min-height: 44px;
    white-space: nowrap;
}

.logout-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

/* ========================================
   响应式设计 - 移动端优化
   ======================================== */

/* 平板设备 (768px - 1024px) */
@media (max-width: 1024px) {
    .container {
        padding: 16px;
    }
    
    .data-table {
        font-size: 13px;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px;
        min-width: 60px;
    }
    
    /* 快捷搜索栏优化 */
    .quick-search-wrapper {
        flex-direction: column !important;
        gap: 12px;
    }
    
    .quick-search-input-wrapper {
        width: 100%;
        flex: none;
    }
    
    .search-engine-select {
        width: 100% !important;
        max-width: none !important;
    }
    
    /* 搜索按钮和管理按钮的容器 */
    .search-buttons-wrapper {
        display: flex !important;
        gap: 10px;
        width: 100% !important;
    }
    
    .quick-search-btn {
        flex: 1 !important;
        width: auto !important;
        justify-content: center;
    }
    
    .manage-engines-btn {
        flex: 0 0 auto !important;
        width: auto !important;
    }
}

/* 手机设备 (最大 768px) */
@media (max-width: 768px) {
    body {
        font-size: 14px;
    }
    
    .container {
        padding: 12px;
    }
    
    h1 {
        font-size: 18px;
    }
    
    .card {
        padding: 12px;
        border-radius: 6px;
    }
    
    /* 表单行垂直布局 */
    .form-row { 
        flex-direction: column; 
        align-items: stretch; 
        gap: 8px; 
    }
    
    label { 
        min-width: auto; 
        margin-bottom: 4px;
        font-weight: 500;
    }
    
    /* 按钮全宽 */
    button {
        width: 100%;
        justify-content: center;
    }
    
    /* 导航栏优化 */
    .header-bar {
        padding: 12px 0;
    }
    
    .header-bar h1 {
        font-size: 18px;
    }
    
    .header-actions {
        gap: 8px;
    }
    
    .nav-link,
    .logout-btn {
        padding: 8px 12px;
        font-size: 13px;
        flex: 1;
        justify-content: center;
    }
    
    .nav-link svg,
    .logout-btn svg {
        display: none; /* 隐藏图标节省空间 */
    }
    
    /* 数据表格优化 */
    .data-table {
        font-size: 18px;
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table thead {
        position: static;
    }
    
    .data-table th,
    .data-table td {
        padding: 6px 4px;
        min-width: 80px;
        font-size: 18px;
    }
    
    /* 分页按钮优化 */
    .pagination {
        gap: 4px;
    }
    
    .page-btn {
        min-width: 40px;
        min-height: 40px;
        font-size: 13px;
        padding: 4px 8px;
    }
    
    /* 进度条优化 */
    .progress-header { 
        flex-direction: column; 
        gap: 4px; 
        text-align: center; 
    }
    
    /* 文件上传区域优化 */
    .file-drop-zone {
        padding: 16px;
        min-height: 100px;
    }
    
    .drop-zone-icon {
        font-size: 24px;
    }
    
    .drop-zone-text {
        font-size: 14px;
    }
    
    .drop-zone-hint {
        font-size: 12px;
    }
    
    /* 选择器优化 */
    .page-size-select {
        min-width: 100%;
    }
    
    /* 调试信息优化 */
    .debug-info {
        font-size: 12px;
        padding: 12px;
    }
    
    .debug-section strong {
        display: block;
        margin-bottom: 4px;
    }
}

/* 小屏手机 (最大 480px) */
@media (max-width: 480px) {
    .container {
        padding: 8px;
    }
    
    h1 {
        font-size: 16px;
    }
    
    .card {
        padding: 10px;
    }
    
    .header-bar h1 {
        font-size: 16px;
    }
    
    .nav-link,
    .logout-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
    
    .data-table th,
    .data-table td {
        padding: 4px 2px;
        min-width: 60px;
        font-size: 16px;
    }
    
    .page-btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 12px;
    }
}

/* 横屏优化 */
@media (max-height: 500px) and (orientation: landscape) {
    .header-bar {
        padding: 8px 0;
        margin-bottom: 16px;
    }
    
    .card {
        margin-bottom: 12px;
    }
    
    .file-drop-zone {
        min-height: 80px;
        padding: 12px;
    }
}

/* 打印样式 */
@media print {
    .header-actions,
    .nav-link,
    .logout-btn,
    button,
    .pagination {
        display: none !important;
    }
    
    .container {
        max-width: 100%;
        padding: 0;
    }
    
    .card {
        border: none;
        box-shadow: none;
    }
}
