/**
 * Admin UI components under .admin-app
 * Restyles shared names (.btn, .card, .modal, .alert, .input) inside the shell.
 */

.admin-app a {
  color: var(--admin-accent);
  text-decoration: none;
}

.admin-app a:hover {
  color: var(--admin-accent-active);
}

.admin-app button,
.admin-app input,
.admin-app select,
.admin-app textarea {
  font-family: inherit;
}

/* Cards */
.admin-app .card {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  box-shadow: none;
}

.admin-app .card .ch,
.admin-app .admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--admin-soft-line);
}

.admin-app .card .ch h2,
.admin-app .admin-card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.admin-app .card-body {
  padding: 18px;
}

/* Buttons */
.admin-app .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
  box-shadow: none;
}

.admin-app .btn-primary {
  background: var(--admin-accent);
  color: #fff;
  border-color: var(--admin-accent);
}

.admin-app .btn-primary:hover,
.admin-app .btn-primary:focus {
  background: var(--admin-accent-hover);
  border-color: var(--admin-accent-hover);
  color: #fff;
}

.admin-app .btn-ghost,
.admin-app .btn-secondary {
  background: #fff;
  color: var(--admin-fg);
  border-color: var(--admin-input-border);
}

.admin-app .btn-ghost:hover,
.admin-app .btn-secondary:hover {
  background: var(--admin-bg);
  color: var(--admin-fg);
}

.admin-app .btn-danger {
  background: var(--admin-danger);
  color: #fff;
  border-color: var(--admin-danger);
}

.admin-app .btn-danger:hover {
  background: var(--admin-danger-hover);
  border-color: var(--admin-danger-hover);
  color: #fff;
}

.admin-app .btn-soft {
  background: var(--admin-accent-soft);
  color: var(--admin-accent-hover);
  border-color: transparent;
}

.admin-app .btn-soft:hover {
  background: #D9E5DC;
  color: var(--admin-accent-hover);
}

/* Icon buttons */
.admin-app .ib {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--admin-line);
  background: #fff;
  color: #4A463F;
  cursor: pointer;
  padding: 0;
}

.admin-app .ib:hover {
  background: var(--admin-bg);
  color: var(--admin-fg);
}

.admin-app .ib-red {
  color: var(--admin-danger);
}

.admin-app .ib-red:hover {
  background: var(--admin-danger-soft);
  color: var(--admin-danger-hover);
}

/* Forms */
.admin-app .input,
.admin-app .form-control,
.admin-app .form-select {
  height: 42px;
  width: 100%;
  padding: 0 12px;
  border: 1px solid var(--admin-input-border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
  color: var(--admin-fg);
  box-shadow: none;
}

.admin-app textarea.input,
.admin-app textarea.form-control {
  height: auto;
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  line-height: 1.7;
}

.admin-app .input:focus,
.admin-app .form-control:focus,
.admin-app .form-select:focus {
  outline: 2px solid var(--admin-accent);
  outline-offset: -1px;
  border-color: var(--admin-accent);
  box-shadow: none;
}

/*
 * Select2 matching .admin-app .input (opt-in).
 * Add classes: select2 select2-input [custom-height]
 * Do not change global Select2 theme in custom.css (legacy forms).
 */
.admin-app select.select2-input + .select2-container {
  width: 100% !important;
}

.admin-app select.select2-input + .select2-container .select2-selection--single {
  height: 42px;
  min-height: 42px;
  border: 1px solid var(--admin-input-border);
  border-radius: 10px;
  background-color: #fff;
  font-size: 14px;
  box-shadow: none;
  box-sizing: border-box;
}

.admin-app select.select2-input + .select2-container .select2-selection--single .select2-selection__rendered {
  line-height: 40px;
  padding-inline: 12px 28px;
  color: var(--admin-fg);
  font-size: 14px;
}

.admin-app select.select2-input + .select2-container .select2-selection--single .select2-selection__placeholder {
  color: #999;
  top: 0;
}

.admin-app select.select2-input + .select2-container .select2-selection--single .select2-selection__arrow {
  display: block;
  height: 40px;
  width: 24px;
  top: 1px;
}

.admin-app[dir="rtl"] select.select2-input + .select2-container .select2-selection--single .select2-selection__arrow,
[dir="rtl"] .admin-app select.select2-input + .select2-container .select2-selection--single .select2-selection__arrow {
  left: 4px;
  right: auto;
}

.admin-app[dir="ltr"] select.select2-input + .select2-container .select2-selection--single .select2-selection__arrow,
[dir="ltr"] .admin-app select.select2-input + .select2-container .select2-selection--single .select2-selection__arrow {
  right: 4px;
  left: auto;
}

.admin-app select.select2-input + .select2-container.select2-container--focus .select2-selection--single,
.admin-app select.select2-input + .select2-container.select2-container--open .select2-selection--single {
  outline: 2px solid var(--admin-accent);
  outline-offset: -1px;
  border-color: var(--admin-accent);
}

/* Dropdown is appended under body.admin-app (readable vs global 10px theme). */
.admin-app .select2-results__option {
  font-size: 14px;
}

.admin-app .lbl,
.admin-app .form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3D3932;
  margin-bottom: 6px;
}

