/* ============ 条形码生成器 - 工具特有样式 ============ */
/* 通用样式（卡片、按钮、分隔线、info-box、empty-state、card-header-*、
   setting-item、setting-label、mode-* 等）已由 common.css 统一提供 */

/* ---- 容器 + 左右 1:2 布局（基于 common.css .section-row-1-2） ---- */
#barcode-container {
    margin-bottom: 15px;
}

/* 抵消 .settings-card 默认 margin-top（仅 :first-child 清零），避免右栏被下推 */
#barcode-container > .section-row-1-2 > div > .settings-card,
#barcode-container > .section-row-1-2 > div > .preview-card {
    margin-top: 0;
    margin-bottom: 0;
}

/* ---- 控件部件（common.css 未提供的统一配套样式，沿用 二维码生成 视觉） ---- */
.content-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.content-input:focus {
    border-color: #8b5cf6;
}

.content-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.content-textarea:focus {
    border-color: #8b5cf6;
}

/* ---- 滑块 ---- */
.range-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #e5e7eb;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.range-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
}

.range-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border: none;
    border-radius: 50%;
    background: #8b5cf6;
    cursor: pointer;
}

/* ---- 复选框 ---- */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    accent-color: #8b5cf6;
    width: 16px;
    height: 16px;
}

/* ---- 颜色选择 ---- */
.color-input {
    width: 100%;
    height: 38px;
    border: 2px solid #e5e7eb;
    border-radius: 6px;
    cursor: pointer;
    padding: 2px;
    background: #fff;
    box-sizing: border-box;
}

.color-input:focus {
    border-color: #8b5cf6;
}

/* ---- 预览区 ---- */
.preview-area {
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.preview-content {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.barcode-canvas-wrap {
    display: flex;
    justify-content: center;
    padding: 30px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    overflow-x: auto;
}

.barcode-canvas-wrap svg {
    max-width: 100%;
}

/* 单个预览下方回显条码内容 */
.barcode-content-echo {
    text-align: center;
    font-family: monospace;
    font-size: 14px;
    color: #6b7280;
    word-break: break-all;
    padding: 0 10px;
}

/* ---- 批量网格 ---- */
.batch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

.batch-item {
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    background: #f9fafb;
    text-align: center;
}

.batch-item-header {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.batch-item-canvas {
    display: flex;
    justify-content: center;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
    overflow-x: auto;
}

.batch-item-canvas svg {
    max-width: 100%;
}

.batch-item-value {
    font-size: 12px;
    color: #6b7280;
    margin-top: 8px;
    word-break: break-all;
}

/* 生成失败的批量条目：置灰 + 角标 */
.batch-item.invalid {
    background: #fef2f2;
    border-color: #fecaca;
    opacity: 0.85;
}

.batch-item.invalid .batch-item-canvas {
    background: #fef2f2;
}

.batch-invalid-badge {
    display: inline-block;
    margin-bottom: 8px;
    padding: 3px 10px;
    background: #fee2e2;
    color: #dc2626;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.mini-action {
    margin-top: 8px;
    padding: 5px 12px;
    background: #f5f3ff;
    color: #6d28d9;
    border: 1px solid #e9d5ff;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mini-action:hover {
    background: #ede9fe;
    border-color: #8b5cf6;
}

/* ---- 样式设置四列网格（每行 4 项，共 2 行） ---- */
.style-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px 20px;
}

.style-grid .setting-item {
    margin-bottom: 0;
}

/* ---- 小提示 ---- */
.hint-small {
    font-size: 12px;
    color: #9ca3af;
    line-height: 1.6;
}

/* ---- 响应式 ---- */
@media (max-width: 1100px) {
    .style-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    #barcode-container > .section-row-1-2 {
        grid-template-columns: 1fr;
    }

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