/**
 * Стили бейджей и выпадающих списков (badges, custom selects)
 * Файл: public/css/badges.css
 */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
select.badge {
  cursor: pointer;
  outline: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  padding: 3px 8px;
  background-image: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}
select.badge option {
  background: var(--bg-panel);
  color: var(--text-primary);
}
.badge-new            { background: var(--status-new-bg);      color: var(--status-new);      border: 1px solid var(--status-new); }
.badge-processing     { background: var(--status-proc-bg);     color: var(--status-proc);     border: 1px solid var(--status-proc); }
.badge-to_ship        { background: var(--status-toship-bg);   color: var(--status-toship);   border: 1px solid var(--status-toship); }
.badge-shipped        { background: var(--status-ship-bg);     color: var(--status-ship);     border: 1px solid var(--status-ship); }
.badge-delivered      { background: var(--status-delivered-bg);color: var(--status-delivered);border: 1px solid var(--status-delivered); }
.badge-issued         { background: var(--status-issued-bg);   color: var(--status-issued);   border: 1px solid var(--status-issued); }
.badge-done           { background: var(--status-done-bg);     color: var(--status-done);     border: 1px solid var(--status-done); }
.badge-refused        { background: var(--status-refused-bg);  color: var(--status-refused);  border: 1px solid var(--status-refused); }
.badge-returned       { background: var(--status-returned-bg); color: var(--status-returned); border: 1px solid var(--status-returned); }
.badge-security_cancel{ background: var(--status-seccancel-bg);color: var(--status-seccancel);border: 1px solid var(--status-seccancel); }
.badge-deleted        { background: var(--status-deleted-bg);  color: var(--status-deleted);  border: 1px solid var(--status-deleted); }

[data-theme="light"] .badge-done {
  background: var(--status-done-bg);
  color: var(--status-done);
  border: 1px solid var(--status-done);
}

.rating-badge {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}
.rating-badge--low {
  color: var(--status-cancel, #e53935);
  font-weight: bold;
}

.buyer-orders-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(79, 142, 247, 0.12);
  color: var(--brand);
  border: 1px solid rgba(79, 142, 247, 0.3);
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  padding: 0;
  cursor: pointer;
  transition: all var(--t-fast);
  flex-shrink: 0;
}
.buyer-orders-badge.buyer-filter-active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  animation: pulse 1.5s infinite;
}
.buyer-orders-badge:hover {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.client-name-cell, .items-cell {
  display: flex;
  flex-direction: column;
}

/* ── Source Badge ───────────────────────────────────────────────── */
.source-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.src-prom     { background: transparent;  color: var(--src-prom); }
.src-prom_sayt { background: transparent;  color: var(--src-prom); }
.src-rozetka  { background: transparent;  color: var(--src-rozetka); }
.src-opencart { background: transparent; color: var(--src-opencart); }
.src-maudau   { background: transparent; color: var(--src-maudau); }
.src-epicentr { background: transparent;  color: var(--src-epicentr); }
.src-manual   { background: transparent; color: var(--src-manual); }
.src-olx      { background: rgba(234, 179, 8, 0.12); color: var(--src-olx); }
.src-bigl     { background: transparent; color: var(--src-bigl); }

select.badge.source-select-overlay {
  text-transform: uppercase;
}

.source-select-wrap.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 3px 12px;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
  border: 1px solid currentColor;
}

.source-select-wrap--two {
  flex-direction: column;
  align-items: stretch;
  min-width: 64px;
  max-width: 84px;
  min-height: 30px;
  padding: 3px 6px;
  white-space: normal;
}

.source-select-label {
  pointer-events: none;
  text-align: center;
  box-sizing: border-box;
}

.source-select-label--one {
  display: block;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1.2;
}

.source-select-label--two {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  width: 100%;
}

.source-select-wrap select.source-select-overlay {
  display: none;
}

.source-select-wrap.src-prom,
.source-select-wrap.src-prom_sayt { border: 1px solid var(--src-prom); }
.source-select-wrap.src-rozetka  { border: 1px solid var(--src-rozetka); }
.source-select-wrap.src-opencart { border: 1px solid var(--src-opencart); }
.source-select-wrap.src-maudau   { border: 1px solid var(--src-maudau); }
.source-select-wrap.src-epicentr { border: 1px solid var(--src-epicentr); }
.source-select-wrap.src-manual   { border: 1px solid var(--src-manual); }
.source-select-wrap.src-olx      { border: 1px solid var(--src-olx); }
.source-select-wrap.src-bigl      { border: 1px solid var(--src-bigl); }

