/* ─── AIQ Loyalty Widget ─── */
/* All classes prefixed with aiq-widget- to avoid conflicts */
/* Uses all:revert to isolate from host page CSS resets (Tailwind, etc.) */

/* ─── Root ─── */
.aiq-widget {
  all: revert;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --aiq-theme-color: #2E7E33;
  --aiq-theme-color-hover: #267029;
  --aiq-theme-color-light: rgba(46, 126, 51, 0.1);
  --aiq-z-index: 9999;
  line-height: 1.5;
  box-sizing: border-box;
}

.aiq-widget *, .aiq-widget *::before, .aiq-widget *::after {
  box-sizing: border-box;
}

/* ─── Floating Action Button ─── */
.aiq-widget-fab {
  all: revert;
  position: fixed;
  z-index: var(--aiq-z-index);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  margin: 0;
  background-color: var(--aiq-theme-color);
  background-image: none;
  color: #fff;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.5;
  text-decoration: none;
  text-transform: none;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  appearance: none;
}

.aiq-widget-fab:hover {
  background-color: var(--aiq-theme-color-hover);
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.aiq-widget-fab:active {
  transform: scale(0.98);
}

.aiq-widget-position-bottom-right .aiq-widget-fab {
  bottom: 24px;
  right: 24px;
}

.aiq-widget-position-bottom-left .aiq-widget-fab {
  bottom: 24px;
  left: 24px;
}

.aiq-widget-fab-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.aiq-widget-fab-icon svg {
  width: 100%;
  height: 100%;
}

.aiq-widget-fab-text {
  white-space: nowrap;
}

/* ─── Points Badge on FAB ─── */
.aiq-widget-fab-points {
  all: revert;
  display: inline-block;
  background-color: rgba(255, 255, 255, 0.25);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 2px 10px;
  border-radius: 20px;
  margin: 0;
  line-height: 1.4;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* ─── Overlay ─── */
.aiq-widget-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: calc(var(--aiq-z-index) + 1);
  animation: aiq-fade-in 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

/* ─── Panel (shared) ─── */
.aiq-widget-panel {
  position: fixed;
  z-index: calc(var(--aiq-z-index) + 2);
  background: #fff;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  overflow: hidden;
}

/* ─── Drawer variant ─── */
.aiq-widget-panel-drawer {
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 100vw;
  animation: aiq-slide-in-right 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Modal variant ─── */
.aiq-widget-panel-modal {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 480px;
  max-width: 95vw;
  height: 80vh;
  max-height: 700px;
  border-radius: 16px;
  animation: aiq-scale-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Topbar (toggle + close) ─── */
.aiq-widget-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.aiq-widget-toggle {
  display: flex;
  gap: 4px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
}

.aiq-widget-toggle-btn {
  all: revert;
  padding: 6px 16px;
  margin: 0;
  border: none;
  background-color: transparent;
  background-image: none;
  color: #6b7280;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 6px;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  text-decoration: none;
  text-transform: none;
  transition: all 0.2s;
  white-space: nowrap;
  -webkit-appearance: none;
  appearance: none;
}

.aiq-widget-toggle-btn:hover {
  color: #374151;
  background-color: #e5e7eb;
}

.aiq-widget-toggle-active {
  background-color: #fff;
  color: #111827;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ─── Close Button ─── */
.aiq-widget-close {
  all: revert;
  width: 32px;
  height: 32px;
  border: none;
  background-color: #f3f4f6;
  background-image: none;
  color: #6b7280;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin: 0;
  transition: background-color 0.2s;
  flex-shrink: 0;
  -webkit-appearance: none;
  appearance: none;
}

.aiq-widget-close:hover {
  background-color: #e5e7eb;
  color: #374151;
}

.aiq-widget-close svg {
  width: 100%;
  height: 100%;
}

/* ─── Panel Body ─── */
.aiq-widget-panel-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.aiq-widget-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.aiq-widget-panel-body-custom {
  overflow-y: auto;
}

/* ─── Panel Footer ─── */
.aiq-widget-panel-footer {
  padding: 8px 20px;
  text-align: center;
  font-size: 11px;
  color: #9ca3af;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

/* ─── Animations ─── */
@keyframes aiq-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes aiq-slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@keyframes aiq-scale-in {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes aiq-slide-up-bottom-sheet {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ─── Bottom Sheet Drag Handle ─── */
.aiq-widget-drag-handle {
  display: none;
}

/* ═══════════════════════════════════════════════ */
/* ─── Custom Wallet UI (Option 2) ─── */
/* ═══════════════════════════════════════════════ */

.aiq-custom-wallet {
  padding: 24px 20px;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111827;
}

/* ─── Hero Section ─── */
.aiq-custom-hero {
  text-align: center;
  margin-bottom: 24px;
}

.aiq-custom-hero-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 12px;
  color: var(--aiq-theme-color);
}

.aiq-custom-hero-icon svg {
  width: 100%;
  height: 100%;
}

.aiq-custom-hero-title {
  all: revert;
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 8px;
  padding: 0;
  color: #111827;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.3;
}

.aiq-custom-hero-desc {
  all: revert;
  font-size: 14px;
  color: #6b7280;
  margin: 0;
  padding: 0;
  line-height: 1.5;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.aiq-custom-hero-desc strong {
  color: #111827;
  font-weight: 600;
}

/* ─── Form ─── */
.aiq-custom-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.aiq-custom-label {
  all: revert;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin: 0;
  padding: 0;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.aiq-custom-input {
  all: revert;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 16px;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111827;
  background-color: #fff;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  margin: 0;
}

.aiq-custom-input:focus {
  border-color: var(--aiq-theme-color);
  box-shadow: 0 0 0 3px var(--aiq-theme-color-light);
}

.aiq-custom-input::placeholder {
  color: #9ca3af;
}

.aiq-custom-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ─── PIN Input Group ─── */
.aiq-custom-pin-group {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.aiq-custom-pin-input {
  all: revert;
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid #d1d5db;
  border-radius: 12px;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #111827;
  background-color: #fff;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

.aiq-custom-pin-input:focus {
  border-color: var(--aiq-theme-color);
  box-shadow: 0 0 0 3px var(--aiq-theme-color-light);
}

.aiq-custom-pin-input:disabled {
  opacity: 0.6;
}

/* ─── Submit Button ─── */
.aiq-custom-submit {
  all: revert;
  width: 100%;
  padding: 12px 20px;
  margin: 4px 0 0;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
  text-align: center;
  line-height: 1.5;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.aiq-custom-submit:hover {
  opacity: 0.9;
}

.aiq-custom-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Error ─── */
.aiq-custom-error {
  all: revert;
  color: #dc2626;
  font-size: 13px;
  margin: 0;
  padding: 0;
  text-align: center;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ─── Links ─── */
.aiq-custom-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 4px;
}

.aiq-custom-link {
  all: revert;
  background: none;
  border: none;
  color: var(--aiq-theme-color);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 0;
  margin: 0;
}

.aiq-custom-link:hover {
  text-decoration: underline;
}

.aiq-custom-link:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ─── Points Card ─── */
.aiq-custom-points-card {
  border-radius: 16px;
  padding: 24px;
  color: #fff;
  text-align: center;
  margin-bottom: 20px;
}

/* Full-bleed points card when no header bar (custom mode) */
.aiq-widget-panel-body-custom .aiq-custom-points-card {
  margin: -24px -20px 20px;
  border-radius: 0;
  padding: 40px 24px 24px;
}

.aiq-custom-points-label {
  font-size: 13px;
  font-weight: 500;
  opacity: 0.85;
  margin-bottom: 4px;
}

.aiq-custom-points-value {
  font-size: 48px;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 4px;
  letter-spacing: -0.02em;
}

.aiq-custom-points-member {
  font-size: 13px;
  opacity: 0.75;
}

/* ─── Rewards List ─── */
.aiq-custom-rewards {
  margin-bottom: 16px;
}

.aiq-custom-rewards-title {
  all: revert;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 12px;
  padding: 0;
  color: #111827;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  line-height: 1.3;
}

.aiq-custom-rewards-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.aiq-custom-reward-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background-color: #fff;
}

.aiq-custom-reward-badge {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.aiq-custom-reward-info {
  flex: 1;
  min-width: 0;
}

.aiq-custom-reward-name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 2px;
}

.aiq-custom-reward-desc {
  font-size: 12px;
  color: #6b7280;
}

.aiq-custom-reward-cost {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 2px;
}

.aiq-custom-reward-tier {
  all: revert;
  font-size: 11px;
  font-weight: 600;
  color: var(--aiq-theme-color);
  background-color: var(--aiq-theme-color-light);
  padding: 2px 8px;
  border-radius: 20px;
  margin: 0;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  white-space: nowrap;
}

/* ─── Empty State ─── */
.aiq-custom-empty {
  text-align: center;
  padding: 20px;
  color: #9ca3af;
  font-size: 14px;
}

.aiq-custom-empty p {
  margin: 0;
}

/* ─── Sign Out ─── */
.aiq-custom-signout {
  all: revert;
  width: 100%;
  padding: 10px;
  margin: 8px 0 0;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background-color: #fff;
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  font-family: "Work Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  transition: background-color 0.2s;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

.aiq-custom-signout:hover {
  background-color: #f9fafb;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
  .aiq-widget-panel-drawer {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100vw;
    height: 85vh;
    max-height: 85vh;
    border-radius: 16px 16px 0 0;
    animation: aiq-slide-up-bottom-sheet 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
  }

  .aiq-widget-panel-drawer .aiq-widget-drag-handle {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0 0;
    flex-shrink: 0;
    cursor: grab;
    -webkit-tap-highlight-color: transparent;
    touch-action: none;
    background-color: #fff;
    border-radius: 16px 16px 0 0;
  }

  .aiq-widget-drag-handle-pill {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background-color: #d1d5db;
  }

  .aiq-widget-fab-text {
    display: none;
  }

  .aiq-widget-fab {
    padding: 14px;
    border-radius: 50%;
  }

  .aiq-widget-fab:has(.aiq-widget-fab-points) {
    padding: 10px 14px;
    border-radius: 50px;
  }

  .aiq-widget-fab-points {
    font-size: 11px;
  }

}

