/* ===========================
   Ozon定价工具 - 样式表
   =========================== */

/* Reset & Base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
        "Microsoft YaHei", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
    background-color: #F5F5F5;
    color: #333333;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

input, select, button {
    font-family: inherit;
    font-size: inherit;
}

/* ===========================
   公告横幅
   =========================== */
.announcement-bar {
    background-color: #E53935;
    color: #FFFFFF;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    transition: transform 0.3s ease;
}

.announcement-bar.hidden {
    transform: translateY(-100%);
}

.announcement-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 8px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.announcement-content span {
    font-size: 13px;
    text-align: center;
}

.announcement-close {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.8;
    line-height: 1;
    padding: 0 4px;
}

.announcement-close:hover {
    opacity: 1;
}

/* ===========================
   顶部导航栏
   =========================== */
.top-header {
    background-color: #FFFFFF;
    border-bottom: 1px solid #E0E0E0;
    position: fixed;
    top: 36px;
    left: 0;
    right: 0;
    z-index: 999;
    height: 56px;
    transition: top 0.3s ease;
}

.top-header.expanded {
    top: 0;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
}

.logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #2196F3;
}

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

.search-box {
    display: flex;
    align-items: center;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    overflow: hidden;
    transition: border-color 0.2s;
}

.search-box:focus-within {
    border-color: #2196F3;
}

.search-box input {
    border: none;
    outline: none;
    padding: 6px 14px;
    width: 200px;
    font-size: 13px;
    background: transparent;
}

.search-box input::placeholder {
    color: #999;
}