.admin-app .req {
  color: var(--admin-danger);
}

.admin-app .hint {
  font-size: 12px;
  color: var(--admin-muted);
  margin-top: 6px;
}

.admin-app .admin-field {
  margin-bottom: 16px;
}

/* Chips */
.admin-app .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
}

.admin-app .chip.c-green { background: #E3F3EA; color: #17603C; }
.admin-app .chip.c-amber { background: #FDF0D9; color: #7A4A0C; }
.admin-app .chip.c-red { background: #FDE8E6; color: #A11F15; }
.admin-app .chip.c-blue { background: #E4EEF9; color: #1B548C; }
.admin-app .chip.c-gray { background: #EEEBE4; color: #4A463F; }
.admin-app .chip.c-purple { background: #EFE8F7; color: #5B3A8A; }

/* Tables */
.admin-app .tbl,
.admin-app .table {
  width: 100%;
  margin: 0;
  border-collapse: collapse;
}

.admin-app .tbl th,
.admin-app .table thead th {
  background: var(--admin-table-head);
  font-size: 12.5px;
  font-weight: 600;
  color: #4A463F;
  padding: 11px 16px;
  border-bottom: 1px solid var(--admin-line);
  white-space: nowrap;
}

.admin-app .tbl td,
.admin-app .table td {
  padding: 10px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--admin-soft-line);
  vertical-align: middle;
}

.admin-app .table-responsive {
  overflow-x: auto;
}

/* Pagination */
.admin-app .pg {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--admin-soft-line);
  font-size: 13px;
  color: var(--admin-muted);
  gap: 12px;
  flex-wrap: wrap;
}

.admin-app .pgb {
  min-width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid var(--admin-line);
  background: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #3D3932;
  cursor: pointer;
  padding: 0 8px;
  text-decoration: none;
}

.admin-app .pgb:hover {
  background: var(--admin-bg);
  color: var(--admin-fg);
}

.admin-app .pgb-on,
.admin-app .pgb.is-active {
  background: var(--admin-accent);
  border-color: var(--admin-accent);
  color: #fff;
}

/* Prototype-style modal overlay (not BS modal) */
.admin-app .admin-overlay {
  position: fixed;
  inset: 0;
  background: var(--admin-overlay);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  z-index: 1050;
  overflow: auto;
}

.admin-app .admin-overlay.is-open {
  display: flex;
}

.admin-app .admin-modal {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(30, 28, 24, 0.28);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 48px);
  width: min(560px, calc(100% - 32px));
  margin: auto;
  position: relative;
}

.admin-app .admin-modal .mh,
.admin-app .admin-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--admin-soft-line);
}

.admin-app .admin-modal .mh h2,
.admin-app .admin-modal__header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.admin-app .admin-modal .mb,
.admin-app .admin-modal__body {
  padding: 22px 24px;
  overflow: auto;
}

.admin-app .admin-modal .mf,
.admin-app .admin-modal__footer {
  display: flex;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--admin-soft-line);
  justify-content: flex-end;
}

/* Alerts */
.admin-app .alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: 14px;
  padding: 14px 16px;
  font-size: 14px;
  margin-bottom: 0;
}

