/* assets/css/bulk.css */

.page-wrap {
    max-width: 900px;
    margin: 0 auto;
    padding: 72px 24px 60px;
}

.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; font-weight: 600; margin-bottom: 2px; }
.page-sub { font-size: 13.5px; color: var(--text-muted); }

/* ── Cards / Steps ────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
}
.card h2 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.card-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 16px; }
.step-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--text-faint); margin-bottom: 6px;
}

/* ── Buttons ──────────────────────────────────── */
.btn {
    font-family: inherit; font-size: 13px; font-weight: 500;
    padding: 8px 16px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-dark); background: var(--white);
    color: var(--text); cursor: pointer; transition: all .15s;
}
.btn:hover { background: var(--bg); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-lg { font-size: 14px; padding: 12px 24px; width: 100%; margin-top: 12px; }

/* ── Drop zone ────────────────────────────────── */
.drop-zone {
    border: 2px dashed var(--border-dark);
    border-radius: var(--radius);
    padding: 36px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.drop-zone:hover, .drop-zone.over {
    border-color: var(--text);
    background: var(--bg);
}
.file-link {
    color: var(--text);
    font-weight: 500;
    text-decoration: underline;
    cursor: pointer;
}
.file-info {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 10px;
}

/* ── Preview table ────────────────────────────── */
.preview-table {
    width: 100%;
    font-size: 12px;
    border-collapse: collapse;
    margin-top: 14px;
    overflow-x: auto;
    display: block;
}
.preview-table th, .preview-table td {
    padding: 6px 8px;
    border: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
}
.preview-table th {
    background: var(--bg);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .03em;
    color: var(--text-muted);
}
.preview-table .more {
    text-align: center;
    color: var(--text-faint);
    font-style: italic;
    padding: 8px;
}

/* ── Form elements ────────────────────────────── */
.form-row { margin-bottom: 14px; }
.form-row label, .form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 5px; }
.form-row input, .form-row select {
    width: 100%; padding: 8px 10px; font-size: 13px; font-family: inherit;
    color: var(--text); border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm); background: var(--white); outline: none;
}
.form-row input:focus, .form-row select:focus {
    border-color: var(--text); box-shadow: 0 0 0 3px rgba(17,19,24,.08);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { display: block; font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.form-error {
    display: none; font-size: 13px; color: var(--danger);
    background: var(--danger-bg); border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm); padding: 8px 10px; margin-bottom: 14px;
}

/* ── Mapping rows ─────────────────────────────── */
.mapping-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.mapping-num {
    font-family: 'SFMono-Regular', ui-monospace, monospace;
    font-size: 12px; font-weight: 500; color: #1d4ed8;
    min-width: 24px;
}
.mapping-name {
    font-size: 13px; color: var(--text);
    min-width: 120px;
}
.mapping-source {
    flex: 1; min-width: 160px;
    font-size: 12px; padding: 6px 8px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-family: inherit; color: var(--text);
    background: var(--white); outline: none;
}
.mapping-static {
    width: 160px;
    font-size: 12px; padding: 6px 8px;
    border: 1px solid var(--border-dark);
    border-radius: var(--radius-sm);
    font-family: inherit; color: var(--text);
    background: var(--white);
}

/* ── Message preview ──────────────────────────── */
.tpl-preview-box {
    font-size: 13px; line-height: 1.6; color: var(--text-muted);
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 14px 16px;
    white-space: pre-wrap; word-break: break-word;
    max-height: 200px; overflow-y: auto;
}
.placeholder {
    display: inline-block;
    background: #dbeafe; color: #1d4ed8;
    font-family: 'SFMono-Regular', ui-monospace, monospace;
    font-size: 12px; font-weight: 500;
    padding: 1px 5px; border-radius: 3px;
    border: 1px solid #93c5fd;
}

/* ── Progress bar ─────────────────────────────── */
.progress-bar-wrap {
    width: 100%; height: 12px;
    background: var(--bg); border: 1px solid var(--border);
    border-radius: 6px; overflow: hidden;
    margin: 16px 0 12px;
}
.progress-bar {
    height: 100%;
    background: #10b981;
    border-radius: 6px;
    transition: width .3s ease;
    width: 0;
}
.progress-stats {
    display: flex; gap: 16px; font-size: 13px; flex-wrap: wrap;
}
.stat { display: flex; align-items: center; gap: 4px; }
.stat.sent { color: #047857; font-weight: 500; }
.stat.failed { color: var(--danger); font-weight: 500; }
.stat.remaining { color: var(--text-faint); }
.stat.pct { color: var(--text); font-weight: 600; margin-left: auto; }

/* ── History table ────────────────────────────── */
.history-table {
    width: 100%; font-size: 13px; border-collapse: collapse; margin-top: 12px;
}
.history-table th, .history-table td {
    padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left;
}
.history-table th {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .03em; color: var(--text-muted);
}
.history-table code {
    font-size: 11px; font-family: 'SFMono-Regular', ui-monospace, monospace;
}
.text-green { color: #047857; }
.text-red { color: var(--danger); }

.badge {
    font-size: 11px; font-weight: 500; padding: 2px 7px;
    border-radius: 999px; letter-spacing: .02em;
}
.badge.done { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.badge.active { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }

/* ── Loading / Empty ──────────────────────────── */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 0; color: var(--text-muted); font-size: 13px; }
.spinner { width: 20px; height: 20px; border: 2px solid var(--border); border-top-color: var(--text); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 24px 0; color: var(--text-faint); font-size: 13px; }

/* ── Toggle (if needed) ───────────────────────── */
.toggle { position: relative; display: inline-block; width: 38px; height: 22px; cursor: pointer; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider { position: absolute; inset: 0; background: var(--border-dark); border-radius: 11px; transition: background .2s; }
.toggle-slider::before { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: var(--white); border-radius: 50%; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.toggle input:checked + .toggle-slider { background: #10b981; }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .mapping-row { flex-direction: column; align-items: flex-start; }
    .mapping-source, .mapping-static { width: 100%; }
    .progress-stats { flex-direction: column; gap: 4px; }
}