@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary:     #0B1F3A;
  --accent:      #1B6CA8;
  --accent-lt:   #F0F6FF;
  --green:       #178C3D;
  --green-lt:    #E8F6ED;
  --green-bg:    #EAF6EE;
  --red:         #DC2626;
  --border:      #E2E8F0;
  --bg:          #FFFFFF;
  --panel:       #FFFFFF;
  --text:        #1A2332;
  --muted:       #64748B;
  --radius:      8px;
  --trans:       transform .22s ease, box-shadow .22s ease, border-color .22s ease, opacity .22s ease;
  --trans-color: background-color .28s ease, border-color .28s ease, color .28s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

#dpos-wrap {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  max-width: 1140px;
  margin: 0 auto;
  padding: 30px 20px;
}

/* ── Header ──────────────────────────────────────────────────────── */
.dpos-header-wrap { padding-bottom: 24px; }
.dpos-header-title { font-size: 28px; font-weight: 800; color: var(--primary); margin-bottom: 8px; }
.dpos-header-sub { font-size: 13px; color: var(--muted); }

/* ── Brand strip ──────────────────────────────────────────────────── */
.dpos-brand-strip-wrap { margin-bottom: 30px; }
.dpos-brand-strip { display: flex; gap: 12px; flex-wrap: wrap; }
.dpos-brand-card {
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  padding: 14px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--panel);
  cursor: pointer; transition: var(--trans); width: 115px; height: 115px;
  position: relative; will-change: transform;
}
.dpos-brand-card:hover {
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(27,108,168,.14);
  transform: translateY(-4px) scale(1.03);
}
.dpos-brand-card:active { transform: scale(0.97); }
.dpos-brand-card.active {
  border-color: var(--accent); border-width: 2px; padding: 13px 9px;
  background: var(--accent-lt);
  box-shadow: 0 0 0 3px rgba(27,108,168,.12);
}
.dpos-brand-card.active::after {
  content: '✓'; position: absolute; top: -8px; right: -8px;
  width: 22px; height: 22px; background: var(--accent); color: #fff;
  border-radius: 50%; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.dpos-brand-img { width: 100%; height: 50px; object-fit: contain; margin-bottom: 8px; }
.dpos-brand-img-placeholder {
  width: 100%; height: 50px; background: var(--accent-lt);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; border-radius: 4px; color: var(--accent); font-weight: 700; margin-bottom: 8px;
}
.dpos-brand-name { font-size: 12px; font-weight: 700; color: var(--text); text-align: center; line-height: 1.2; }

/* ── Main layout ──────────────────────────────────────────────────── */
.dpos-main {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 32px;
  align-items: flex-start;
}

/* ── Steps Column ─────────────────────────────────────────────────── */
.dpos-steps-col { display: flex; flex-direction: column; gap: 24px; }
.dpos-step { display: flex; gap: 0; align-items: flex-start; }
.dpos-step-inline { align-items: center; }
.dpos-step-inline .dpos-step-body { display: flex; align-items: center; gap: 14px; flex: 1; flex-wrap: wrap; }
.dpos-step-inline .dpos-step-label { margin-bottom: 0; min-width: 130px; }
.dpos-step-num { display: none !important; }
.dpos-step-inline .dpos-step-num { display: none !important; }
.dpos-step-body { flex: 1; min-width: 0; }
.dpos-step-label { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.dpos-step-sub { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ── Step reveal animation ───────────────────────────────────────── */
@keyframes dpos-step-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.dpos-step-entering {
  animation: dpos-step-in .32s cubic-bezier(.25,.46,.45,.94) both;
}

/* Form Elements */
.dpos-select-wrap { position: relative; }
.dpos-text-input, .dpos-select {
  width: 100%; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--text); background: var(--bg); outline: none;
  transition: var(--trans-color), box-shadow .22s ease;
}
.dpos-select {
  appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%2364748B' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.dpos-select:focus, .dpos-text-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27,108,168,.12); }
.dpos-select:disabled { opacity: .6; cursor: not-allowed; }

/* Expiry row - Eye-catching Calendar Inputs */
.dpos-exp-row { display: flex; gap: 15px; align-items: center; background: #f8fafc; padding: 15px; border-radius: 12px; border: 1px solid var(--border); flex-wrap: wrap; }
.dpos-exp-field { flex: 1; min-width: 130px; }
.dpos-exp-field label { font-weight: 700; color: var(--primary); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; display: block; }
.dpos-exp-field .dpos-select-wrap select { background-color: #fff; border: 2px solid var(--border); box-shadow: 0 2px 4px rgba(0,0,0,0.02); font-weight: 600; color: var(--text); padding: 12px 14px; }
.dpos-exp-field .dpos-select-wrap select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(27, 108, 168, 0.15); }
.dpos-exp-hint { flex: 1.5; display: flex; align-items: center; background: var(--accent-lt); padding: 12px 15px; border-radius: var(--radius); color: var(--accent); font-size: 12px; line-height: 1.4; min-width: 180px; }
.dpos-hint-icon { font-size: 20px; margin-right: 10px; }

/* Eye-catching condition button */
.dpos-condition-row { width: 100%; }
.dpos-condition-btn { display: block; cursor: pointer; margin-top: 5px; width: 100%; }
.dpos-condition-btn-inner {
  display: flex; align-items: center; padding: 16px; border: 2px solid var(--border);
  border-radius: 12px; background: #fff;
  transition: var(--trans), background-color .28s ease, border-color .28s ease;
  position: relative; overflow: hidden;
}
.dpos-condition-btn-inner::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 4px; background: var(--green); border-radius: 2px 0 0 2px;
  transform: scaleY(0); transition: transform .28s cubic-bezier(.34,1.56,.64,1);
  transform-origin: center;
}
.dpos-condition-btn:hover .dpos-condition-btn-inner { border-color: #bbd3ea; box-shadow: 0 4px 15px rgba(0,0,0,0.05); transform: translateY(-2px); }
.dpos-condition-icon { font-size: 24px; margin-right: 15px; filter: grayscale(100%); opacity: 0.6; transition: var(--trans); }
.dpos-condition-text { flex: 1; }
.dpos-condition-text strong { display: block; font-size: 15px; color: var(--primary); margin-bottom: 2px; }
.dpos-condition-text small { display: block; font-size: 11px; color: var(--muted); }
.dpos-condition-check-circle {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans), var(--trans-color); flex-shrink: 0;
}
.dpos-condition-check-circle::after {
  content: '✓'; color: white; font-size: 14px; font-weight: bold; opacity: 0; transform: scale(0.5); transition: var(--trans);
}

#dpos-condition-fresh:checked + .dpos-condition-btn-inner {
  border-color: var(--green);
  background: linear-gradient(135deg, #d4edda 0%, #eaf6ee 100%);
  box-shadow: 0 6px 20px rgba(23,140,61,.16);
}
#dpos-condition-fresh:checked + .dpos-condition-btn-inner::before { transform: scaleY(1); }
#dpos-condition-fresh:checked + .dpos-condition-btn-inner .dpos-condition-icon {
  filter: grayscale(0%); opacity: 1; transform: scale(1.2) rotate(-5deg);
}
#dpos-condition-fresh:checked + .dpos-condition-btn-inner .dpos-condition-check-circle { background: var(--green); border-color: var(--green); }
#dpos-condition-fresh:checked + .dpos-condition-btn-inner .dpos-condition-check-circle::after { opacity: 1; transform: scale(1); }

/* Price guide table */
.dpos-price-guide-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dpos-price-guide { width: 100%; border-collapse: collapse; font-size: 13px; }
.dpos-price-guide th {
  text-align: left; padding: 10px 14px;
  font-size: 11px; font-weight: 700; color: var(--primary);
  border-bottom: 1px solid var(--border); background: #F9FAFB;
}
.dpos-price-guide td { padding: 12px 14px; border-bottom: 1px solid var(--border); transition: background-color .35s ease; }
.dpos-price-guide tr:last-child td { border-bottom: none; }
.dpos-guide-row-active td { background: #dcfce7 !important; }
.dpos-guide-row-active > td:first-child { border-left: 3px solid var(--green) !important; }
.dpos-guide-row-error td { background: #fee2e2 !important; }
.dpos-guide-row-error > td:first-child { border-left: 3px solid var(--red) !important; }
.dpos-tier-badge {
  display: inline-block; padding: 4px 8px; border-radius: 99px; font-size: 10px; font-weight: 700; text-transform: uppercase;
}
.dpos-tier-badge.best { background: var(--green); color: #fff; }
.dpos-tier-badge.good { background: #E2E8F0; color: var(--muted); }
.dpos-tier-badge.fair { background: #E2E8F0; color: var(--muted); }
.dpos-tier-badge.error { background: var(--red); color: #fff; }
.dpos-guide-price { font-size: 15px; font-weight: 700; color: var(--text); }
.dpos-guide-note { font-size: 11px; color: var(--muted); padding: 10px 14px; background: #F9FAFB; margin: 0; border-top: 1px solid var(--border); }

/* ── Price pop animation ──────────────────────────────────────────── */
@keyframes dpos-price-pop {
  0%   { transform: scale(0.88); opacity: 0.4; }
  60%  { transform: scale(1.06); opacity: 1;   }
  100% { transform: scale(1);    opacity: 1;   }
}
.dpos-price-popping {
  animation: dpos-price-pop .38s cubic-bezier(.34,1.56,.64,1) both;
}

/* ── Spinner ──────────────────────────────────────────────────────── */
@keyframes dpos-spin {
  to { transform: rotate(360deg); }
}
.dpos-add-product-btn.dpos-btn-loading .dpos-add-btn-icon {
  display: inline-block;
  animation: dpos-spin .65s linear infinite;
}

/* ── Cart item remove animation ──────────────────────────────────── */
@keyframes dpos-item-out {
  0%   { opacity: 1; max-height: 100px; padding-bottom: 12px; margin-bottom: 0; }
  100% { opacity: 0; max-height: 0;     padding-bottom: 0;    margin-bottom: -12px; }
}
.dpos-cart-item-removing {
  overflow: hidden;
  animation: dpos-item-out .3s ease forwards;
  pointer-events: none;
}

/* Dynamic Price Box */
.dpos-your-price-box {
  background: var(--green-bg); border-radius: var(--radius); padding: 14px 20px;
  flex: 1; display: flex; flex-direction: column; justify-content: center; min-width: 180px;
  transition: background-color .3s ease;
}
.dpos-your-price-box.no-price { background: #F1F5F9; }
.dpos-your-price-amount { font-size: 26px; font-weight: 800; color: var(--green); margin-bottom: 4px; display: inline-block; }
.dpos-your-price-box.no-price .dpos-your-price-amount { color: var(--muted); font-size: 18px; margin-bottom: 0; }
.dpos-your-price-note { font-size: 11px; color: var(--green); font-weight: 500; display: flex; align-items: center; gap: 4px; }

/* Qty */
.dpos-qty-row { display: flex; gap: 8px; align-items: center; }
.dpos-qty-btn {
  width: 36px; height: 36px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg);
  font-size: 18px; font-weight: 400; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans), var(--trans-color);
}
.dpos-qty-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-lt); }
#dpos-qty {
  width: 50px; text-align: center; padding: 8px; height: 36px;
  border: 1px solid var(--border); border-radius: 6px; font-weight: 700; outline: none; font-size: 14px;
}

/* Add product */
.dpos-step-add .dpos-step-body { flex-direction: column; align-items: flex-start; gap: 10px; }
.dpos-add-product-btn {
  width: 100%; padding: 14px; border-radius: var(--radius);
  background: var(--primary); color: #fff; border: none;
  font-family: inherit; font-size: 15px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dpos-add-product-btn:hover:not(:disabled) { background: #132d52; }
.dpos-add-product-btn:disabled { opacity: .5; cursor: not-allowed; }
.dpos-add-more-wrap { margin-top: 10px; padding-left: 0; }
.dpos-add-more-btn {
  width: 100%; padding: 12px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: transparent; color: var(--accent);
  font-size: 14px; font-weight: 600; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.dpos-add-more-btn:hover { background: var(--accent-lt); }

/* ── Right Column ─────────────────────────────────────────────────── */
.dpos-right-col { display: flex; flex-direction: column; gap: 20px; }

.dpos-trust-widget {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--panel);
}
.dpos-trust-title { font-size: 14px; font-weight: 700; color: var(--accent); display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.dpos-trust-items { display: flex; justify-content: space-between; text-align: center; }
.dpos-trust-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.dpos-trust-icon { font-size: 20px; line-height: 1; }
.dpos-trust-text { font-size: 10px; font-weight: 600; color: var(--primary); line-height: 1.3; }

.dpos-cart-section {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; background: var(--panel);
}
.dpos-cart-title { font-size: 14px; font-weight: 700; color: var(--primary); margin-bottom: 16px; display: flex; align-items: center; gap: 6px; }
.dpos-cart-items-wrap { display: flex; flex-direction: column; gap: 12px; margin-bottom: 16px; }
.dpos-cart-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding-bottom: 12px; border-bottom: 1px solid var(--border);
}
.dpos-cart-item:last-child { border-bottom: none; padding-bottom: 0; }
.dpos-cart-item-img {
  width: 50px; height: 50px; object-fit: contain; background: #F9FAFB;
  border: 1px solid var(--border); border-radius: 6px; flex-shrink: 0;
}
.dpos-cart-item-details { flex: 1; min-width: 0; }
.dpos-cart-item-name { font-size: 12px; font-weight: 700; color: var(--primary); margin-bottom: 6px; line-height: 1.3; }
.dpos-cart-item-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.dpos-cart-item-badge { background: var(--green); color: #fff; padding: 2px 6px; border-radius: 4px; font-size: 9px; font-weight: 700; }
.dpos-cart-item-price-each { font-size: 12px; font-weight: 600; color: var(--text); }
.dpos-cart-item-row { display: flex; justify-content: space-between; align-items: center; }
.dpos-cart-qty-ctrl { display: inline-flex; align-items: center; gap: 8px; background: #F1F5F9; border-radius: 4px; padding: 2px 4px; border: 1px solid var(--border); }
.dpos-cart-qty-btn { background: none; border: none; font-size: 14px; color: var(--muted); cursor: pointer; width: 20px; height: 20px; display: flex; align-items: center; justify-content: center; font-weight: bold; border-radius: 3px; transition: var(--trans); }
.dpos-cart-qty-btn:hover { background: #E2E8F0; color: var(--text); }
.dpos-cart-qty-val { font-size: 12px; font-weight: 600; color: var(--text); min-width: 14px; text-align: center; }
.dpos-cart-item-remove { background: none; border: none; cursor: pointer; color: var(--red); font-size: 16px; line-height: 1; padding: 0 4px; margin-left: 10px; }

.dpos-cart-summary { padding: 12px 0 0 0; }
.dpos-summary-row { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.dpos-free-badge { color: var(--green); font-weight: 700; }
.dpos-summary-total-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; font-weight: 700; color: var(--primary); border-top: 1px solid var(--border); padding-top: 10px; margin-bottom: 16px; }
#dpos-summary-total { font-size: 18px; font-weight: 800; color: var(--green); }
.dpos-checkout-btn-big {
  display: block; width: 100%; text-align: center;
  padding: 12px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font-size: 14px; font-weight: 700; text-decoration: none; transition: var(--trans);
}
.dpos-checkout-btn-big:hover { background: #132d52; }
.dpos-checkout-note { font-size: 10px; color: var(--muted); text-align: center; margin-top: 8px; }

/* Misc */
#dpos-price-empty { display: none; }
.dpos-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--primary); color: #fff;
  padding: 12px 20px; border-radius: var(--radius); font-size: 12px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  transform: translateY(80px); opacity: 0;
  transition: all .3s ease; z-index: 9999;
}
.dpos-toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 900px) {
  .dpos-main { grid-template-columns: 1fr; }
  .dpos-step-inline .dpos-step-body { flex-direction: column; align-items: flex-start; gap: 8px; }
  .dpos-step-inline .dpos-step-label { min-width: auto; }
  .dpos-add-more-wrap { padding-left: 0; }
}
@media (max-width: 768px) {
  .dpos-exp-row { flex-direction: row; flex-wrap: wrap; align-items: flex-start; padding: 12px; gap: 10px; }
  .dpos-exp-field:nth-child(1) { flex: 2; min-width: 0; }
  .dpos-exp-field:nth-child(2) { flex: 1; min-width: 0; }
  .dpos-exp-hint { flex: 1 1 100%; margin-top: 2px; }
  .dpos-condition-btn-inner { padding: 12px; }
  .dpos-condition-text strong { font-size: 14px; }
  
  .dpos-brand-strip {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 15px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    gap: 12px;
  }
  .dpos-brand-card {
    flex: 0 0 105px;
    width: 105px;
    height: 105px;
    scroll-snap-align: start;
  }
  .dpos-brand-strip::-webkit-scrollbar { height: 6px; }
  .dpos-brand-strip::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
}