.search-btn {
    background: #2196F3;
    color: #FFF;
    border: none;
    padding: 6px 16px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.search-btn:hover {
    background: #1976D2;
}

.search-results-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 10000;
    margin-top: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.search-results-header {
    padding: 10px 14px;
    font-size: 12px;
    color: #999;
    border-bottom: 1px solid #f0f0f0;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    text-decoration: none;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: #f8f9ff;
}

.search-result-item .result-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.search-result-item .result-info {
    flex: 1;
    min-width: 0;
}

.search-result-item .result-title {
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.search-result-item .result-title strong {
    color: #667eea;
    background: #f0f4ff;
}

.search-result-item .result-category {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.search-results-footer {
    padding: 10px 14px;
    font-size: 12px;
    color: #999;
    text-align: center;
    border-top: 1px solid #f0f0f0;
}

.login-btn {
    background: #FFFFFF;
    color: #2196F3;
    border: 1px solid #2196F3;
    padding: 6px 18px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}

.login-btn:hover {
    background: #2196F3;
    color: #FFFFFF;
}

/* ===========================
   主布局
   =========================== */
.main-wrapper {
    display: flex;
    margin-top: 92px; /* announcement-bar(36px) + top-header(56px) */
    min-height: calc(100vh - 92px);
}

.main-wrapper.no-announcement {
    margin-top: 56px;
}

/* ===========================
   左侧导航栏
   =========================== */
.sidebar {
    width: 200px;
    min-width: 200px;
    background-color: #FFFFFF;
    border-right: 1px solid #E0E0E0;
    position: fixed;
    top: 92px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 998;
    transition: transform 0.3s ease, top 0.3s ease;
}

.sidebar.no-announcement {
    top: 56px;
}

.sidebar-toggle {
    display: none;
    padding: 12px;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background-color: #666;
    transition: all 0.3s;
}

.sidebar-nav {
    padding: 8px 0;
}

.nav-list {
    display: flex;
    flex-direction: column;
}

.nav-item {
    position: relative;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 9px 16px;
    color: #333333;
    font-size: 13px;
    transition: all 0.15s;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-link:hover {
    background-color: #F5F5F5;
    color: #2196F3;
}

.nav-item.active .nav-link {
    background-color: #E3F2FD;
    color: #2196F3;
    font-weight: 600;
    border-right: 3px solid #2196F3;
}

.nav-icon {
    margin-right: 8px;
    font-size: 14px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.nav-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
}

.submenu-arrow {
    font-size: 10px;
    color: #999;
    margin-left: 4px;
}

/* ===========================
   主内容区
   =========================== */
.main-content {
    flex: 1;
    margin-left: 200px;
    padding: 24px;
    max-width: 1200px;
}

.content-header {
    margin-bottom: 20px;
}

.content-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 4px;
}

.content-desc {
    font-size: 13px;
    color: #666666;
}

/* ===========================
   表单卡片
   =========================== */
.form-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.form-section {
    margin-bottom: 18px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

/* 类目模式切换 */
.category-mode-toggle {
    display: inline-block;
    margin-left: 12px;
    font-size: 12px;
    font-weight: 400;
    cursor: pointer;
    user-select: none;
    background: #f0f0f0;
    border-radius: 12px;
    padding: 2px 8px;
    vertical-align: middle;
}
.category-mode-toggle .mode-label {
    transition: color 0.2s;
}
.category-mode-toggle .mode-label:hover {
    color: #3b82f6;
}
.category-mode-toggle .mode-separator {
    margin: 0 4px;
    color: #ccc;
}

.required {
    color: #E53935;
}

/* 尺寸输入组 */
.dimension-group {
    display: flex;
    gap: 12px;
}

.dimension-group .input-wrapper {
    flex: 1;
}

/* 物流商选择 */
.logistics-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.radio-card {
    position: relative;
    cursor: pointer;
}

.radio-card input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.radio-label {
    display: inline-block;
    padding: 6px 18px;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    font-size: 13px;
    color: #333333;
    background-color: #FFFFFF;
    transition: all 0.2s;
    cursor: pointer;
}

.radio-card input[type="radio"]:checked + .radio-label {
    background-color: #2196F3;
    color: #FFFFFF;
    border-color: #2196F3;
}

.radio-card:hover .radio-label {
    border-color: #2196F3;
}

.radio-card input[type="radio"]:checked + .radio-label:hover {
    background-color: #1976D2;
}

/* 下拉选择 */
.select-wrapper {
    position: relative;
}

.form-select {
    width: 100%;
    max-width: 320px;
    padding: 8px 36px 8px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    color: #333333;
    background-color: #FFFFFF;
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23999' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.2s;
}

.form-select:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

/* 分段控制 */
.segment-group {
    display: inline-flex;
    border: 1px solid #E0E0E0;
    border-radius: 20px;
    overflow: hidden;
}

.segment-btn {
    padding: 6px 20px;
    border: none;
    background-color: #FFFFFF;
    color: #666666;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    border-right: 1px solid #E0E0E0;
}

.segment-btn:last-child {
    border-right: none;
}

.segment-btn:hover {
    background-color: #F5F5F5;
}

.segment-btn.active {
    background-color: #2196F3;
    color: #FFFFFF;
}

/* 输入框 */
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    max-width: 400px;
}

.form-input {
    width: 100%;
    padding: 8px 50px 8px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    color: #333333;
    background-color: #FFFFFF;
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

.form-input::placeholder {
    color: #AAAAAA;
    font-size: 12px;
}

.input-suffix {
    position: absolute;
    right: 12px;
    color: #999999;
    font-size: 13px;
    pointer-events: none;
}

.readonly-wrapper .form-input {
    background-color: #F5F5F5;
    color: #666666;
    cursor: not-allowed;
}

/* 操作按钮 */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid #E0E0E0;
}

.btn {
    padding: 10px 32px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #2196F3;
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: #1976D2;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.3);
}

.btn-primary:active {
    background-color: #1565C0;
}

.btn-secondary {
    background-color: #FFFFFF;
    color: #666666;
    border: 1px solid #E0E0E0;
}

.btn-secondary:hover {
    background-color: #F5F5F5;
    color: #333333;
}

/* ===========================
   结果卡片
   =========================== */
.result-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.result-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid #2196F3;
}

.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.result-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    min-width: 900px;
}

.result-table thead tr {
    background-color: #F5F5F5;
}

.result-table th {
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: #333333;
    border: 1px solid #E0E0E0;
    white-space: nowrap;
}

.result-table th.rowspan-header {
    text-align: left;
    padding-left: 12px;
}

.th-express {
    background-color: #E3F2FD !important;
    color: #1565C0 !important;
}

.th-standard {
    background-color: #E8F5E9 !important;
    color: #2E7D32 !important;
}

.th-economy {
    background-color: #FFF3E0 !important;
    color: #E65100 !important;
}

.main-header th {
    border-bottom: none;
}

.sub-header th {
    border-top: none;
    font-size: 11px;
    font-weight: 500;
}

.result-table td {
    padding: 10px 8px;
    text-align: center;
    border: 1px solid #E0E0E0;
    color: #333333;
}

.result-table tbody tr:hover {
    background-color: #FAFAFA;
}

.result-table tbody tr td:first-child {
    text-align: left;
    padding-left: 12px;
    font-weight: 500;
}

/* 利润颜色 */
.profit-positive {
    color: #4CAF50;
    font-weight: 600;
}

.profit-negative {
    color: #E53935;
    font-weight: 600;
}

.profit-zero {
    color: #999999;
}

/* ===========================
   响应式设计
   =========================== */
@media screen and (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
        box-shadow: 2px 0 12px rgba(0, 0, 0, 0.15);
    }

    .sidebar-toggle {
        display: flex;
    }

    .main-content {
        margin-left: 0;
    }

    .search-box input {
        width: 140px;
    }
}

