/* ==================== 广告共享工具栏与弹窗 ==================== */

/* 工具栏 */
.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
    padding: 0 0 20px 0;
}

.toolbar--ads {
    position: relative;
    z-index: 2;
    width: 100%;
}

.toolbar-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.toolbar-actions--primary {
    flex: 0 1 auto;
    flex-wrap: nowrap;
    gap: 10px;
}

.toolbar-command-deck {
    margin-left: auto;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    min-height: 68px;
    padding: 10px 14px;
    border-radius: 22px;
    border: 1px solid rgba(210, 185, 145, 0.4);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(250, 247, 241, 0.94));
    box-shadow:
        0 16px 32px rgba(39, 32, 20, 0.06),
        inset 0 1px 0 rgba(255, 255, 255, 0.82);
}

.toolbar-inline-group {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 7px;
    padding: 2px 12px;
    min-height: 44px;
}

.toolbar-inline-group--group {
    min-width: 430px;
}

.toolbar-inline-group--defaults {
    min-width: 430px;
}

.toolbar-inline-group--mode {
    min-width: 220px;
}

.toolbar-inline-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #7d8696;
}

.toolbar-inline-fields {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.toolbar-group-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) 156px auto;
    grid-template-rows: auto auto;
    align-items: end;
    column-gap: 8px;
    row-gap: 6px;
}

.toolbar-group-grid-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: #7d8696;
    line-height: 1;
}

.toolbar-group-grid-label--select {
    grid-column: 1;
    grid-row: 1;
}

.toolbar-group-grid-label--count {
    grid-column: 2;
    grid-row: 1;
    text-align: center;
}

.toolbar-group-grid-spacer {
    grid-column: 3;
    grid-row: 1;
}

.toolbar-field-tag {
    display: inline-flex;
    align-items: center;
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    background: rgba(240, 244, 248, 0.95);
    border: 1px solid rgba(210, 218, 228, 0.9);
    font-size: 12px;
    font-weight: 600;
    color: #687385;
    white-space: nowrap;
}

.toolbar-command-divider {
    width: 1px;
    align-self: stretch;
    background: linear-gradient(180deg, rgba(218, 224, 233, 0), rgba(218, 224, 233, 0.95), rgba(218, 224, 233, 0));
}

.toolbar-range-separator {
    color: #64748b;
    font-size: 12px;
    font-weight: 700;
}

.toolbar-number-input,
.toolbar-count-input,
.toolbar-select-input {
    background: rgba(255, 255, 255, 0.96);
}

.toolbar-number-input {
    width: 72px;
}

.toolbar-count-input {
    width: 74px;
    text-align: center;
}

.toolbar-range-inputs {
    display: flex;
    align-items: center;
    gap: 6px;
}

.toolbar-range-inputs .toolbar-count-input {
    width: 74px;
    min-width: 0;
}

.toolbar-select-input {
    min-width: 250px;
    flex: 1 1 250px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--font-display);
    cursor: pointer;
    transition: transform var(--duration-fast) var(--ease-bounce),
                box-shadow var(--duration-fast) var(--ease-out),
                background-color var(--duration-fast) var(--ease-out);
}

.btn-primary {
    background: var(--gradient-primary);
    color: var(--color-text-inverse);
    box-shadow: 0 2px 8px rgba(255, 140, 0, 0.25);
}

.btn-primary:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-glow);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

.btn-secondary {
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: var(--color-surface-hover);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.search-box {
    margin-left: auto;
}

.search-box input {
    padding: 10px 20px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    font-size: 14px;
    width: 300px;
    background: var(--color-surface);
    color: var(--color-text-primary);
    transition: border-color var(--duration-fast) var(--ease-out),
                box-shadow var(--duration-fast) var(--ease-out);
}

.search-box input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.15);
}

/* 关键词弹窗样式 */
.keyword-modal {
    width: 1400px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
}

.keyword-modal h3,
.keyword-modal .modal-desc {
    text-align: center;
}

.keyword-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
}

.keyword-toolbar-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.keyword-toolbar label {
    font-size: 13px;
    color: #495057;
    display: flex;
    align-items: center;
    gap: 6px;
}

.small-input {
    width: 80px;
    padding: 6px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
}

.keyword-list {
    max-height: 500px;
    overflow-y: auto;
    margin-bottom: 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
}

.keyword-list-header {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 40px;
    gap: 8px;
    margin-bottom: 12px;
    padding: 10px 0;
    background: linear-gradient(135deg, #ff9f40 0%, #ffc107 100%);
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    color: white;
    text-align: center;
}

.keyword-list-header > div {
    padding: 0 12px;
}

.keyword-list-header > div:first-child {
    text-align: left;
}

.keyword-list-header.waterfall-header > div:first-child {
    text-align: center;
}

.keyword-list-header.waterfall-header.keyword-waterfall-header {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr auto;
}

.keyword-list-header.waterfall-header.product-waterfall-header {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
}

.keyword-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr 40px;
    gap: 8px;
    margin-bottom: 12px;
    align-items: center;
    padding: 0;
}

.keyword-row.keyword-row-waterfall {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr 1fr 1fr auto;
}