.admin-app .alert-success,
.admin-app .alert-g {
  background: #E3F3EA;
  border: 1px solid #BFE3CD;
  color: #17603C;
}

.admin-app .alert-danger,
.admin-app .alert-r,
.admin-app .alert-warning {
  background: #FDF0D9;
  border: 1px solid #F0D3A2;
  color: #5E3E0E;
}

.admin-app .alert-danger {
  background: #FDE8E6;
  border-color: #F3C6C2;
  color: #A11F15;
}

/* Toasts */
.admin-app .admin-toast-host {
  position: fixed;
  inset-inline-end: 24px;
  bottom: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 360px;
}

.admin-app .admin-toast {
  background: #fff;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
  padding: 12px 14px;
  font-size: 14px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.admin-app .admin-toast.is-success {
  border-color: #BFE3CD;
}

.admin-app .admin-toast.is-error {
  border-color: #F3C6C2;
}

/* KPI — flex-direction:row overrides Bootstrap .card (column) so icon|body|chip stay horizontal like prototype */
.admin-app .kpi {
  padding: 16px 18px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  height: 96px;
}

.admin-app .kpi-ic {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--admin-accent-soft);
  color: var(--admin-accent);
  flex-shrink: 0;
  font-size: 20px;
}

.admin-app .kpi-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.admin-app .kpi-label {
  margin: 0;
  font-size: 13px;
  color: var(--admin-muted);
}

.admin-app .kpi-value {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.2px;
}

.admin-app .kpi .chip {
  flex-shrink: 0;
}

/* Segmented control (dashboard period, etc.) */
.admin-app .seg {
  display: inline-flex;
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}

.admin-app .seg button {
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--admin-fg);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.admin-app .seg button.on {
  background: var(--admin-accent);
  color: #fff;
}

.admin-app .dash-period {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.admin-app .dash-period__custom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-app .dash-period__custom .input {
  width: auto;
  min-width: 140px;
  height: 34px;
}

/* Statistics dashboard layout */
.admin-app .dash-stats {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Dim content only — not the loader (parent opacity would fade the spinner too) */
.admin-app .dash-stats.is-loading {
  pointer-events: none;
}

.admin-app .dash-stats.is-loading > :not(.dash-loader) {
  opacity: 0.55;
}

.admin-app .dash-loader {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 5;
  align-items: flex-start;
  justify-content: center;
  padding-top: min(28vh, 220px);
  background: rgba(247, 245, 240, 0.55);
  border-radius: 12px;
}

.admin-app .dash-stats.is-loading .dash-loader {
  display: flex;
}

/* Sticky keeps the spinner in the first viewport while the overlay covers the full block */
.admin-app .dash-loader__spinner {
  position: sticky;
  top: 40%;
  width: 44px;
  height: 44px;
  border: 4px solid rgba(46, 75, 60, 0.18);
  border-top-color: #2E4B3C;
  border-radius: 50%;
  animation: dash-spin 0.7s linear infinite;
  box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.65);
}

@keyframes dash-spin {
  to { transform: rotate(360deg); }
}

.admin-app .dash-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.admin-app .dash-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}

.admin-app .dash-sales-chart {
  height: 250px;
  padding: 12px 18px 8px;
}

