/*!
 * VARCO — transactions-ui.css
 * Scoped styles for the shared billing + transactions module.
 * Uses my-site.html CSS custom properties primarily, with hex fallbacks
 * so the module degrades gracefully inside dashboard/editor.html.
 */

/* ─── Common buttons ───────────────────────────────────────────────────── */
.tx-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  transition: background 0.15s ease, transform 0.05s ease, box-shadow 0.15s ease;
}
.tx-btn:focus-visible {
  outline: 2px solid var(--gold, #D4A04A);
  outline-offset: 2px;
}
.tx-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.tx-btn--primary {
  background: var(--terracotta, #C0593F);
  color: #fff;
}
.tx-btn--primary:hover:not(:disabled) {
  background: var(--terracotta-dark, #A34A33);
}
.tx-btn--ghost {
  background: transparent;
  color: var(--cream, #F5EFEA);
  border: 1px solid var(--cream-faint, rgba(245, 239, 234, 0.18));
}
.tx-btn--ghost:hover:not(:disabled) {
  background: var(--cream-faint, rgba(245, 239, 234, 0.08));
}

/* ─── Touch targets / action buttons ──────────────────────────────────── */
.tx-action-btn {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  background: var(--cream-faint, rgba(245, 239, 234, 0.08));
  color: var(--cream, #F5EFEA);
  font-family: inherit;
  margin: 0.15rem;
  transition: background 0.15s ease;
}
.tx-action-btn:hover:not(:disabled) {
  background: rgba(245, 239, 234, 0.16);
}
.tx-action-btn:focus-visible {
  outline: 2px solid var(--gold, #D4A04A);
  outline-offset: 2px;
}
.tx-action-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tx-action-btn--edit    { background: rgba(212, 160, 74, 0.18);  color: var(--gold, #D4A04A); }
.tx-action-btn--issue   { background: var(--terracotta, #C0593F); color: #fff; }
.tx-action-btn--issue:hover:not(:disabled) { background: var(--terracotta-dark, #A34A33); }
.tx-action-btn--danger  { background: rgba(248, 113, 113, 0.18); color: var(--red, #F87171); }
.tx-action-btn--danger:hover:not(:disabled) { background: rgba(248, 113, 113, 0.30); }
.tx-action-btn--success { background: rgba(74, 222, 128, 0.18); color: var(--green, #4ADE80); }
.tx-action-btn--success:hover:not(:disabled) { background: rgba(74, 222, 128, 0.30); }
.tx-action-btn--neutral { background: rgba(245, 239, 234, 0.10); color: var(--cream, #F5EFEA); }

/* ─── Status badges ───────────────────────────────────────────────────── */
.tx-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.tx-badge--bozza     { background: rgba(245, 239, 234, 0.1);  color: var(--cream-muted, rgba(245, 239, 234, 0.55)); }
.tx-badge--inviata   { background: rgba(212, 160, 74, 0.2);   color: var(--gold, #D4A04A); }
.tx-badge--pagata    { background: rgba(74, 222, 128, 0.2);   color: var(--green, #4ADE80); }
.tx-badge--annullata { background: rgba(248, 113, 113, 0.15); color: var(--red, #F87171); }

/* ─── Billing form ────────────────────────────────────────────────────── */
.tx-billing {
  background: var(--bg-card, #332A20);
  border-radius: 12px;
  padding: 1.5rem;
  color: var(--cream, #F5EFEA);
}
.tx-billing-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.tx-billing-title {
  margin: 0;
  font-size: 1.15rem;
  color: var(--cream, #F5EFEA);
}
.tx-billing-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.85rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.tx-billing-badge--green { background: rgba(74, 222, 128, 0.2);  color: var(--green, #4ADE80); }
.tx-billing-badge--amber { background: rgba(212, 160, 74, 0.22); color: var(--gold, #D4A04A); }
.tx-billing-disclaimer {
  color: var(--cream-soft, rgba(245, 239, 234, 0.7));
  font-size: 0.85rem;
  margin: 0 0 1.2rem;
  font-style: italic;
}
.tx-billing-form { display: flex; flex-direction: column; gap: 0.9rem; }

/* ─── Field rows ──────────────────────────────────────────────────────── */
.tx-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.tx-field label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cream-soft, rgba(245, 239, 234, 0.75));
}
.tx-field input,
.tx-field select,
.tx-field textarea {
  background: var(--bg-warm, #2A2219);
  color: var(--cream, #F5EFEA);
  border: 1px solid var(--cream-faint, rgba(245, 239, 234, 0.12));
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-size: 0.95rem;
  font-family: inherit;
  min-height: 44px;
  width: 100%;
  box-sizing: border-box;
}
.tx-field input:focus-visible,
.tx-field select:focus-visible,
.tx-field textarea:focus-visible {
  outline: 2px solid var(--gold, #D4A04A);
  outline-offset: 1px;
  border-color: var(--gold, #D4A04A);
}
.tx-field input::placeholder { color: var(--cream-muted, rgba(245, 239, 234, 0.45)); }
.tx-field small.tx-help {
  font-size: 0.78rem;
  color: var(--cream-muted, rgba(245, 239, 234, 0.55));
}
.tx-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr 0.6fr;
  gap: 0.75rem;
}
@media (max-width: 540px) {
  .tx-field-row { grid-template-columns: 1fr; }
}

.tx-form-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.tx-form-msg {
  font-size: 0.88rem;
  color: var(--cream-soft, rgba(245, 239, 234, 0.7));
}
.tx-form-msg--error   { color: var(--red, #F87171); }
.tx-form-msg--success { color: var(--green, #4ADE80); }
.tx-form-msg--info    { color: var(--gold, #D4A04A); }

/* ─── Transactions block ──────────────────────────────────────────────── */
.tx-transactions {
  background: var(--bg-card, #332A20);
  border-radius: 12px;
  padding: 1.5rem;
  color: var(--cream, #F5EFEA);
}
.tx-transactions-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tx-transactions-title { margin: 0; font-size: 1.15rem; }
.tx-list-mount { min-height: 60px; }
.tx-empty {
  color: var(--cream-soft, rgba(245, 239, 234, 0.65));
  padding: 1.5rem 0;
  text-align: center;
}
.tx-error { color: var(--red, #F87171); padding: 1rem 0; }

/* ─── Table ───────────────────────────────────────────────────────────── */
.tx-table {
  width: 100%;
  border-collapse: collapse;
  color: var(--cream, #F5EFEA);
}
.tx-table th,
.tx-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid rgba(245, 239, 234, 0.08);
  font-size: 0.92rem;
}
.tx-table th {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--cream-soft, rgba(245, 239, 234, 0.65));
}
.tx-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Table → cards on mobile (≤720px) */
@media (max-width: 720px) {
  .tx-table thead { display: none; }
  .tx-table tr {
    display: block;
    background: var(--bg-warm, #2A2219);
    border-radius: 12px;
    margin-bottom: 1rem;
    padding: 1rem;
    border: 1px solid var(--cream-faint, rgba(245, 239, 234, 0.08));
  }
  .tx-table td {
    display: block;
    padding: 0.25rem 0;
    border: none;
  }
  .tx-table td::before {
    content: attr(data-label);
    font-weight: 600;
    display: block;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--cream-muted, rgba(245, 239, 234, 0.55));
    margin-bottom: 0.15rem;
  }
  .tx-actions { margin-top: 0.5rem; }
}

/* ─── Modal overlay & shell ───────────────────────────────────────────── */
.tx-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: tx-fade-in 0.18s ease;
}
@keyframes tx-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.tx-modal {
  background: var(--bg-card, #332A20);
  color: var(--cream, #F5EFEA);
  border-radius: 12px;
  padding: 2rem;
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}
.tx-modal :focus-visible {
  outline: 2px solid var(--gold, #D4A04A);
  outline-offset: 2px;
}
@media (max-width: 640px) {
  .tx-modal-overlay { padding: 0; }
  .tx-modal {
    border-radius: 0;
    height: 100vh;
    max-height: 100vh;
    padding: 1.25rem;
  }
}
.tx-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.tx-modal-title { margin: 0; font-size: 1.2rem; }
.tx-modal-close {
  background: transparent;
  border: none;
  color: var(--cream, #F5EFEA);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
  border-radius: 6px;
}
.tx-modal-close:hover { background: var(--cream-faint, rgba(245, 239, 234, 0.08)); }

/* ─── Progress steps ──────────────────────────────────────────────────── */
.tx-steps {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}
.tx-step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  background: var(--cream-faint, rgba(245, 239, 234, 0.08));
  color: var(--cream-muted, rgba(245, 239, 234, 0.55));
  flex-shrink: 0;
}
.tx-step-dot.active {
  background: var(--terracotta, #C0593F);
  color: #fff;
}
.tx-step-dot.done {
  background: var(--green, #4ADE80);
  color: #1a1a1a;
}
.tx-step-line {
  flex: 1;
  height: 2px;
  background: var(--cream-faint, rgba(245, 239, 234, 0.08));
}
.tx-step-announce {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.tx-step-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 700;
  color: var(--cream, #F5EFEA);
}
.tx-step-body { margin-bottom: 1.25rem; }

.tx-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  border-top: 1px solid var(--cream-faint, rgba(245, 239, 234, 0.08));
  padding-top: 1rem;
  flex-wrap: wrap;
}

/* ─── Artwork picker (step 1) ─────────────────────────────────────────── */
.artwork-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.25rem;
}
.artwork-picker-item {
  cursor: pointer;
  border-radius: 8px;
  border: 2px solid transparent;
  padding: 0.5rem;
  background: var(--bg-warm, #2A2219);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.artwork-picker-item:hover {
  border-color: var(--cream-faint, rgba(245, 239, 234, 0.15));
}
.artwork-picker-item[aria-checked="true"] {
  border-color: var(--terracotta, #C0593F);
  background: rgba(192, 89, 63, 0.1);
}
.artwork-picker-thumb {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 6px;
  display: block;
  background: var(--bg-deep, #1E1A16);
}
.artwork-picker-thumb--placeholder {
  background: linear-gradient(135deg, var(--bg-deep, #1E1A16), var(--bg-warm, #2A2219));
}
.artwork-picker-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--cream, #F5EFEA);
  line-height: 1.2;
}
.artwork-picker-price {
  font-size: 0.8rem;
  color: var(--gold, #D4A04A);
}

/* ─── Buyer fields (step 2) ───────────────────────────────────────────── */
.tx-buyer-type {
  display: flex;
  gap: 1.5rem;
  margin: 0 0 1rem;
  padding: 0.5rem 0;
  border: none;
}
.tx-buyer-type legend {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--cream-soft, rgba(245, 239, 234, 0.75));
}
.tx-buyer-type label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  font-size: 0.92rem;
}
.tx-buyer-fields {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

/* ─── Summary (step 3) ────────────────────────────────────────────────── */
.tx-summary {
  display: flex;
  gap: 1rem;
  background: var(--bg-warm, #2A2219);
  border-radius: 10px;
  padding: 1rem;
  align-items: flex-start;
}
.tx-summary-thumb {
  width: 100px;
  height: 100px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}
.tx-summary-body { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }
.tx-summary-row { font-size: 0.92rem; }
.tx-summary-row strong {
  color: var(--cream-soft, rgba(245, 239, 234, 0.75));
  font-weight: 600;
  margin-right: 0.4rem;
}
@media (max-width: 540px) {
  .tx-summary { flex-direction: column; align-items: stretch; }
  .tx-summary-thumb { width: 100%; height: 180px; }
}

/* ─── Spinner ─────────────────────────────────────────────────────────── */
.tx-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: tx-spin 0.8s linear infinite;
  vertical-align: middle;
}
@keyframes tx-spin {
  to { transform: rotate(360deg); }
}

/* ─── Toast notifications ─────────────────────────────────────────────── */
.tx-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-card, #332A20);
  color: var(--cream, #F5EFEA);
  border-radius: 8px;
  padding: 0.85rem 1.25rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
  font-size: 0.92rem;
  max-width: 90vw;
  border-left: 4px solid var(--gold, #D4A04A);
}
.tx-toast--show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.tx-toast--success { border-left-color: var(--green, #4ADE80); }
.tx-toast--error   { border-left-color: var(--red, #F87171); }
.tx-toast--info    { border-left-color: var(--gold, #D4A04A); }

/* ─── Intercept modal variant ─────────────────────────────────────────── */
.tx-modal--intercept { max-width: 480px; }
.tx-modal--intercept p {
  color: var(--cream-soft, rgba(245, 239, 234, 0.75));
  margin: 0.5rem 0 1.25rem;
  line-height: 1.5;
}

/* ─── Loading / placeholder text inside modal ─────────────────────────── */
.tx-loading {
  color: var(--cream-soft, rgba(245, 239, 234, 0.65));
  padding: 1rem;
  text-align: center;
  grid-column: 1 / -1;
}
