/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', 'Microsoft YaHei', Arial, sans-serif;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    min-height: 100vh;
    padding: 20px;
    color: #2c3e50;
}

.container {
    max-width: 1800px;
    margin: 0 auto;
    animation: fadeIn 0.5s ease-out;
}

/* 动画效果 */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

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

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* 导航栏样式 */
.nav {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    background: white;
    padding: 15px;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.08);
}

.nav a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: #f8f9fa;
    border-radius: 8px;
    text-decoration: none;
    color: #495057;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e9ecef;
    font-weight: 500;
}

.nav a:hover {
    background: #3498db;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(52, 152, 219, 0.2);
    border-color: #3498db;
}

.nav a.active {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    border-color: #27ae60;
    box-shadow: 0 4px 12px rgba(46, 204, 113, 0.3);
}

/* 页头样式 */
.header {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    border-left: 6px solid #2ecc71;
}

h1 {
    color: #2c3e50;
    margin-bottom: 12px;
    font-size: 36px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 15px;
}

.subtitle {
    color: #7f8c8d;
    font-size: 17px;
    line-height: 1.6;
}

/* 配置表单样式 */
.config-form {
    background: white;
    border-radius: 16px;
    padding: 40px;
    margin-bottom: 30px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.form-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 2px solid #f1f2f6;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 22px;
    font-weight: 600;
}

.section-title i {
    color: #2ecc71;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 广告类型切换样式 */
.ad-type-switch {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #e0e6ed;
}

.ad-type-title {
    margin-bottom: 15px;
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.ad-type-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.ad-type-option {
    flex: 1;
    min-width: 180px;
    padding: 15px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: center;
}

.ad-type-option.selected {
    border-color: #2ecc71;
    background: #d4edda;
    color: #155724;
}

.ad-type-option:hover {
    border-color: #3498db;
    transform: translateY(-2px);
}

.ad-type-icon {
    font-size: 24px;
    margin-bottom: 8px;
}

/* 表单网格布局 */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    margin-bottom: 25px;
}

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

label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #34495e;
    font-size: 15px;
}

label.required::after {
    content: ' *';
    color: #e74c3c;
}

/* 输入框基础样式 */
input[type="text"],
input[type="number"],
select,
textarea {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid #e0e6ed;
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s;
    background: #f8fafc;
    color: #2c3e50;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 4px rgba(52, 152, 219, 0.15);
    background: white;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23333' viewBox='0 0 256 256'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    padding-right: 50px;
}

/* 批量输入区域样式 */
.batch-input-section {
    background: #f8fafc;
    border-radius: 12px;
    padding: 25px;
    margin-bottom: 30px;
    border: 2px dashed #bdc3c7;
}

.batch-input-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 25px;
    margin-bottom: 20px;
}

.textarea-container {
    position: relative;
}

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

.line-count {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

textarea {
    resize: vertical;
    min-height: 180px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 15px;
    line-height: 1.5;
}

.textarea-small {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
}

.textarea-small:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.example-text {
    font-size: 13px;
    color: #7f8c8d;
    margin-top: 8px;
    font-style: italic;
}

.clear-textarea {
    position: absolute;
    right: 12px;
    top: 12px;
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid #e0e6ed;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #7f8c8d;
    transition: all 0.3s;
    z-index: 2;
}

.clear-textarea:hover {
    background: #e74c3c;
    color: white;
    border-color: #e74c3c;
}

/* 批量操作按钮组 */
.batch-actions {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

/* 按钮通用样式 */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.2);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(52, 152, 219, 0.3);
}

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background: #7f8c8d;
    transform: translateY(-2px);
}

.btn-success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    color: white;
    box-shadow: 0 6px 15px rgba(46, 204, 113, 0.2);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(46, 204, 113, 0.3);
}

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

.btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
}

/* 匹配状态样式 */
.match-status {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: white;
    border-radius: 10px;
    border-left: 4px solid #3498db;
}

.match-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.match-value {
    font-weight: 700;
    font-size: 20px;
    color: #2ecc71;
}

.match-label {
    font-size: 14px;
    color: #7f8c8d;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
}

.status-matched {
    background: #d4edda;
    color: #155724;
}

.status-mismatch {
    background: #f8d7da;
    color: #721c24;
}

/* 表格样式 */
.table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    border: 1px solid #e9ecef;
    margin-top: 25px;
}

.table-wrapper {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.asin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1400px;
}

.asin-table thead {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    color: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.asin-table th {
    padding: 18px 15px;
    text-align: center;
    font-weight: 600;
    font-size: 15px;
    border-right: 1px solid rgba(255,255,255,0.1);
    white-space: nowrap;
}

.asin-table th:last-child {
    border-right: none;
}

.asin-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: all 0.3s;
}

.asin-table tbody tr:hover {
    background-color: #f8fafc;
}

.asin-table tbody tr:nth-child(even) {
    background-color: #fafbfc;
}

.asin-table tbody tr:nth-child(even):hover {
    background-color: #f1f5f9;
}

.asin-table td {
    padding: 16px 12px;
    text-align: center;
    border-right: 1px solid #e9ecef;
    vertical-align: top;
}

.asin-table td:last-child {
    border-right: none;
}

/* 表格操作按钮 */
.table-actions-header {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}

.action-btn {
    padding: 8px 16px;
    background: #3498db;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    background: #2980b9;
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: #95a5a6;
}

.action-btn.secondary:hover {
    background: #7f8c8d;
}