.keyword-row.product-row.product-row-waterfall {
    grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto;
}

.keyword-input {
    padding: 10px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.keyword-input:focus {
    outline: none;
    border-color: #ff9f40;
    box-shadow: 0 0 0 2px rgba(255, 159, 64, 0.1);
}

.keyword-input.kw-name {
    font-weight: 500;
}

.keyword-row-waterfall .keyword-input {
    padding: 6px 8px;
    font-size: 12px;
}

.keyword-row-waterfall .kw-name {
    font-size: 13px;
}

.keyword-row-waterfall .keyword-input:not(.kw-name) {
    max-width: 96px;
    justify-self: center;
}

.product-row-waterfall .keyword-input {
    padding: 6px 8px;
    font-size: 12px;
}

.product-row-waterfall .prod-id {
    font-size: 13px;
}

.product-row-waterfall .keyword-input:not(.prod-id) {
    max-width: 96px;
    justify-self: center;
}

.btn-remove-keyword {
    width: 32px;
    height: 32px;
    border: none;
    background: #fff3e0;
    color: #ff9f40;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove-keyword:hover {
    background: #ff9f40;
    color: white;
}

.keyword-cell {
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-cell:hover {
    background: #f8f9fa;
}

.keyword-placeholder {
    padding: 8px;
    display: block;
    color: var(--color-text-muted, #999);
    cursor: pointer;
}

.editable-count-link {
    color: var(--color-primary, #ff9f40);
    cursor: pointer;
    font-weight: 500;
}

.editable-count-link-warning {
    color: #f57c00;
}

.sku-count-hint {
    color: var(--color-primary, #ff9f40);
}

/* 手动广告表格特殊样式 */
#manualDataTable .keyword-cell {
    font-weight: 500;
    text-align: center;
}

/* 商品&类目行样式 */
.product-row .prod-id {
    font-family: Consolas, Monaco, 'Courier New', monospace;
    font-weight: 600;
}

.product-row .prod-expanded:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

/* ASIN单元格样式 */
.asin-cell {
    cursor: pointer;
    text-align: center;
    padding: 12px;
}

.asin-cell:hover {
    background: #f8f9fa;
}

/* 模式切换开关样式 */
.mode-switch-container {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 42px;
    padding: 0;
    background: transparent;
    border-radius: 0;
    border: none;
    box-shadow: none;
}

.mode-switch-container--toolbar {
    gap: 10px;
}

.mode-label {
    font-size: 12px;
    font-weight: 600;
    color: #526072;
}

.mode-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.mode-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.mode-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ff9f40;
    transition: 0.3s;
    border-radius: 24px;
}

.mode-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.mode-switch input:checked + .mode-slider {
    background-color: #ff9f40;
}

.mode-switch input:checked + .mode-slider:before {
    transform: translateX(26px);
}

.mode-switch input:focus + .mode-slider {
    box-shadow: 0 0 0 3px rgba(255, 159, 64, 0.2);
}

@media (max-width: 1280px) {
    .toolbar-actions--primary {
        flex-wrap: wrap;
    }

    .toolbar-command-deck {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 960px) {
    .toolbar-command-deck {
        padding: 12px;
        border-radius: 18px;
    }

    .toolbar-command-divider {
        display: none;
    }

    .toolbar-inline-group,
    .toolbar-inline-group--defaults,
    .toolbar-inline-group--group,
    .toolbar-inline-group--mode {
        width: 100%;
        min-width: 0;
        padding: 4px 0;
    }

    .toolbar-select-input {
        min-width: 0;
        width: 100%;
    }

    .toolbar-group-grid {
        grid-template-columns: minmax(0, 1fr) 156px;
    }

    .toolbar-group-grid-spacer {
        display: none;
    }

    .toolbar-group-grid .btn {
        grid-column: 1 / -1;
        width: 100%;
    }

    .mode-switch-container--toolbar {
        justify-content: space-between;
        width: 100%;
    }
}

/* 批量插入弹窗 */
.batch-modal {
    width: 1200px;
    max-width: 95vw;
}

.batch-content {
    display: flex;
    gap: 24px;
    margin: 16px 0;
    min-height: 450px;
}

.batch-left {
    flex: 0 0 400px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.batch-right {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.batch-textarea {
    width: 100%;
    flex: 1;
    min-height: 450px;
    border-radius: 8px;
    border: 2px solid #e5e7eb;
    padding: 14px;
    resize: none;
    font-family: Consolas, Menlo, Monaco, 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    transition: all 0.3s;
}

.batch-textarea:focus {
    outline: none;
    border-color: #ff9f40;
    box-shadow: 0 0 0 3px rgba(255, 159, 64, 0.15);
}

.batch-hint {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #495057;
    line-height: 1.7;
    border-left: 4px solid #ff9f40;
}

.batch-hint strong {
    color: #ff9f40;
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.batch-hint > div {
    margin-bottom: 6px;
}

.batch-hint-note {
    margin-top: 8px;
}

.batch-hint .highlight {
    color: #ff9f40;
    font-weight: 600;
}

.batch-hint code {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    color: #ff9f40;
    font-weight: 600;
    font-size: 12px;
}

.batch-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffecb3 100%);
    padding: 14px;
    border-radius: 8px;
    font-size: 13px;
    color: #856404;
    line-height: 1.7;
    border-left: 4px solid #ff9f40;
}

.batch-warning strong {
    color: #c62828;
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
}

.batch-warning > div {
    margin-bottom: 4px;
}

.batch-warning code {
    background: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    color: #ff9f40;
    font-weight: 700;
}

.modal-help-text {
    display: block;
    margin-top: 8px;
    color: #666;
}

.modal-hidden-input {
    display: none;
}

.batch-example {
    background: white;
    padding: 14px;
    border-radius: 8px;
    font-size: 12px;
    color: #495057;
    border: 2px solid #e9ecef;
    flex: 1;
}

.batch-example strong {
    color: #2d3748;
    display: block;
    margin-bottom: 10px;
    font-size: 13px;
}

.example-item {
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.example-item code {
    background: #f8f9fa;
    padding: 8px 10px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    color: #2d3748;
    font-size: 12px;
    display: block;
    border-left: 3px solid #ff9f40;
}

.example-item .example-note {
    color: #ff9f40;
    font-size: 11px;
    font-style: italic;
    padding-left: 13px;
}

/* 响应式：小屏幕改为上下排版 */
@media (max-width: 1024px) {
    .batch-modal {
        width: 90vw;
    }

    .batch-content {
        flex-direction: column;
        min-height: auto;
    }

    .batch-left {
        flex: none;
        width: 100%;
    }

    .batch-textarea {
        min-height: 300px;
    }
}

/* Toast 错误提示特殊样式 */
.toast-notification.toast-error .toast-message {
    white-space: pre-line;
    line-height: 1.6;
}

/* 广告生成工作区壳兼容样式 */
#adPage.aff-page-shell,
#manualPage.aff-page-shell,
#videoPage.aff-page-shell {
    max-width: none;
    margin: 0;
}

.aff-shell-apply .aff-hero-card-apply {
    grid-template-columns: minmax(0, 1.5fr) minmax(250px, 0.78fr);
    gap: 14px;
    padding: 16px 18px;
    border-radius: 22px;
}

.aff-shell-apply .aff-hero-card-apply::after {
    width: 150px;
    height: 150px;
    inset: auto -4% -16% auto;
}

.aff-shell-apply .aff-hero-card-apply .aff-kicker {
    padding: 5px 10px;
    font-size: 0.64rem;
    letter-spacing: 0.14em;
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-copy h2 {
    margin: 4px 0 8px;
    font-size: clamp(1.28rem, 2vw, 2rem);
    line-height: 1.08;
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-copy p {
    max-width: 620px;
    font-size: 0.8rem;
    line-height: 1.52;
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-nums {
    gap: 8px;
    margin-top: 12px;
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-nums div {
    padding: 10px 12px;
    min-height: 62px;
    border-radius: 16px;
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-nums strong {
    margin-bottom: 2px;
    font-size: clamp(1rem, 1.5vw, 1.45rem);
}

.aff-shell-apply .aff-hero-card-apply .aff-hero-nums small {
    font-size: 0.62rem;
}

.aff-shell-apply .aff-hero-card-apply .aff-note-card {
    padding: 12px 14px;
    border-radius: 16px;
}

.aff-shell-apply .aff-hero-card-apply .aff-note-title {
    margin-bottom: 6px;
    font-size: 0.72rem;
    letter-spacing: 0.12em;
}

.aff-shell-apply .aff-hero-card-apply .aff-note-list {
    font-size: 0.76rem;
    line-height: 1.52;
}

.ads-apply-page .aff-shell {
    gap: 16px;
}

.ads-apply-page .ads-apply-hero {
    min-height: 0;
}

.ads-apply-panel .toolbar--ads {
    margin-bottom: 14px;
}

.ads-apply-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.ads-apply-chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.92);
    border: 1px solid rgba(221, 190, 145, 0.54);
    color: #7c4b16;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.ads-page-tip {
    margin: 10px 0 14px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.78);
    border: 1px solid rgba(216, 190, 150, 0.42);
    color: var(--color-text-primary);
    font-size: 13px;
    line-height: 1.7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.62);
}

.ads-page-tip b,
.ads-page-tip strong {
    color: #7c4b16;
}

@media (max-width: 980px) {
.aff-shell-apply .aff-hero-card-apply {
        grid-template-columns: 1fr;
        padding: 18px;
    }
}

@media (max-width: 640px) {
.ads-apply-summary {
        justify-content: flex-start;
    }
}

[data-theme="dark"] .ads-apply-chip {
    background: rgba(79, 59, 29, 0.38);
    border-color: rgba(140, 117, 77, 0.46);
    color: #f7d6a0;
}

[data-theme="dark"] .ads-page-tip {
    background: rgba(23, 33, 48, 0.78);
    border-color: rgba(84, 104, 132, 0.42);
    color: #d6e0ee;
}

[data-theme="dark"] .ads-page-tip b,
[data-theme="dark"] .ads-page-tip strong {
    color: #f7d6a0;
}