select.badge.src-prom     { border: 1px solid var(--src-prom); }
select.badge.src-prom_sayt { border: 1px solid var(--src-prom); }
select.badge.src-rozetka  { border: 1px solid var(--src-rozetka); }
select.badge.src-opencart { border: 1px solid var(--src-opencart); }
select.badge.src-maudau   { border: 1px solid var(--src-maudau); }
select.badge.src-epicentr { border: 1px solid var(--src-epicentr); }
select.badge.src-manual   { border: 1px solid var(--src-manual); }
select.badge.src-olx      { border: 1px solid var(--src-olx); }
select.badge.src-bigl     { border: 1px solid var(--src-bigl); }

/* ── Delivery badge ─────────────────────────────────────────────── */
.delivery-text {
  display: flex;
  justify-content: center;
  font-size: 11px;
  color: var(--text-secondary);
}
.delivery-badge-wrapper {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  line-height: 1.15;
}
.delivery-badge-label {
  font-size: 9px;
  color: var(--text-secondary);
  font-weight: 500;
}
.delivery-badge-label--two {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.delivery-brand-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  border-radius: 2px;
  flex-shrink: 0;
}

/* ── Payment badge ──────────────────────────────────────────────── */
.payment-badge {
  font-size: 11px;
  color: var(--text-secondary);
}
.payment-badge--unpaid {
  color: var(--status-cancel, #e53935);
  font-weight: 700;
}
select.badge.payment-select {
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  max-width: 100%;
  background-image: none;
}
select.badge.payment-select.payment-select--unpaid {
  color: var(--status-cancel, #e53935);
  font-weight: 700;
  border-color: var(--status-cancel, #e53935);
  background-color: rgba(229, 57, 53, 0.08);
}

/* Колонка «Способ оплаты»: две строки (наложенный платеж) + overlay select */
.payment-select-wrap.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 3px 8px;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.payment-select-wrap--two {
  flex-direction: column;
  align-items: stretch;
  min-width: 72px;
  max-width: 88px;
  min-height: 30px;
  padding: 3px 4px;
  white-space: normal;
}
.payment-select-wrap.payment-select--unpaid {
  color: var(--status-cancel, #e53935);
  font-weight: 700;
  border-color: var(--status-cancel, #e53935);
  background-color: rgba(229, 57, 53, 0.08);
}
.payment-select-label {
  pointer-events: none;
  text-align: center;
  box-sizing: border-box;
}
.payment-select-label--two {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.15;
  font-size: 10px;
  font-weight: 600;
  width: 100%;
}
.payment-select-wrap select.payment-select-overlay {
  display: none;
}

/* Колонка «Статус» */
.status-select-wrap.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 3px 8px;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
}

/* Кастомные выпадающие списки в таблице заказов */
.table-select-trigger {
  all: unset;
  cursor: pointer;
  font: inherit;
  font-size: inherit;
  font-weight: inherit;
  color: inherit;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  box-sizing: border-box;
}
.status-select-wrap .table-select-trigger {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.source-select-wrap .table-select-trigger {
  width: 100%;
}
.payment-select-wrap .table-select-trigger,
.delivery-select-wrap .table-select-trigger {
  width: 100%;
}
.delivery-select-wrap.has-icon .table-select-trigger {
  padding: 0;
}
.table-select-menu {
  position: absolute;
  top: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  min-width: max(100%, 11rem);
  max-height: min(50vh, 320px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  padding: 4px 0;
}
.table-select-menu--uppercase .table-select-option {
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 11px;
  font-weight: 600;
}
.table-select-option {
  display: block;
  width: 100%;
  padding: 6px 12px;
  margin: 0;
  border: none;
  background: transparent;
  text-align: left;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-primary);
}
.table-select-option:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.05));
}
.table-select-option.is-selected {
  background: var(--accent, #2563eb);
  color: #fff;
}
.table-select-wrap.is-open,
.status-select-wrap.badge:focus-within,
.payment-select-wrap.badge:focus-within,
.source-select-wrap.badge:focus-within,
.delivery-select-wrap.badge:focus-within {
  position: relative;
  z-index: 23;
}

.delivery-select-wrap.badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px;
  white-space: nowrap;
  box-sizing: border-box;
  cursor: pointer;
  background: var(--bg-card);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  max-width: 100%;
}
.delivery-select-wrap.badge.has-icon {
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  justify-content: center;
}
.delivery-select-wrap.badge.has-icon .delivery-brand-icon {
  width: 24px;
  height: 24px;
}
.delivery-select-wrap--two {
  min-width: 72px;
  max-width: 96px;
}

.np-delivery-status-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 600;
  margin-top: 3px;
  text-align: center;
  width: fit-content;
  align-self: center;
}

.delivery-select-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  pointer-events: none;
}
.delivery-select-label {
  pointer-events: none;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.15;
}
.delivery-select-label--two {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.delivery-select-wrap select.delivery-select-overlay {
  display: none;
}

/* ── Tracking number ────────────────────────────────────────────── */
.tracking-link {
  font-size: 11px;
  font-family: monospace;
  color: var(--text-link);
}
.tracking-link:hover { text-decoration: underline; }
