/* AI with Ash unified cart — v1.
 *
 * All rules scoped under .aiwa-cart so the host page's CSS can't bleed
 * in and our rules can't bleed out. Self-contained (no Tailwind, no
 * framework deps). Single file, served from api.aiwithash.com.
 *
 * Brand palette matches www.aiwithash.com/connect.
 */

.aiwa-cart, .aiwa-cart *, .aiwa-cart *::before, .aiwa-cart *::after {
  box-sizing: border-box;
}

.aiwa-cart {
  --aiwa-bg: #0a0a1a;
  --aiwa-surface: #111128;
  --aiwa-surface-2: #1a1a2e;
  --aiwa-border: #2a2a4a;
  --aiwa-text: #e2e8f0;
  --aiwa-text-dim: #94a3b8;
  --aiwa-text-muted: #cbd5e0;
  --aiwa-primary: #6366f1;
  --aiwa-primary-hover: #818cf8;
  --aiwa-success: #34d399;
  --aiwa-warn: #fbbf24;
  --aiwa-danger: #f87171;
  --aiwa-radius: 12px;
  --aiwa-radius-sm: 6px;

  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  color: var(--aiwa-text);
  background: var(--aiwa-surface);
  border: 1px solid var(--aiwa-border);
  border-radius: var(--aiwa-radius);
  padding: 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  text-align: left;
  line-height: 1.5;
}

.aiwa-cart--pinned {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
}

/* ----- BAR MODE (www bottom bar; handles saas + domain items) ----- */

.aiwa-cart--bar {
  max-width: 960px;
  padding: 14px 18px;
  line-height: 1.4;
}

.aiwa-cart--bar.aiwa-cart--empty {
  display: none !important;
}

.aiwa-bar__head {
  display: flex;
  align-items: center;
  gap: 14px;
}

.aiwa-bar__icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

.aiwa-bar__title {
  flex: 1;
  font-weight: 600;
  color: var(--aiwa-text);
  font-size: 14px;
}

.aiwa-bar__totalwrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.aiwa-bar__totallabel { color: var(--aiwa-text-dim); font-size: 13px; }
.aiwa-bar__totalamt   { color: var(--aiwa-primary-hover); font-weight: 700; font-size: 15px; }

.aiwa-bar__caret {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: var(--aiwa-surface-2);
  border: 0;
  color: var(--aiwa-text);
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  transition: transform 0.15s ease, background 0.15s ease;
}
.aiwa-bar__caret:hover { background: var(--aiwa-primary); }

.aiwa-bar__body {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--aiwa-border);
}

.aiwa-bar__actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

.aiwa-bar__checkout {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--aiwa-border);
}

/* ----- ROWS (saas + domain) ----- */

.aiwa-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--aiwa-border);
}
.aiwa-row:last-child { border-bottom: none; }

.aiwa-row__main { flex: 1; min-width: 0; }
.aiwa-row__title { color: var(--aiwa-text); font-size: 14px; font-weight: 500; }
.aiwa-row__sub { color: var(--aiwa-text-dim); font-size: 12px; margin-top: 2px; }
.aiwa-row__dot { color: var(--aiwa-text-dim); }
.aiwa-row__trial { color: var(--aiwa-success); }

.aiwa-row__ctrls {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--aiwa-border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--aiwa-bg);
}
.aiwa-row__step {
  width: 28px; height: 28px;
  border: 0;
  background: var(--aiwa-surface-2);
  color: var(--aiwa-text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.aiwa-row__step:hover:not(:disabled) { background: var(--aiwa-primary); }
.aiwa-row__step:disabled { opacity: 0.4; cursor: not-allowed; }
.aiwa-row__qty {
  min-width: 32px;
  text-align: center;
  font-size: 13px;
  color: var(--aiwa-text);
}

.aiwa-row__total {
  font-weight: 600;
  color: var(--aiwa-text);
  font-size: 14px;
  min-width: 60px;
  text-align: right;
}

.aiwa-row__rm {
  width: 24px; height: 24px;
  border-radius: 4px;
  border: 0;
  background: transparent;
  color: var(--aiwa-text-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  font-family: inherit;
}
.aiwa-row__rm:hover { color: var(--aiwa-danger); background: rgba(248,113,113,0.08); }

.aiwa-cart__btn--primary { background: var(--aiwa-primary); }

.aiwa-cart__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.aiwa-cart__brand {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--aiwa-primary);
  font-weight: 600;
}

.aiwa-cart__title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
}

.aiwa-cart__subtitle {
  font-size: 13px;
  color: var(--aiwa-text-dim);
  margin: 0 0 16px;
}

.aiwa-cart__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 0;
  border-bottom: 1px solid var(--aiwa-border);
}

