/* ═══════════════════════════════════════════════════════════════
   Business Actions — CRUD modal, color swatch, trigger workflow
   ═══════════════════════════════════════════════════════════════ */

/* ── Modal ── */
.ba-modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15, 25, 41, .45);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    padding: 20px;
}
.ba-modal {
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 16px 48px rgba(13,53,133,.20);
    width: 100%; max-width: 540px;
    max-height: calc(100vh - 40px);
    overflow: hidden;
    display: flex; flex-direction: column;
}
.ba-modal__head {
    padding: 14px 18px;
    border-bottom: 1px solid var(--gray-100);
    display: flex; align-items: center; justify-content: space-between;
}
.ba-modal__head h3 {
    margin: 0;
    font-size: 15px; font-weight: 700;
    color: var(--blue-800);
}
.ba-modal__close {
    width: 28px; height: 28px; border-radius: 6px;
    border: none; background: var(--gray-100);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.ba-modal__close i { font-size: 15px; color: var(--gray-500); }
.ba-modal__body { padding: 18px; overflow-y: auto; flex: 1; min-height: 0; }
/* Header and footer never shrink: only the body scrolls, so Save/Cancel stay visible. */
.ba-modal__head, .ba-modal__footer { flex-shrink: 0; }
/* An EditForm between .ba-modal and its body/footer would break the flex chain and
   let the body grow past the modal (footer clipped). Make the form part of it. */
.ba-modal > form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ba-modal__footer {
    padding: 12px 18px;
    border-top: 1px solid var(--gray-100);
    display: flex; justify-content: flex-end; gap: 10px;
}

/* ── Color swatch ── */
.ba-swatch {
    display: inline-flex; align-items: center; gap: 8px;
}
.ba-swatch__chip {
    width: 24px; height: 24px;
    border-radius: 6px;
    border: 1px solid var(--gray-200);
    display: inline-block;
    flex-shrink: 0;
}
.ba-swatch__code {
    font-family: 'Courier New', monospace;
    font-size: 12px;
    color: var(--gray-600);
}

/* ── Priority chip ── */
.ba-priority {
    display: inline-flex; align-items: center;
    font-size: 11px; font-weight: 700;
    padding: 3px 10px; border-radius: 999px;
    border: 1px solid transparent;
}
.ba-priority--1 { background: var(--red-100); color: var(--red-500); border-color: var(--red-border); }
.ba-priority--2 { background: var(--gold-100); color: var(--gold-600); border-color: #F0D890; }
.ba-priority--3 { background: var(--blue-100); color: var(--blue-700); border-color: var(--blue-100); }
.ba-priority--0 { background: var(--gray-100); color: var(--gray-500); border-color: var(--gray-200); }

/* ── TRIGGER WORKFLOW ── */
.bat-shell {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
}
@media (max-width: 900px) {
    .bat-shell { grid-template-columns: 1fr; }
}

.bat-select-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    padding: 14px 16px;
    height: fit-content;
}
.bat-select-card__title {
    font-size: 13px; font-weight: 600;
    color: var(--blue-800);
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 7px;
}
.bat-select-card__title i { color: var(--gold-300); font-size: 16px; }

.bat-trigger-card {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    overflow: hidden;
}
.bat-trigger-card__head {
    background: var(--navy-800);
    padding: 12px 18px;
    display: flex; align-items: center; justify-content: space-between;
}
.bat-trigger-card__title {
    font-size: 13px; font-weight: 600;
    color: #fff;
    display: flex; align-items: center; gap: 7px;
}
.bat-trigger-card__title i { color: var(--gold-300); }
.bat-trigger-card__body { padding: 16px; }

/* ── Action sequence timeline ── */
.bat-timeline {
    display: flex; flex-direction: column; gap: 8px;
    margin-bottom: 16px;
}
.bat-step {
    background: var(--gray-50);
    border: 1.5px solid var(--gray-100);
    border-radius: 10px;
    padding: 10px 12px;
    display: grid;
    grid-template-columns: 70px 1fr auto;
    gap: 12px;
    align-items: center;
}
.bat-step__day {
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    color: var(--gray-400);
}
.bat-step__day-value {
    font-size: 18px; font-weight: 700;
    color: var(--blue-800);
    line-height: 1;
}
.bat-step__action {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
}
.bat-step__action-color {
    width: 8px; height: 32px; border-radius: 3px;
    flex-shrink: 0;
}
.bat-step__action-info { min-width: 0; }
.bat-step__action-name {
    font-size: 13px; font-weight: 600;
    color: var(--gray-800);
}
.bat-step__action-notes {
    font-size: 11px; color: var(--gray-500);
    margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bat-step__remove {
    width: 28px; height: 28px;
    border-radius: 5px;
    background: var(--red-100); border: 1px solid var(--red-border);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
}
.bat-step__remove i { font-size: 13px; color: var(--red-500); }

.bat-add-row {
    background: var(--blue-50);
    border: 1.5px dashed var(--blue-200, #A8C8F0);
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 90px 1fr auto;
    gap: 10px;
    align-items: end;
}
@media (max-width: 700px) {
    .bat-add-row { grid-template-columns: 1fr; }
    .bat-step    { grid-template-columns: 1fr auto; }
    .bat-step__day { font-size: 12px; }
}
.bat-trigger-empty {
    padding: 28px;
    text-align: center;
    background: var(--gray-50);
    border-radius: 10px;
    color: var(--gray-400);
    font-size: 13px;
}
.bat-trigger-empty i { font-size: 28px; display: block; margin-bottom: 8px; color: var(--gray-300); }

/* ── TRIGGER GROUP (gold-headed collapsible) ── */
.bat-group {
    background: var(--white);
    border-radius: 14px;
    border: 1px solid var(--gray-100);
    box-shadow: 0 1px 4px rgba(13,53,133,.06);
    overflow: hidden;
    margin-bottom: 16px;
}
.bat-group__head {
    background: linear-gradient(135deg, var(--gold-400), var(--gold-300));
    padding: 12px 18px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
}
.bat-group__head--blue   { background: linear-gradient(135deg, var(--blue-700), var(--blue-500)); }
.bat-group__head--green  { background: linear-gradient(135deg, #156036, var(--green-500)); }
.bat-group__head--red    { background: linear-gradient(135deg, #A02828, var(--red-500)); }
.bat-group__head--purple { background: linear-gradient(135deg, #4B35BB, var(--purple-500)); }
.bat-group__icon {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,.25);
    display: inline-flex; align-items: center; justify-content: center;
}
.bat-group__icon i { font-size: 16px; color: #fff; }
.bat-group__title {
    flex: 1;
    font-size: 14px; font-weight: 700;
    color: #fff;
    text-transform: uppercase; letter-spacing: .04em;
}
.bat-group__head--gold .bat-group__title,
.bat-group__head:not([class*="bat-group__head--"]) .bat-group__title {
    color: var(--blue-900);
}
.bat-group__count {
    background: rgba(255,255,255,.25);
    color: #fff;
    font-size: 11px; font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
}
.bat-group__chev {
    width: 28px; height: 28px;
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 18px;
}
.bat-group__head:not([class*="bat-group__head--"]) .bat-group__chev,
.bat-group__head:not([class*="bat-group__head--"]) .bat-group__count {
    color: var(--blue-900);
}
.bat-group__head:not([class*="bat-group__head--"]) .bat-group__count {
    background: rgba(6,35,90,.15);
}
.bat-group__body { padding: 14px 16px; }

.bat-group__toolbar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px;
}

/* ── ROWS TABLE inside group ── */
.bat-rows {
    width: 100%; border-collapse: collapse;
    background: var(--gray-50);
    border-radius: 10px;
    overflow: hidden;
}
.bat-rows thead tr { background: var(--navy-800); }
.bat-rows th {
    font-size: 10px; font-weight: 700;
    color: rgba(255,255,255,.85);
    padding: 9px 12px;
    text-align: left;
    text-transform: uppercase; letter-spacing: .06em;
}
.bat-rows td {
    padding: 9px 12px;
    font-size: 12px;
    color: var(--gray-700);
    border-bottom: 1px solid var(--gray-100);
    background: var(--white);
}
.bat-rows tr:last-child td { border-bottom: none; }
.bat-rows tr:hover td { background: var(--blue-50); }

.bat-rows__type {
    display: inline-flex; align-items: center; gap: 6px;
    font-weight: 600;
}
.bat-rows__type-dot {
    width: 8px; height: 8px; border-radius: 50%;
    flex-shrink: 0;
}
.bat-rows__day {
    font-weight: 700;
    color: var(--blue-700);
    font-size: 13px;
}
.bat-rows__title {
    color: var(--gray-800);
    font-weight: 500;
}
.bat-rows__lang {
    font-size: 10px; font-weight: 700;
    padding: 2px 7px; border-radius: 999px;
    background: var(--blue-50); color: var(--blue-700);
    border: 1px solid var(--blue-100);
}
.bat-rows__active-dot {
    display: inline-block;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green-500);
}
.bat-rows__active-dot--off { background: var(--gray-300); }

/* ── BIG EDIT MODAL (mirrors legacy "Edit Business Type") ── */
.ba-modal--lg { max-width: 920px; }
.ba-modal__body--scroll { max-height: calc(100vh - 200px); }

.ba-modal__head--dark {
    background: var(--navy-800);
    border-bottom: none;
}
.ba-modal__head--dark h3 { color: #fff; text-transform: uppercase; letter-spacing: .04em; font-size: 14px; }
.ba-modal__head--dark .ba-modal__close { background: rgba(255,255,255,.12); }
.ba-modal__head--dark .ba-modal__close i { color: #fff; }

/* Merge tag chips for content script */
.ba-merge-tags {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-top: 8px;
}
.ba-merge-tag {
    display: inline-flex; align-items: center; gap: 4px;
    background: var(--blue-50);
    color: var(--blue-700);
    border: 1px solid var(--blue-100);
    padding: 3px 8px;
    border-radius: 5px;
    font-family: 'Courier New', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all .15s;
}
.ba-merge-tag:hover {
    background: var(--navy-700);
    color: #fff;
    border-color: var(--blue-700);
}
.ba-merge-tag i { font-size: 11px; }

.ba-modal__form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 14px;
    margin-bottom: 14px;
}
.ba-modal__form-grid--2 { grid-template-columns: 1fr 1fr; }
@media (max-width: 700px) {
    .ba-modal__form-grid,
    .ba-modal__form-grid--2 { grid-template-columns: 1fr; }
}

.ba-active-row {
    display: flex; align-items: center; gap: 10px;
    padding-top: 4px;
}
.ba-active-row input[type=checkbox] {
    width: 18px; height: 18px;
    accent-color: var(--blue-700);
    cursor: pointer;
}
.ba-active-row label {
    font-size: 13px; font-weight: 500; color: var(--gray-700);
    cursor: pointer;
}