@media screen and (max-width: 768px) {
    html {
        font-size: 13px;
    }

    .announcement-content span {
        font-size: 12px;
    }

    .header-inner {
        padding: 0 12px;
    }

    .search-box {
        display: none;
    }

    .main-content {
        padding: 16px;
    }

    .content-header h1 {
        font-size: 18px;
    }

    .form-card {
        padding: 16px;
    }

    .dimension-group {
        flex-direction: column;
        gap: 10px;
    }

    .dimension-group .input-wrapper {
        max-width: 100%;
    }

    .input-wrapper {
        max-width: 100%;
    }

    .form-select {
        max-width: 100%;
    }

    .logistics-group {
        gap: 8px;
    }

    .radio-label {
        padding: 5px 14px;
        font-size: 12px;
    }

    .segment-btn {
        padding: 5px 14px;
        font-size: 12px;
    }

    .form-actions {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        text-align: center;
    }

    .result-card {
        padding: 12px;
    }
}

/* ==================== 批量计算 ==================== */
.batch-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.batch-toolbar h2 {
    margin: 0;
    font-size: 16px;
    color: var(--text-primary, #1a1a2e);
}
.batch-actions {
    display: flex;
    gap: 8px;
}
.batch-actions button {
    padding: 6px 14px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary, #1a1a2e);
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s;
}
.batch-actions button:hover {
    background: var(--primary-color, #3b82f6);
    color: #fff;
    border-color: var(--primary-color, #3b82f6);
}
.batch-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
}
.batch-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.batch-table th {
    background: var(--bg-secondary, #f8fafc);
    padding: 10px 8px;
    text-align: center;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    border-bottom: 2px solid var(--border-color, #e0e0e0);
    white-space: nowrap;
}
.batch-table td {
    padding: 6px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}
.batch-table input {
    width: 100%;
    min-width: 60px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    background: transparent;
    transition: all 0.2s;
}
.batch-table input:focus {
    border-color: var(--primary-color, #3b82f6);
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.1);
}
.batch-table input.sku-name {
    min-width: 120px;
    text-align: left;
}
.batch-table .btn-remove {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    background: #fee2e2;
    color: #dc2626;
    cursor: pointer;
    font-size: 12px;
}
.batch-table .btn-remove:hover {
    background: #dc2626;
    color: #fff;
}
.batch-table tr:hover {
    background: rgba(59,130,246,0.03);
}

/* Tab 切换 */
.batch-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
    margin-bottom: 16px;
}
.tab-btn {
    padding: 10px 24px;
    border: none;
    background: transparent;
    color: var(--text-secondary, #64748b);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}
.tab-btn.active {
    color: var(--primary-color, #3b82f6);
    border-bottom-color: var(--primary-color, #3b82f6);
}
.tab-btn:hover {
    color: var(--primary-color, #3b82f6);
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* 排行筛选 */
.ranking-filter {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.ranking-filter label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary, #64748b);
}
.ranking-filter select {
    padding: 6px 12px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    font-size: 13px;
    min-width: 150px;
}

/* 汇总统计 */
.batch-summary {
    margin-top: 16px;
    padding: 12px 16px;
    background: var(--bg-secondary, #f8fafc);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text-secondary, #64748b);
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
}
.batch-summary .stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.batch-summary .stat-value {
    font-weight: 700;
    color: var(--text-primary, #1a1a2e);
}

/* 利润颜色 */
.profit-positive { color: #16a34a; font-weight: 600; }
.profit-negative { color: #dc2626; font-weight: 600; }
.profit-zero { color: #64748b; }

/* 排名高亮 */
.rank-first { background: #fef9c3 !important; }
.rank-top3 { background: #f0fdf4 !important; }
.rank-terminated { opacity: 0.5; }

/* 导出按钮 */
#exportCsvBtn {
    padding: 6px 14px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary, #1a1a2e);
    cursor: pointer;
    font-size: 13px;
    margin-left: auto;
}
#exportCsvBtn:hover {
    background: #16a34a;
    color: #fff;
    border-color: #16a34a;
}

@media screen and (max-width: 480px) {
    .main-wrapper {
        margin-top: 82px;
    }

    .top-header {
        top: 32px;
        height: 50px;
    }

    .sidebar {
        top: 82px;
    }

    .logo-text {
        font-size: 16px;
    }

    .login-btn {
        padding: 5px 12px;
        font-size: 12px;
    }
}

/* ===========================
   滚动条美化
   =========================== */
.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: #DDD;
    border-radius: 2px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background-color: #BBB;
}

.table-wrapper::-webkit-scrollbar {
    height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
    background: #F5F5F5;
}

.table-wrapper::-webkit-scrollbar-thumb {
    background-color: #DDD;
    border-radius: 3px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
    background-color: #BBB;
}

/* ===========================
   遮罩层（移动端侧边栏打开时）
   =========================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 997;
}

.sidebar-overlay.active {
    display: block;
}

/* ===========================
   提示消息
   =========================== */
.toast {
    position: fixed;
    top: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background-color: #333333;
    color: #FFFFFF;
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 13px;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.error {
    background-color: #E53935;
}

.toast.success {
    background-color: #4CAF50;
}

.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    background: #667eea;
    color: #fff;
    border: none;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(102,126,234,0.4);
    z-index: 9998;
    transition: all 0.3s;
}

.back-to-top:hover {
    background: #5a6fd6;
    transform: translateY(-2px);
}

.back-to-top.show {
    display: flex;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1a2e;
        --bg-secondary: #16213e;
        --bg-card: #1f2940;
        --text-primary: #e0e0e0;
        --text-secondary: #a0a0b0;
        --border-color: #2a3a5c;
    }
}

body.dark-mode {
    background-color: #1a1a2e;
    color: #e0e0e0;
}

body.dark-mode .top-header {
    background: #16213e;
    border-bottom-color: #2a3a5c;
}

body.dark-mode .sidebar {
    background: #16213e;
    border-right-color: #2a3a5c;
}

body.dark-mode .nav-link {
    color: #a0a0b0;
}

body.dark-mode .nav-link:hover,
body.dark-mode .nav-item.active .nav-link {
    color: #667eea;
    background: rgba(102,126,234,0.1);
}

body.dark-mode .main-content {
    background: #1a1a2e;
}

body.dark-mode .form-card,
body.dark-mode .result-card {
    background: #1f2940;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

body.dark-mode .form-input,
body.dark-mode .form-select,
body.dark-mode .form-textarea {
    background: #16213e;
    border-color: #2a3a5c;
    color: #e0e0e0;
}

body.dark-mode .result-table th {
    background: #16213e;
    color: #a0a0b0;
}

body.dark-mode .result-table td {
    border-bottom-color: #2a3a5c;
    color: #e0e0e0;
}

body.dark-mode .result-table tr:hover td {
    background: rgba(102,126,234,0.05);
}

body.dark-mode h1, body.dark-mode h2, body.dark-mode h3 {
    color: #e0e0e0;
}

body.dark-mode .content-desc {
    color: #a0a0b0;
}

body.dark-mode .form-label {
    color: #a0a0b0;
}

.dark-mode-toggle {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.2s;
}

.dark-mode-toggle:hover {
    background: rgba(102,126,234,0.1);
}

/* ===========================
   AI工具页面 - 蓝色渐变Banner
   =========================== */
.ai-banner {
    background: linear-gradient(135deg, #2196F3, #1976D2, #1565C0);
    color: #FFFFFF;
    border-radius: 8px;
    padding: 24px 28px;
    margin-bottom: 24px;
    text-align: center;
}

.ai-banner h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 6px;
}

.ai-banner p {
    font-size: 13px;
    opacity: 0.9;
}

/* ===========================
   AI工具页面 - 信息Banner
   =========================== */
.info-banner {
    background-color: #E3F2FD;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
    padding: 14px 18px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.info-banner .info-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.info-banner .info-text {
    font-size: 13px;
    color: #1565C0;
    line-height: 1.6;
}

/* ===========================
   动态添加输入框行
   =========================== */
.input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.input-row .input-wrapper {
    flex: 1;
    max-width: 400px;
}

.btn-add {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #4CAF50;
    color: #fff;
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}

.btn-add:hover {
    background: #388E3C;
}

.btn-remove {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #E53935;
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
    line-height: 1;
}

.btn-remove:hover {
    background: #C62828;
}

/* ===========================
   Textarea
   =========================== */
.form-textarea {
    width: 100%;
    max-width: 600px;
    min-height: 100px;
    padding: 10px 12px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    color: #333333;
    background-color: #FFFFFF;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

.form-textarea:focus {
    outline: none;
    border-color: #2196F3;
    box-shadow: 0 0 0 2px rgba(33, 150, 243, 0.15);
}

.form-textarea::placeholder {
    color: #AAAAAA;
    font-size: 12px;
}

/* ===========================
   红色清空按钮
   =========================== */
.btn-danger {
    background-color: #E53935;
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #C62828;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3);
}

/* ===========================
   结果展示区域
   =========================== */
.result-text-area {
    width: 100%;
    min-height: 200px;
    padding: 16px;
    border: 1px solid #E0E0E0;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.8;
    color: #333333;
    background-color: #FAFAFA;
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
}

.result-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.btn-copy {
    padding: 6px 20px;
    border: 1px solid #2196F3;
    border-radius: 6px;
    background-color: #FFFFFF;
    color: #2196F3;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background-color: #2196F3;
    color: #FFFFFF;
}

/* ===========================
   指南页面 - 步骤卡片
   =========================== */
.guide-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 20px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: box-shadow 0.2s;
}

.step-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.step-number {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    flex-shrink: 0;
}

.step-content {
    flex: 1;
}

.step-content h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

.step-content p {
    font-size: 13px;
    color: #666666;
    line-height: 1.8;
}

/* ===========================
   资源/素材卡片网格
   =========================== */
.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.resource-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: box-shadow 0.2s, transform 0.2s;
}

.resource-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.resource-card .card-icon {
    font-size: 28px;
    margin-bottom: 12px;
}

.resource-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

.resource-card p {
    font-size: 13px;
    color: #666666;
    line-height: 1.6;
    margin-bottom: 12px;
}

.resource-card .card-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    background-color: #E3F2FD;
    color: #1976D2;
    margin-right: 6px;
    margin-bottom: 4px;
}

.resource-card .card-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 16px;
    background-color: #2196F3;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color 0.2s;
}
.resource-card .card-link:hover {
    background-color: #1976D2;
}

.tool-card .tool-link {
    display: inline-block;
    padding: 6px 16px;
    background-color: #2196F3;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
}
.tool-card .tool-link:hover {
    background-color: #1976D2;
}

/* ===========================
   插件/工具卡片列表
   =========================== */
.tool-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tool-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 18px 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.2s;
}

.tool-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.tool-card .tool-icon {
    font-size: 32px;
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 8px;
    background-color: #F5F5F5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.tool-card .tool-info {
    flex: 1;
}

.tool-card .tool-info h3 {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 4px;
}

.tool-card .tool-info p {
    font-size: 13px;
    color: #666666;
    line-height: 1.5;
}

.tool-card .tool-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    background-color: #E8F5E9;
    color: #2E7D32;
    flex-shrink: 0;
}

/* ===========================
   仓库推荐结果卡片
   =========================== */
.warehouse-result {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.warehouse-card {
    background-color: #FFFFFF;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    border-left: 4px solid #4CAF50;
}

.warehouse-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: #333333;
    margin-bottom: 8px;
}

.warehouse-card .warehouse-info {
    font-size: 13px;
    color: #666666;
    line-height: 1.8;
}

.warehouse-card .warehouse-info span {
    display: block;
}

.warehouse-card .warehouse-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    background-color: #E8F5E9;
    color: #2E7D32;
    margin-top: 10px;
}

/* ===========================
   条件显示区域
   =========================== */
.conditional-section {
    display: none;
}

.conditional-section.show {
    display: block;
}

/* ===========================
   响应式补充
   =========================== */
@media screen and (max-width: 768px) {
    .ai-banner {
        padding: 18px 16px;
    }

    .ai-banner h2 {
        font-size: 17px;
    }

    .step-card {
        flex-direction: column;
        gap: 12px;
    }

    .resource-grid {
        grid-template-columns: 1fr;
    }

    .tool-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .warehouse-result {
        grid-template-columns: 1fr;
    }

    .form-textarea {
        max-width: 100%;
    }
}

/* ===========================
   佣金表底部提示
   =========================== */
.commission-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid #E0E0E0;
    text-align: center;
}

.commission-footer p {
    font-size: 12px;
    color: #999999;
}

/* ===========================
   匹配行高亮
   =========================== */
.matched-tier {
    background-color: #E8F5E9 !important;
}

/* ===========================
   实际佣金率显示
   =========================== */
.actual-commission {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 14px;
    color: #0369a1;
    line-height: 1.6;
}

.actual-commission .rate-value {
    font-size: 20px;
    font-weight: 700;
    color: #0c4a6e;
}

/* ===========================
   结果表格优化
   =========================== */
.result-table {
    table-layout: fixed;
    width: 100%;
    max-width: 100%;
}

.result-table th {
    white-space: nowrap;
    font-size: 12px;
    padding: 6px 4px;
}

.result-table td {
    white-space: normal;
    word-break: break-word;
    word-wrap: break-word;
    overflow-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    padding: 6px 4px;
    vertical-align: top;
}

/* 物流方式名称列 - 保持不换行 */
.result-table td:first-child,
.result-table th:first-child {
    white-space: nowrap;
    overflow: visible;
}

/* 重量和金额列 */
.result-table td:nth-child(2),
.result-table td:nth-child(3) {
    white-space: nowrap;
    max-width: 80px;
}

/* 运费/利润列 - 紧凑显示 */
.result-table td:nth-child(n+4) {
    max-width: 70px;
    text-align: center;
}

/* 摘要行 */
.summary-row td {
    white-space: normal !important;
    max-width: none !important;
    overflow: visible !important;
    word-break: break-word;
}

/* 结果卡片可横向滚动 */
.result-card {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* ===========================
   移动端优化 - 新增
   =========================== */
@media screen and (max-width: 768px) {
    /* 顶部栏优化 */
    .top-header {
        height: auto;
        min-height: 60px;
        padding: 8px 0;
    }

    .header-inner {
        flex-wrap: wrap;
        gap: 8px;
        padding: 0 12px;
    }

    .logo-text {
        font-size: 16px;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
        justify-content: flex-end;
    }

    .search-box {
        order: 3;
        width: 100%;
        margin-top: 8px;
    }

    .search-box input {
        flex: 1;
        min-width: 0;
    }

    /* 侧边栏优化 */
    .sidebar {
        width: 260px;
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    /* 主内容区优化 */
    .main-content {
        padding: 16px 12px;
        margin-left: 0 !important;
    }

    .content-header h1 {
        font-size: 20px;
    }

    .content-desc {
        font-size: 13px;
    }

    /* 表单卡片优化 */
    .form-card {
        padding: 16px;
    }

    .form-section {
        margin-bottom: 16px;
    }

    .form-label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 12px;
        font-size: 16px; /* 防止iOS缩放 */
    }

    /* 按钮优化 */
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }

    .form-actions .btn {
        width: 100%;
        padding: 12px 20px;
        font-size: 15px;
    }

    /* 物流选择卡片优化 */
    .logistics-group {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .radio-card {
        padding: 12px 8px;
    }

    .radio-label {
        font-size: 12px;
    }

    /* 结果表格优化 */
    .result-table {
        font-size: 11px;
    }

    .result-table th,
    .result-table td {
        padding: 8px 4px;
    }

    /* 返回顶部按钮优化 */
    .back-to-top {
        width: 40px;
        height: 40px;
        font-size: 16px;
        bottom: 16px;
        right: 16px;
    }

    /* Toast优化 */
    .toast {
        left: 16px;
        right: 16px;
        transform: translateY(-20px);
        text-align: center;
    }

    .toast.show {
        transform: translateY(0);
    }

    /* 暗色模式切换按钮 */
    .dark-mode-toggle {
        font-size: 16px;
        padding: 6px;
    }
}

@media screen and (max-width: 480px) {
    /* 更小屏幕的额外优化 */
    .content-header h1 {
        font-size: 18px;
    }

    .form-card {
        padding: 12px;
        border-radius: 12px;
    }

    .logistics-group {
        grid-template-columns: 1fr;
    }

    .result-table th,
    .result-table td {
        padding: 6px 3px;
        font-size: 10px;
    }

    /* 隐藏部分列以节省空间 */
    .result-table th:nth-child(5),
    .result-table td:nth-child(5) {
        display: none;
    }
}