.aiwa-cart__row:last-of-type {
  border-bottom: none;
}

.aiwa-cart__row-label { color: var(--aiwa-text-muted); font-size: 14px; }
.aiwa-cart__row-value { color: var(--aiwa-text); font-weight: 500; }

.aiwa-cart__total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px solid var(--aiwa-border);
}

.aiwa-cart__total-label { font-size: 14px; color: var(--aiwa-text-muted); }
.aiwa-cart__total-amount { font-size: 22px; font-weight: 700; color: var(--aiwa-text); }
.aiwa-cart__total-period { font-size: 13px; color: var(--aiwa-text-dim); margin-left: 4px; }

.aiwa-cart__trial {
  margin-top: 8px;
  padding: 10px 12px;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.25);
  border-radius: var(--aiwa-radius-sm);
  font-size: 13px;
  color: var(--aiwa-success);
}

.aiwa-cart__label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--aiwa-text-dim);
  margin: 16px 0 6px;
}

.aiwa-cart__input {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--aiwa-radius-sm);
  border: 1px solid var(--aiwa-border);
  background: var(--aiwa-bg);
  color: var(--aiwa-text);
  font-size: 14px;
  font-family: inherit;
}

.aiwa-cart__input:focus {
  outline: none;
  border-color: var(--aiwa-primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.aiwa-cart__input--code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  text-align: center;
  letter-spacing: 0.4em;
  font-size: 16px;
  padding: 12px;
}

.aiwa-cart__seats-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.aiwa-cart__seat-chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--aiwa-border);
  background: transparent;
  color: var(--aiwa-text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}

.aiwa-cart__seat-chip:hover {
  border-color: var(--aiwa-primary);
  color: var(--aiwa-text);
}

.aiwa-cart__seat-chip.is-active {
  background: var(--aiwa-primary);
  border-color: var(--aiwa-primary);
  color: #fff;
  font-weight: 500;
}

.aiwa-cart__seats-stepper {
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--aiwa-border);
  border-radius: var(--aiwa-radius-sm);
  overflow: hidden;
  background: var(--aiwa-bg);
  margin-bottom: 8px;
}

.aiwa-cart__step-btn {
  padding: 8px 14px;
  background: var(--aiwa-surface-2);
  border: 0;
  color: var(--aiwa-text);
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.aiwa-cart__step-btn:hover {
  background: var(--aiwa-primary);
}

.aiwa-cart__step-input {
  flex: 1;
  border: 0;
  border-radius: 0;
  text-align: center;
  background: transparent;
  -moz-appearance: textfield;
}

.aiwa-cart__step-input::-webkit-outer-spin-button,
.aiwa-cart__step-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.aiwa-cart__btn {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--aiwa-radius-sm);
  border: 0;
  background: var(--aiwa-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
  font-family: inherit;
}

.aiwa-cart__btn:hover:not(:disabled) { background: var(--aiwa-primary-hover); }
.aiwa-cart__btn:disabled { background: #555; cursor: not-allowed; opacity: 0.7; }
.aiwa-cart__btn--ghost {
  background: transparent;
  border: 1px solid var(--aiwa-border);
  color: var(--aiwa-text-muted);
}
.aiwa-cart__btn--ghost:hover:not(:disabled) { background: var(--aiwa-surface-2); color: var(--aiwa-text); }

.aiwa-cart__stripe-mount {
  margin-top: 12px;
  padding: 14px;
  border-radius: var(--aiwa-radius-sm);
  border: 1px solid var(--aiwa-border);
  background: var(--aiwa-bg);
  min-height: 60px;
}

.aiwa-cart__msg {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--aiwa-radius-sm);
  font-size: 13px;
  line-height: 1.5;
}
.aiwa-cart__msg--info { background: rgba(99, 102, 241, 0.08); border: 1px solid rgba(99, 102, 241, 0.25); color: var(--aiwa-primary-hover); }
.aiwa-cart__msg--success { background: rgba(52, 211, 153, 0.08); border: 1px solid rgba(52, 211, 153, 0.25); color: var(--aiwa-success); }
.aiwa-cart__msg--error { background: rgba(248, 113, 113, 0.08); border: 1px solid rgba(248, 113, 113, 0.3); color: var(--aiwa-danger); }

.aiwa-cart__small { font-size: 12px; color: var(--aiwa-text-dim); margin-top: 12px; }
.aiwa-cart__small a { color: var(--aiwa-primary-hover); }

.aiwa-cart__spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: aiwa-spin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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

@media (prefers-color-scheme: light) {
  /* Honour host page theming when possible — but the cart is always
     legible in either theme since the surface is darkened on its own. */
}
