/* Components layer: reusable UI parts for Whalet Checkout */

/* Sections */
.whalet-checkout__section {
  background: var(--whalet-color-bg);
  border: 1px solid var(--whalet-color-border);
  border-radius: var(--whalet-radius-md);
  padding: var(--whalet-spacing-md);
}

/* Order panel */
.whalet-checkout__panel {
  display: flex;
  flex-direction: column;
  gap: var(--whalet-spacing-lg);
  flex: 1;
}

/* Order items */
.whalet-checkout__order-item {
  display: flex;
  gap: var(--whalet-spacing-sm);
  align-items: center;
  padding: var(--whalet-spacing-xs) 0;
  border-bottom: 1px solid #f0f0f0;
}
.whalet-checkout__order-item:last-child { border-bottom: none; }

.whalet-checkout__item-thumb {
  width: 4rem;
  height: 4rem;
  border-radius: var(--whalet-radius-sm);
  overflow: hidden;
  flex: 0 0 4rem;
  background: var(--whalet-color-bg-soft);
  border: 1px solid var(--whalet-color-border);
}
.whalet-checkout__item-thumb img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  display: block;
}

.whalet-checkout__thumb-placeholder { width: 100%; height: 100%; background: #eaeaea; }

.whalet-checkout__item-info { flex: 1; min-width: 0; }
.whalet-checkout__item-title {
  font-size: 0.875rem;
  font-weight: 500;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.whalet-checkout__item-meta { font-size: 0.75rem; color: var(--whalet-color-text-muted); }
.whalet-checkout__item-price { font-size: 0.875rem; font-weight: 600; }

/* Pricing */
.whalet-checkout__pricing-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--whalet-spacing-xxs) 0;
}
.whalet-checkout__total {
  font-size: 1rem;
  font-weight: 700;
}

/* Addresses */
.whalet-checkout__address { display: grid; grid-template-columns: 1fr; gap: var(--whalet-spacing-sm); }
.whalet-checkout__address-block {
  background: var(--whalet-color-bg-soft);
  border: 1px solid var(--whalet-color-border);
  border-radius: var(--whalet-radius-sm);
  padding: var(--whalet-spacing-sm);
}
.whalet-checkout__address-title { font-weight: 600; margin-bottom: 0.375rem; }

/* Payment iframe */
.whalet-checkout__iframe {
  width: 100%;
  min-height: 70vh;
  border: 1px solid var(--whalet-color-border);
  border-radius: var(--whalet-radius-md);
  position: relative;
  z-index: 2;
}

.whalet-checkout__right { position: relative; }
.whalet-checkout__loader { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.8); z-index: 1; }
.whalet-checkout__loader-inner { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.whalet-checkout__spinner { width: 3rem; height: 3rem; border-radius: 50%; border: 0.25rem solid #e3e3e3; border-top-color: #3b82f6; animation: whalet-spin 1s linear infinite; }
.whalet-checkout__loader-text { font-size: 0.875rem; color: var(--whalet-color-text-muted); }
@keyframes whalet-spin { to { transform: rotate(360deg); } }
.whalet-checkout__right.is-loaded .whalet-checkout__loader { opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 0.3s ease, visibility 0.3s ease; }

/* Timeout message */
.whalet-checkout__timeout {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--whalet-color-bg, #fff);
  z-index: 3;
}

.whalet-checkout__timeout-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--whalet-spacing-md, 1rem);
  text-align: center;
  padding: var(--whalet-spacing-lg, 1.5rem);
  max-width: 20rem;
}

.whalet-checkout__timeout-icon {
  color: #ef4444;
}

.whalet-checkout__timeout-text {
  font-size: 1rem;
  color: var(--whalet-color-text, #1f2937);
  line-height: 1.5;
}

.whalet-checkout__timeout-btn {
  background-color: #3b82f6;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: var(--whalet-radius-sm, 0.375rem);
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  font-size: 0.875rem;
  width: 110px;
}

.whalet-checkout__timeout-btn:hover {
  background-color: #2563eb;
}

/* Tablet adjustments */
@media (max-width: 48rem) {
  .whalet-checkout__order-item { align-items: flex-start; }
  .whalet-checkout__item-thumb { width: 3.5rem; height: 3.5rem; flex: 0 0 3.5rem; }
  .whalet-checkout__section { padding: var(--whalet-spacing-sm); }
}