.action-btn.small {
    padding: 6px 12px;
    font-size: 12px;
}

/* 站点标识样式 */
.site-flag {
    display: inline-block;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-right: 8px;
    vertical-align: middle;
    font-size: 16px;
}

.site-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.site-name {
    font-weight: 600;
}

/* 输入框尺寸变体 */
.input-small {
    width: 100px;
    padding: 10px 12px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s;
}

.input-small:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

.input-medium {
    width: 180px;
    padding: 12px 15px;
    border: 2px solid #e0e6ed;
    border-radius: 8px;
    font-size: 14px;
    text-align: center;
    transition: all 0.3s;
}

.input-medium:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.15);
}

/* 表格操作按钮 */
.remove-btn {
    background: #e74c3c;
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    margin: 0 auto;
}

.remove-btn:hover {
    background: #c0392b;
    transform: scale(1.1);
}

.add-row-btn {
    width: 100%;
    padding: 16px;
    background: #f8fafc;
    border: 2px dashed #bdc3c7;
    border-radius: 10px;
    color: #7f8c8d;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
}

.add-row-btn:hover {
    background: #ecf0f1;
    border-color: #3498db;
    color: #3498db;
}

/* 表单操作按钮组 */
.form-actions {
    display: flex;
    gap: 15px;
    margin-top: 25px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* 提交区域样式 */
.submit-section {
    text-align: center;
    margin-top: 40px;
    padding-top: 40px;
    border-top: 2px solid #f1f2f6;
}

.loading {
    display: none;
    text-align: center;
    margin: 30px 0;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #2ecc71;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 15px;
}

/* 结果消息样式 */
.result-message {
    margin-top: 25px;
    padding: 25px;
    border-radius: 12px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.success-message {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 下载链接区域 */
.download-links {
    margin-top: 30px;
    padding: 25px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px dashed #bdc3c7;
}

.download-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    margin: 8px;
    background: white;
    border-radius: 10px;
    text-decoration: none;
    color: #3498db;
    border: 2px solid #e0e6ed;
    transition: all 0.3s;
    font-weight: 500;
}

.download-link:hover {
    background: #3498db;
    color: white;
    border-color: #3498db;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(52, 152, 219, 0.2);
}

/* 统计面板样式 */
.stats {
    display: flex;
    gap: 20px;
    margin-top: 25px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    flex-wrap: wrap;
}

.stat-item {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: #2ecc71;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: 500;
}

/* 提示文本样式 */
.hint {
    font-size: 13px;
    color: #e67e22;
    margin-top: 6px;
    display: block;
    font-style: italic;
}

.price-hint {
    font-size: 13px;
    color: #e67e22;
    margin-top: 6px;
    display: block;
    font-weight: 500;
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 60px 40px;
    color: #95a5a6;
}

.empty-state i {
    font-size: 64px;
    margin-bottom: 20px;
    color: #dfe6e9;
}

.empty-state h3 {
    margin-bottom: 10px;
    color: #7f8c8d;
}

/* 验证消息样式 */
.validation-message {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    display: none;
}

/* 通知组件样式 */
.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 20px 30px;
    border-radius: 12px;
    color: white;
    font-weight: 500;
    z-index: 1000;
    animation: slideIn 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    display: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    min-width: 300px;
}

.notification.success {
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border-left: 6px solid #27ae60;
}

.notification.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border-left: 6px solid #c0392b;
}

/* 响应式适配 */
@media (max-width: 1400px) {
    .container {
        padding: 15px;
    }
    
    .config-form {
        padding: 30px;
    }
}

@media (max-width: 768px) {
    .form-grid {
        grid-template-columns: 1fr;
    }
    
    .nav {
        flex-direction: column;
    }
    
    .nav a {
        width: 100%;
        justify-content: center;
    }
    
    .stats {
        flex-direction: column;
    }
    
    .batch-input-grid {
        grid-template-columns: 1fr;
    }
    
    .asin-table {
        min-width: 1000px;
    }
}

@media (max-width: 480px) {
    .ad-type-options {
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .batch-actions {
        flex-direction: column;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .download-link {
        display: block;
        width: 100%;
        margin: 8px 0;
    }
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    justify-content: center;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

.modal-content {
    background: white;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.2);
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideIn 0.3s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 30px;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    border-radius: 16px 16px 0 0;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.modal-close {
    background: none;
    border: none;
    font-size: 32px;
    color: white;
    cursor: pointer;
    line-height: 1;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.modal-body {
    padding: 30px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 30px;
    border-top: 2px solid #e9ecef;
    background: #f8f9fa;
    border-radius: 0 0 16px 16px;
}

.site-manage-hint {
    background: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 12px 16px;
    margin-bottom: 20px;
    border-radius: 8px;
    color: #1976d2;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.available-sites-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.site-item {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.3s;
}

.site-item:hover {
    border-color: #9b59b6;
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(155, 89, 182, 0.15);
}

.site-checkbox {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
}

.site-checkbox input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #9b59b6;
}

.site-label {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    font-size: 15px;
    font-weight: 500;
}

.site-label .site-flag {
    font-size: 24px;
}

.site-label .site-name {
    flex: 1;
    color: #2c3e50;
}

.site-label .site-currency {
    color: #7f8c8d;
    font-size: 14px;
}

.site-item:has(input[type="checkbox"]:checked) {
    background: #f3e5f5;
    border-color: #9b59b6;
}

@media (max-width: 768px) {
    .modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .available-sites-list {
        grid-template-columns: 1fr;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
}