.admin-app .dash-statuses {
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.admin-app .dash-status__row {
  display: flex;
  justify-content: space-between;
  font-size: 13.5px;
}

.admin-app .dash-status__count {
  font-weight: 700;
}

.admin-app .dash-status__track {
  height: 8px;
  background: #F0ECE4;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}

.admin-app .dash-status__bar {
  height: 8px;
  border-radius: 99px;
}

.admin-app .dash-status__bar.c-blue { background: #1B548C; }
.admin-app .dash-status__bar.c-amber { background: #B8741A; }
.admin-app .dash-status__bar.c-purple { background: #5B3A8A; }
.admin-app .dash-status__bar.c-green { background: #2E4B3C; }
.admin-app .dash-status__bar.c-red { background: #B42318; }
.admin-app .dash-status__bar.c-gray { background: #6B655B; }

.admin-app .dash-product {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-app .thumb {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #FBF1E1;
  color: #7A4A0C;
  font-weight: 700;
  flex-shrink: 0;
}

@media (max-width: 991.98px) {
  .admin-app .dash-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-app .dash-charts {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 575.98px) {
  .admin-app .dash-kpis {
    grid-template-columns: 1fr;
  }
}

/* Empty state */
.admin-app .admin-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--admin-muted);
}

.admin-app .admin-empty h3 {
  margin: 12px 0 6px;
  color: var(--admin-fg);
  font-size: 16px;
  font-weight: 700;
}

.admin-app .admin-empty p {
  margin: 0;
  font-size: 14px;
}

/* FAQ answer expand (module-specific) */
.admin-app .exp {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #6B655B;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex-shrink: 0;
}

.admin-app .exp:hover {
  color: #1E1C18;
}

/* Switch */
.admin-app .sw {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #DCD6CA;
  position: relative;
  border: none;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.admin-app .sw::after {
  content: "";
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
  transition: transform 0.15s ease;
}

.admin-app .sw.sw-on,
.admin-app .sw.is-on {
  background: var(--admin-accent);
}

.admin-app .sw.sw-on::after,
.admin-app .sw.is-on::after {
  transform: translateX(18px);
}

[dir="rtl"] .admin-app .sw.sw-on::after,
[dir="rtl"] .admin-app .sw.is-on::after {
  transform: translateX(-18px);
}

/* Soften legacy page chrome inside shell */
.admin-app .dashbord_home .border-item,
.admin-app .new-users.border-item {
  background: var(--admin-card);
  border: 1px solid var(--admin-line);
  border-radius: 14px;
  padding: 16px 18px;
}

/* Legacy .border-item stripe used #1E4AE1 (--mainColor); match design tokens */
.admin-app .border-item::before {
  background-color: var(--admin-accent);
}

.admin-app .border-item::after {
  border-bottom-color: var(--admin-bg);
  border-left-color: var(--admin-bg);
}

/* Settings tabs (.stabs) */
.admin-app .admin-stabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.admin-app .admin-stab {
  height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--admin-muted);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.admin-app .admin-stab:hover {
  background: var(--admin-bg);
  color: var(--admin-fg);
}

.admin-app .admin-stab.is-active {
  background: var(--admin-accent-soft);
  color: var(--admin-accent-hover);
}

.admin-app .admin-settings-pane[hidden] {
  display: none !important;
}

.admin-app .admin-settings-form .admin-card-header {
  gap: 12px;
  flex-wrap: wrap;
}

/* Permission switches in Admins modal */
.admin-app .admins-perm-table .admins-perm-sw {
  margin: 0 auto;
}

.admin-app .admins-perm-table .admins-perm-check.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Radio option cards (ProductForm featured, reusable) */
.admin-app .flag {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #E6E1D7;
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
  margin: 0;
  background: #fff;
}

.admin-app .flag input {
  width: 18px;
  height: 18px;
  accent-color: #2E4B3C;
  margin: 0;
  flex-shrink: 0;
}

.admin-app .flag:has(input:checked) {
  border-color: #2E4B3C;
  background: #F3F7F4;
}

.admin-app .req {
  color: #B42318;
}

/* Product form — images layout (ProductForm prototype) */
.admin-app .products-form .products-images {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.admin-app .products-form .products-images-main {
  width: 240px;
  flex-shrink: 0;
}

.admin-app .products-form .products-images-gallery {
  flex: 1;
  min-width: 220px;
}

.admin-app .products-form .drop {
  border: 1.5px dashed #CFC8BA;
  border-radius: 12px;
  background: #FAF8F3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #6B655B;
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  padding: 12px;
}

.admin-app .products-form .drop.is-dragover {
  border-color: #2E4B3C;
  background: #F3F7F4;
}

.admin-app .products-form .products-main-preview.is-dragover {
  outline: 2px dashed #2E4B3C;
  outline-offset: -2px;
}

.admin-app .products-form .products-main-drop,
.admin-app .products-form .products-main-preview {
  width: 240px;
  height: 240px;
}

.admin-app .products-form .img {
  border-radius: 12px;
  background: #FBF1E1;
  color: #7A4A0C;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  position: relative;
  overflow: hidden;
}

.admin-app .products-form .img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.admin-app .products-form .img .x {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #E6E1D7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #B42318;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  font-size: 16px;
  z-index: 1;
}

.admin-app .products-form .products-gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
}

.admin-app .products-form .products-gallery-item {
  height: 112px;
  cursor: grab;
}

.admin-app .products-form .products-gallery-item:active {
  cursor: grabbing;
}

.admin-app .products-form .products-gallery-drop {
  height: 112px;
  width: 100%;
  margin: 0;
  box-sizing: border-box;
}

/* Package row: select + price inputs match ProductForm 42px height */
.admin-app .products-form .products-pack-row .input,
.admin-app .products-form .products-pack-row select.input {
  height: 42px;
  min-height: 42px;
  padding: 0 12px;
  line-height: 1.25;
  box-sizing: border-box;
}

/* Package row: discount % chip on price-before field */
.admin-app .products-form .products-pack-before-wrap {
  position: relative;
}

.admin-app .products-form .products-pack-before-wrap.has-off .products-pack-price-before {
  /* Chip at physical left; clear digits only while chip is visible */
  padding-left: 5.75rem;
  text-align: end;
}

.admin-app .products-form .products-pack-discount {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  height: 24px;
  z-index: 1;
  pointer-events: none;
}

/* Field-level validation (AJAX 422) */
.admin-app .products-form .input.is-invalid,
.admin-app .products-form select.is-invalid,
.admin-app .products-form .form-control.is-invalid {
  border-color: var(--admin-danger);
}

.admin-app .products-form .products-field-error {
  color: var(--admin-danger);
  margin-top: 4px;
  margin-bottom: 0;
}

.admin-app .products-form .products-images-main.is-invalid .drop,
.admin-app .products-form .products-images-main.is-invalid .products-main-preview {
  border-color: var(--admin-danger);
}

.admin-app .products-form .products-images-gallery.is-invalid .products-gallery-drop {
  border-color: var(--admin-danger);
}

.admin-app .products-form .admin-field.is-invalid .tox-tinymce {
  border-color: var(--admin-danger) !important;
}

@media (max-width: 767.98px) {
  .admin-app .products-form .products-gallery-grid {
    /* Display two equal-width columns on small screens. */
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Users / members UserView */
.admin-app .members-kpi {
  min-width: 110px;
  padding: 10px 14px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background: var(--admin-bg);
}

.admin-app .members-pane[hidden] {
  display: none !important;
}

.admin-app .members-addresses-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 767.98px) {
  .admin-app .members-addresses-grid {
    grid-template-columns: 1fr;
  }
}

.admin-app .members-address-card {
  padding: 16px 18px;
  border: 1px solid var(--admin-line);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-app .members-address-card__body {
  font-size: 14px;
  line-height: 1.7;
}

.admin-app .members-address-card__phone {
  font-size: 13px;
}

/* Excel export circular progress (queued large exports) */
.admin-app .excel-export-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.admin-app .excel-export-ring,
.admin-app .excel-export-ring[hidden] {
  display: none !important;
  width: 18px;
  height: 18px;
  margin-inline-end: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}

.admin-app .excel-export.is-running .excel-export-icon {
  display: none;
}

.admin-app .excel-export.is-running .excel-export-ring {
  display: inline-block !important;
}

.admin-app .excel-export-ring-track,
.admin-app .excel-export-ring-value {
  fill: none;
  stroke-width: 3;
}

.admin-app .excel-export-ring-track {
  stroke: rgba(74, 70, 63, 0.25);
}

.admin-app .excel-export-ring-value {
  stroke: var(--admin-accent);
  stroke-linecap: round;
  transform-origin: 18px 18px;
  transform: rotate(-90deg);
  /* radius = 15, circumference = 2 * π * radius = 94.248 */
  stroke-dasharray: 94.248;
  /*
   * stroke-dashoffset controls how much of the ring is visible.
   * JS formula: offset = 94.248 * (1 - percent / 100)
   *
   *   Progress | stroke-dashoffset
   *   ---------|------------------
   *   0%       | 94.248  (hidden)
   *   25%      | 70.686
   *   50%      | 47.124  (half circle)
   *   75%      | 23.562
   *   100%     | 0       (full circle)
   */
  stroke-dashoffset: 94.248;
}

.admin-app .btn-primary.excel-export .excel-export-ring-track {
  stroke: rgba(255, 255, 255, 0.35);
}

.admin-app .btn-primary.excel-export .excel-export-ring-value {
  stroke: #fff;
}

.admin-app .excel-export.is-indeterminate .excel-export-ring-value {
  animation: excel-export-spin 0.8s linear infinite;
}

.admin-app .excel-export-error {
  display: none;
  margin: 0;
  font-size: 12px;
}

.admin-app .excel-export-error.is-visible {
  display: block;
}

@keyframes excel-export-spin {
  to {
    transform: rotate(270deg);
  }
}

/* Coupons — code pill, scope opts, tags, usage bar */
.admin-app .coupon-code {
  font-family: ui-monospace, Menlo, monospace;
  font-weight: 700;
  letter-spacing: 0.5px;
  background: #F3F0E9;
  border: 1px dashed #CFC8BA;
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 13px;
}

.admin-app .coupons-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 16px;
}

.admin-app .coupon-sec {
  /* Make the section heading span all grid columns (full width). */
  grid-column: 1 / -1;
  font-size: 13px;
  font-weight: 700;
  color: #2E4B3C;
  margin: 4px 0 -4px;
}

.admin-app .coupon-sfx {
  position: relative;
}

.admin-app .coupon-sfx .input,
.admin-app .coupon-sfx .form-control {
  padding-inline-start: 48px;
}

.admin-app .coupon-sfx span {
  position: absolute;
  inset-inline-start: 12px;
  top: 11px;
  color: #6B655B;
  font-size: 13.5px;
  pointer-events: none;
}

.admin-app .coupons-scope-opts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.admin-app .coupon-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid #DCD6CA;
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #3D3932;
  text-align: start;
}

.admin-app .coupon-opt-on {
  border-color: #2E4B3C;
  background: #F1F6F2;
  color: #213A2D;
  box-shadow: inset 0 0 0 1px #2E4B3C;
}

.admin-app .coupon-opt i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #B5AEA2;
  display: block;
  flex-shrink: 0;
}

.admin-app .coupon-opt-on i {
  border: 5px solid #2E4B3C;
}

.admin-app .coupon-tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.admin-app .coupon-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 6px 0 12px;
  border-radius: 8px;
  background: #F3F0E9;
  font-size: 13px;
}

.admin-app .coupon-tag__x {
  border: 0;
  background: transparent;
  color: #6B655B;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}

.admin-app .coupon-picker-results {
  margin-top: 6px;
  border: 1px solid #E6E1D7;
  border-radius: 10px;
  background: #fff;
  max-height: 180px;
  overflow: auto;
}

.admin-app .coupon-picker-item {
  display: block;
  width: 100%;
  text-align: start;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  font-size: 13.5px;
  cursor: pointer;
}

.admin-app .coupon-picker-item.is-active,
.admin-app .coupon-picker-item:hover {
  background: #F6F3EC;
}

.admin-app .coupon-usage {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.admin-app .coupon-usage__track {
  height: 6px;
  background: #F0ECE4;
  border-radius: 99px;
  overflow: hidden;
}

.admin-app .coupon-usage__bar {
  height: 6px;
  background: #2E4B3C;
}

@media (max-width: 767.98px) {
  .admin-app .coupons-form-grid,
  .admin-app .coupons-scope-opts {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------------------
   Content Pages (صفحات المحتوى) — prototype two-pane editor
   ------------------------------------------------------------------------- */
.admin-app .cp-layout {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-app .cp-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-app .cp-grp {
  font-size: 11.5px;
  font-weight: 700;
  color: #6B655B;
  padding: 4px 4px 0;
}

.admin-app .cp-pgi {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #E6E1D7;
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: right;
  width: 100%;
  text-decoration: none;
  color: inherit;
}

.admin-app .cp-pgi:hover {
  color: inherit;
  text-decoration: none;
}

.admin-app .cp-pgi-on {
  border-color: #2E4B3C;
  background: #F1F6F2;
  box-shadow: inset 0 0 0 1px #2E4B3C;
}

.admin-app .cp-pgi__icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.admin-app .cp-pgi__icon--pages {
  background: #E7EEE8;
  color: #2E4B3C;
}

.admin-app .cp-pgi__icon--sections {
  background: #FBF1E1;
  color: #7A4A0C;
}

.admin-app .cp-pgi__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.admin-app .cp-pgi__name {
  font-size: 14px;
  font-weight: 700;
  color: #1E1C18;
}

.admin-app .cp-pgi__meta {
  font-size: 11.5px;
}

.admin-app .cp-editor {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border: 1px solid #E6E1D7;
  border-radius: 14px;
  /* No overflow:hidden — absolute .cp-menu under Insert must paint outside the card */
}

.admin-app .cp-editor__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #EFEBE3;
}

.admin-app .cp-editor__title {
  font-size: 17px;
  font-weight: 700;
}

.admin-app .cp-editor__sub {
  font-size: 12.5px;
  margin-top: 2px;
}

.admin-app .cp-editor__body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  min-height: 0;
}

.admin-app .cp-editor__fields {
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex-grow: 1;
}

.admin-app .cp-editor__foot {
  display: flex;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid #EFEBE3;
}

.admin-app .cp-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid #DCD6CA;
  background: #fff;
  color: #1E1C18;
  text-decoration: none;
  cursor: pointer;
}

.admin-app .cp-btn-ghost:hover {
  background: #F6F3EC;
  color: #1E1C18;
  text-decoration: none;
}

.admin-app .cp-lbl {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3D3932;
  margin-bottom: 6px;
}

.admin-app .cp-f2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.admin-app .cp-ta {
  min-height: 96px;
  line-height: 1.8;
  resize: vertical;
}

.admin-app .cp-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: #6B655B;
  background: #FAF8F3;
  border: 1px dashed #DCD6CA;
  border-radius: 10px;
  padding: 8px 12px;
}

.admin-app .cp-repeater__grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-app .cp-it {
  border: 1px solid #E6E1D7;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #fff;
}

.admin-app .cp-it__h {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-app .cp-it__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 14px;
}

.admin-app .cp-num-b {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #F3F0E9;
  color: #4A463F;
  font-size: 12.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.admin-app .cp-ico {
  flex-shrink: 0;
}

.admin-app .cp-ins {
  position: relative;
  display: inline-flex;
}

.admin-app .cp-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 6px);
  right: 0;
  min-width: 200px;
  background: #fff;
  border: 1px solid #E6E1D7;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(30, 28, 24, .18);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.admin-app .cp-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  font-weight: 600;
  color: #1E1C18;
  cursor: pointer;
  text-align: right;
}

.admin-app .cp-menu button:hover {
  background: #F1F6F2;
}

.admin-app .cp-media {
  display: flex;
  flex-direction: column;
  gap: 10px;
  border: 1px solid #E6E1D7;
  border-radius: 12px;
  padding: 12px;
  background: #FAF8F3;
}

.admin-app .cp-media__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-app .cp-chip {
  display: inline-flex;
  align-items: center;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: #E7EEE8;
  color: #2E4B3C;
  font-size: 12.5px;
  font-weight: 700;
}

.admin-app .cp-linkb {
  border: 0;
  background: transparent;
  color: #B42318;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.admin-app .cp-icon-upload {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.admin-app .cp-icon-upload__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px dashed #DCD6CA;
  border-radius: 10px;
  background: #FAF8F3;
  font-size: 12.5px;
  font-weight: 600;
  color: #3D3932;
  cursor: pointer;
  margin: 0;
}

.admin-app .cp-field--icon .form-group {
  margin-bottom: 0;
}

.admin-app .muted {
  color: #6B655B;
}

/* Visitor message — previous replies list */
.admin-app .vm-replies__list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.admin-app .vm-reply-card {
  background: var(--admin-bg, #fff);
}

.admin-app .vm-reply-card__head {
  padding: 10px 14px;
}

.admin-app .vm-reply-card__head h2 {
  font-size: 14px;
}

.admin-app .vm-reply-card__body {
  font-size: 14px;
  line-height: 1.55;
}

.admin-app .vm-reply-card__content p:last-child {
  margin-bottom: 0;
}

@media (max-width: 991.98px) {
  .admin-app .cp-layout {
    grid-template-columns: 1fr;
  }

  .admin-app .cp-f2,
  .admin-app .cp-repeater__grid {
    grid-template-columns: 1fr;
  }
}
