/* =========================================================
   SELECTION CART (drawer + card controls) + ORDERS + ADMIN
   ========================================================= */

/* ---------- Header cart button ---------- */
.aamg-header__cart {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff;
  cursor: pointer; font-size: 17px; transition: background .3s ease, border-color .3s ease;
}
.aamg-header__cart:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.5); color: #fff; }
.aamg-cart-badge {
  position: absolute; top: -7px; right: -7px; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: #ee1c25; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: 0 0 0 2px #182638; transition: transform .25s ease;
}
.aamg-cart-badge.is-empty { display: none; }

/* ---------- Card controls ---------- */
.aamg-pub-card { transition: transform .35s, box-shadow .35s, border-color .35s, background .35s; }
.aamg-pub-card.is-selected { border-color: #ee1c25; box-shadow: 0 0 0 1px #ee1c25 inset, 0 18px 36px rgba(238,28,37,.10); }
.aamg-pub-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.aamg-pub-order { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; cursor: pointer; }
.aamg-pub-order.is-added { color: #1a8f4a; }
.aamg-pub-order.is-added i { font-size: 11px; }
.aamg-pub-check { position: relative; display: inline-flex; margin: 0; cursor: pointer; }
.aamg-pub-check input { position: absolute; opacity: 0; width: 0; height: 0; }
.aamg-pub-check span {
  width: 20px; height: 20px; border: 2px solid #ee1c25; border-radius: 3px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; transition: background .2s ease, transform .2s ease;
}
.aamg-pub-check span::after {
  content: ""; width: 6px; height: 11px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform .2s ease; margin-top: -2px;
}
.aamg-pub-check input:checked + span { background: #ee1c25; }
.aamg-pub-check input:checked + span::after { transform: rotate(45deg) scale(1); }
.aamg-pub-check input:focus-visible + span { outline: 2px solid #182638; outline-offset: 2px; }
.aamg-pub-check:hover span { transform: scale(1.08); }
.aamg-cat-grid.is-list-view .aamg-pub-actions { grid-column: 2; grid-row: 2; justify-content: flex-end; gap: 16px; }
.aamg-pub-url { text-decoration: none; }
.aamg-pub-url:hover { text-decoration: underline; color: #b8121a; }

/* ---------- Drawer ---------- */
.aamg-cart-overlay {
  position: fixed; inset: 0; z-index: 1900; background: rgba(16,24,40,.55); backdrop-filter: blur(2px);
  opacity: 0; visibility: hidden; transition: opacity .3s ease, visibility .3s ease;
}
.aamg-cart-overlay.is-open { opacity: 1; visibility: visible; }
.aamg-cart {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1950; width: 420px; max-width: 94vw;
  background: #fff; color: #101827; border-left: 4px solid #ee1c25; box-shadow: -20px 0 60px rgba(0,0,0,.25);
  display: flex; flex-direction: column; transform: translateX(105%); transition: transform .4s cubic-bezier(.2,.8,.2,1);
}
.aamg-cart.is-open { transform: translateX(0); }
body.aamg-cart-open { overflow: hidden; }

.aamg-cart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid #e6e9ee; background: #182638; color: #fff; }
.aamg-cart-eyebrow { display: block; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: #ff7a80; font-weight: 600; margin-bottom: 4px; }
.aamg-cart-title { font-size: 19px; font-weight: 700; margin: 0; display: flex; align-items: center; gap: 10px; }
.aamg-cart-count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 26px; padding: 0 8px; border-radius: 13px; background: #ee1c25; color: #fff; font-size: 13px; font-weight: 700; }
.aamg-cart-close { width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.25); background: transparent; color: #fff; font-size: 16px; cursor: pointer; transition: background .25s ease; flex-shrink: 0; }
.aamg-cart-close:hover { background: rgba(255,255,255,.1); }

.aamg-cart-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 18px; }
.aamg-cart-item { display: flex; align-items: center; gap: 14px; padding: 12px; border: 1px solid #ececec; background: #fff; margin-bottom: 10px; position: relative; animation: aamgCartIn .3s ease both; }
@keyframes aamgCartIn { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }
.aamg-cart-item-logo { width: 74px; height: 56px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; background: #f6f7fb; border: 1px solid #ececec; }
.aamg-cart-item-logo img { max-width: 60px; max-height: 40px; }
.aamg-cart-item-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.aamg-cart-item-type { font-size: 9px; letter-spacing: .4px; text-transform: uppercase; color: #e3182b; font-weight: 600; }
.aamg-cart-item-name { font-size: 15px; font-weight: 600; color: #12131a; line-height: 1.25; }
.aamg-cart-item-url { font-size: 11px; color: #6b7280; word-break: break-all; }
.aamg-cart-item-price { font-size: 13px; color: #111; margin-top: 4px; font-weight: 500; }
.aamg-cart-item-remove { width: 30px; height: 30px; border: 1px solid #e6e9ee; background: #fff; color: #8b93a1; cursor: pointer; border-radius: 50%; font-size: 12px; transition: all .25s ease; flex-shrink: 0; }
.aamg-cart-item-remove:hover { border-color: #ee1c25; color: #ee1c25; background: #fdecec; }

.aamg-cart-empty { text-align: center; padding: 40px 28px; color: #5b6472; }
.aamg-cart-empty i { font-size: 40px; color: #c9ced7; display: block; margin-bottom: 12px; }
.aamg-cart-empty p { font-size: 16px; font-weight: 600; color: #101827; margin: 0 0 6px; }
.aamg-cart-empty span { display: block; font-size: 14px; margin-bottom: 18px; }
.aamg-cart-browse { border-radius: 4px; padding: 11px 24px; font-size: 14px; }

.aamg-cart-foot { padding: 16px 20px 20px; border-top: 1px solid #e6e9ee; background: #f6f7fb; }
.aamg-cart-note { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.45; color: #5b6472; margin: 0 0 14px; }
.aamg-cart-note i { color: #ee1c25; margin-top: 2px; }
.aamg-cart-checkout { width: 100%; border-radius: 4px; }
.aamg-cart-clear { display: block; width: 100%; margin-top: 10px; border: 0; background: transparent; color: #8b93a1; font-size: 13px; cursor: pointer; font-family: inherit; }
.aamg-cart-clear:hover { color: #ee1c25; text-decoration: underline; }

/* ---------- Toast ---------- */
.aamg-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 2100; transform: translate(-50%, 20px);
  background: #182638; color: #fff; padding: 12px 18px; border-radius: 4px; font-size: 14px;
  box-shadow: 0 14px 30px rgba(0,0,0,.3); opacity: 0; visibility: hidden; transition: all .3s ease;
}
.aamg-toast.is-show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.aamg-toast.is-error { background: #b8121a; }

/* ---------- Status badges ---------- */
.aamg-status { display: inline-block; padding: 4px 11px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; background: #eef1f5; color: #344054; }
.aamg-status.is-pending   { background: #fff6e5; color: #8a5a00; }
.aamg-status.is-quoted    { background: #e8f0fe; color: #1a4fb3; }
.aamg-status.is-approved  { background: #e9f8ef; color: #156b3a; }
.aamg-status.is-progress  { background: #f1e9fe; color: #5b2bb3; }
.aamg-status.is-done      { background: #e9f8ef; color: #156b3a; }
.aamg-status.is-cancelled { background: #fdecec; color: #9b1116; }

/* ---------- Tables ---------- */
.aamg-table-wrap { overflow-x: auto; }
.aamg-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.aamg-table th { text-align: left; font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: #5b6472; font-weight: 600; padding: 10px 12px; border-bottom: 2px solid #e6e9ee; white-space: nowrap; }
.aamg-table td { padding: 13px 12px; border-bottom: 1px solid #eef1f5; vertical-align: middle; color: #101827; }
.aamg-table tr:last-child td { border-bottom: 0; }
.aamg-table tbody tr:hover td { background: #fafbfc; }
.aamg-table .is-right { text-align: right; }
.aamg-table .is-muted { color: #6b7280; font-size: 12.5px; }
.aamg-table a.aamg-row-link { color: #182638; font-weight: 600; text-decoration: none; }
.aamg-table a.aamg-row-link:hover { color: #ee1c25; }
.aamg-table-sub { display: block; font-size: 12px; color: #6b7280; margin-top: 2px; }

/* ---------- Order detail ---------- */
.aamg-order-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.aamg-order-head h1 { font-size: 24px; font-weight: 700; margin: 0 0 4px; color: #101827; }
.aamg-order-head p { margin: 0; color: #5b6472; font-size: 14px; }
.aamg-order-total { display: flex; justify-content: flex-end; align-items: baseline; gap: 14px; padding: 14px 12px 0; font-size: 15px; color: #5b6472; }
.aamg-order-total strong { font-size: 22px; color: #101827; }
.aamg-order-note { background: #f6f7fb; border-left: 3px solid #ee1c25; padding: 14px 16px; font-size: 14px; line-height: 1.55; color: #344054; white-space: pre-line; }
.aamg-order-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 18px; }
.aamg-order-actions .aamg-btn { border-radius: 4px; }

/* Quote input in admin */
.aamg-quote-input { width: 130px; height: 40px; border: 1px solid #dfe2e8; border-radius: 4px; padding: 0 12px; font-size: 14px; text-align: right; font-family: inherit; }
.aamg-quote-input:focus { outline: 0; border-color: #ee1c25; box-shadow: 0 0 0 3px rgba(238,28,37,.12); }
.aamg-select { height: 44px; border: 1px solid #dfe2e8; border-radius: 4px; padding: 0 12px; font-size: 14px; font-family: inherit; background: #fff; width: 100%; }
.aamg-textarea { width: 100%; min-height: 96px; border: 1px solid #dfe2e8; border-radius: 4px; padding: 12px; font-size: 14px; font-family: inherit; resize: vertical; }
.aamg-textarea:focus, .aamg-select:focus { outline: 0; border-color: #ee1c25; box-shadow: 0 0 0 3px rgba(238,28,37,.12); }
.aamg-form-label { display: block; font-size: 13px; font-weight: 600; color: #344054; margin-bottom: 6px; }
.aamg-form-group { margin-bottom: 16px; }

/* Filter pills */
.aamg-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.aamg-pills a { display: inline-block; padding: 7px 14px; border-radius: 20px; border: 1px solid #e6e9ee; background: #fff; color: #344054; font-size: 13px; font-weight: 500; text-decoration: none; transition: all .25s ease; }
.aamg-pills a:hover { border-color: #ee1c25; color: #ee1c25; }
.aamg-pills a.is-active { background: #182638; border-color: #182638; color: #fff; }

/* Checkout */
.aamg-checkout { background: #f3f5f8; color: #101827; padding: 40px 0 70px; }
.aamg-checkout-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; align-items: start; }
.aamg-checkout-side { position: sticky; top: 96px; }
.aamg-checkout-step { display: flex; align-items: center; gap: 10px; font-size: 13px; color: #5b6472; margin-bottom: 20px; }
.aamg-checkout-step span { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; border-radius: 50%; background: #ee1c25; color: #fff; font-size: 12px; font-weight: 700; }
.aamg-checkout-item { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-bottom: 1px solid #eef1f5; }
.aamg-checkout-item:last-child { border-bottom: 0; }

/* Admin dashboard extras */
.aamg-dash-stat.is-accent .aamg-dash-stat-icon { background: rgba(26,79,179,.1); color: #1a4fb3; }
.aamg-dash-stat.is-success .aamg-dash-stat-icon { background: rgba(21,107,58,.1); color: #156b3a; }
.aamg-dash-stat.is-warn .aamg-dash-stat-icon { background: rgba(138,90,0,.1); color: #8a5a00; }

@media (max-width: 991px) {
  .aamg-checkout-grid { grid-template-columns: 1fr; }
  .aamg-checkout-side { position: static; }
}
@media (max-width: 575px) {
  .aamg-cart { width: 100%; max-width: 100%; border-left: 0; }
  .aamg-order-total { justify-content: space-between; }
}

/* ---------- Dynamic catalog ---------- */
.aamg-cat-search { position: relative; margin-bottom: 26px; }
.aamg-cat-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #8b93a1; font-size: 13px; }
.aamg-cat-search input { width: 100%; height: 40px; border: 1px solid #e3e3e3; padding: 0 12px 0 34px; font-size: 14px; font-family: inherit; background: #fff; }
.aamg-cat-search input:focus { outline: 0; border-color: #ff0a1f; }
.aamg-cat-group:not(.is-expanded) > label:nth-of-type(n+4), .aamg-cat-group:not(.is-expanded) .aamg-cat-sol li:nth-child(n+6) { display: none; }
.aamg-cat-cnt { margin-left: auto; font-size: 11px; color: #9aa1ad; }
.aamg-cat-group label:hover .aamg-cat-cnt { color: #ff0a1f; }
.aamg-cat-sol a.is-active { color: #ff0a1f; font-weight: 600; }
.aamg-cat-sol a.is-active::after { content: "\f00c"; font-family: "Font Awesome 6 Free"; font-weight: 900; font-size: 10px; margin-left: auto; }
.aamg-cat-reset { opacity: .45; pointer-events: none; transition: opacity .3s; }
.aamg-cat-reset.is-visible { opacity: 1; pointer-events: auto; }
.aamg-cat-sort button { position: relative; }
.aamg-cat-sort .aamg-sort-dir { font-size: 10px; margin-left: 3px; transform: rotate(90deg); display: inline-block; opacity: .5; }
.aamg-cat-sort button[data-dir="desc"] .aamg-sort-dir { transform: rotate(-90deg); opacity: 1; }
.aamg-cat-sort button[data-dir="asc"] .aamg-sort-dir { opacity: 1; }
.aamg-cat-summary { font-size: 13px; color: #6b7280; margin-right: 6px; font-weight: 400; }
.aamg-cat.is-loading .aamg-cat-grid { opacity: .45; pointer-events: none; transition: opacity .2s; }
.aamg-cat-grid { transition: opacity .25s; }
.aamg-pub-logo-img { max-width: 80%; max-height: 62px; object-fit: contain; }
.aamg-pub-logo-text { font-size: 20px; font-weight: 700; color: #182638; text-align: center; padding: 0 10px; }
.aamg-cat-empty { text-align: center; padding: 60px 20px; color: #5b6472; background: #fff; border: 1px dashed #d9dde3; }
.aamg-cat-empty i { font-size: 38px; color: #c9ced7; display: block; margin-bottom: 12px; }
.aamg-cat-empty p { font-size: 16px; font-weight: 600; color: #101827; margin: 0 0 16px; }
.aamg-cat-empty .aamg-btn { border-radius: 4px; }
.aamg-cat-pages { display: flex; justify-content: center; align-items: center; gap: 6px; margin-top: 34px; flex-wrap: wrap; }
.aamg-cat-pages button { min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid #e3e3e3; background: #fff; color: #333; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .25s; }
.aamg-cat-pages button:hover:not(:disabled) { border-color: #ff0a1f; color: #ff0a1f; }
.aamg-cat-pages button.is-active { background: #182638; border-color: #182638; color: #fff; }
.aamg-cat-pages button:disabled { opacity: .4; cursor: default; }
.aamg-cat-pages span { color: #9aa1ad; padding: 0 4px; }

/* ---------- Admin: publications & filters ---------- */
.aamg-admin-logo { width: 64px; height: 44px; display: flex; align-items: center; justify-content: center; background: #f6f7fb; border: 1px solid #ececec; color: #c9ced7; }
.aamg-admin-logo img { max-width: 56px; max-height: 36px; object-fit: contain; }
.aamg-row-actions { display: inline-flex; align-items: center; gap: 6px; }
.aamg-icon-btn { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #e6e9ee; background: #fff; color: #5b6472; border-radius: 4px; cursor: pointer; font-size: 13px; text-decoration: none; transition: all .2s; }
.aamg-icon-btn:hover { border-color: #182638; color: #182638; }
.aamg-icon-btn.is-danger:hover { border-color: #ee1c25; color: #ee1c25; background: #fdecec; }
.aamg-check { display: flex; align-items: center; gap: 8px; font-size: 14px; color: #344054; cursor: pointer; margin: 0 0 8px; }
.aamg-check input { width: 16px; height: 16px; accent-color: #ee1c25; margin: 0; }
.aamg-check.is-muted { opacity: .55; }
.aamg-filter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px 22px; }
.aamg-filter-set { border: 0; padding: 0; margin: 0; min-width: 0; }
.aamg-filter-set legend { font-size: 13px; font-weight: 700; color: #101827; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; padding: 0; }
.aamg-logo-drop { position: relative; border: 2px dashed #d9dde3; border-radius: 6px; background: #f9fafb; min-height: 170px; display: flex; align-items: center; justify-content: center; text-align: center; transition: border-color .25s, background .25s; }
.aamg-logo-drop.is-over { border-color: #ee1c25; background: #fff5f5; }
.aamg-logo-drop input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.aamg-logo-preview { padding: 20px; }
.aamg-logo-preview img { max-width: 220px; max-height: 110px; object-fit: contain; }
.aamg-logo-placeholder { padding: 24px 18px; color: #5b6472; }
.aamg-logo-placeholder i { font-size: 30px; color: #c9ced7; display: block; margin-bottom: 10px; }
.aamg-logo-placeholder p { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: #101827; }
.aamg-logo-placeholder p span { color: #ee1c25; text-decoration: underline; }
.aamg-logo-placeholder small { font-size: 12px; }
.aamg-filter-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 18px; }
.aamg-filter-card.is-muted { opacity: .6; }
.aamg-inline-rename { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; min-width: 0; }
.aamg-rename-input { flex: 1 1 auto; min-width: 0; height: 32px; border: 1px solid transparent; background: transparent; padding: 0 6px; font-size: 14px; font-weight: 500; color: #101827; font-family: inherit; border-radius: 4px; }
.aamg-dash-card-head .aamg-rename-input { font-size: 17px; font-weight: 700; }
.aamg-rename-input:hover { border-color: #e6e9ee; background: #fff; }
.aamg-rename-input:focus { outline: 0; border-color: #ee1c25; background: #fff; }
.aamg-option-list { list-style: none; margin: 0 0 14px; padding: 0; }
.aamg-option-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid #f0f2f5; }
.aamg-option-list li.is-muted { opacity: .5; }
.aamg-opt-icon { width: 16px; text-align: center; color: #e6a817; font-size: 12px; }
.aamg-opt-count { font-size: 11px; color: #6b7280; background: #f3f5f8; padding: 2px 8px; border-radius: 10px; min-width: 26px; text-align: center; }
.aamg-add-option { display: flex; gap: 8px; }
.aamg-add-option .aamg-select { height: 42px; }
@media (max-width: 575px) { .aamg-filter-admin { grid-template-columns: 1fr; } .aamg-cat-summary { display: none; } }
