/* ==========================================================================
   OrbisX — Proposals (placeholder styles)
   Scope: /proposals (list) and /proposals/new (Good/Better/Best builder)

   Most chrome (sections, fields, inputs, toggles, client typeahead, address
   picker, editor header/back button) is inherited from invoices.css so the
   two surfaces stay visually identical. This file only adds:
     • List-table grid rows (mirror of .inv-list-row)
     • Tier column visuals (bronze/silver/gold, ribbon)
     • Colored tier pills
     • Template-select dropdown in the editor header
     • Per-tier totals list
     • Customer-facing preview modal
   ========================================================================== */

/* ─── Shared utility ───────────────────────────────────────────────────── */
.prop-num { font-variant-numeric: tabular-nums; text-align: right; }

/* ─── List view rows (mirror .inv-list-row so Proposals and Invoices match) */
.prop-list-table { display: flex; flex-direction: column; }
.prop-list-row {
  display: grid;
  grid-template-columns: 110px 140px 1fr 80px 110px 120px 110px;
  gap: var(--space-3);
  align-items: center;
  padding: 12px 4px;
  border-radius: var(--radius-sm);
  color: var(--color-text-body);
  text-decoration: none;
  font-size: var(--text-sm);
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--duration-fast) var(--ease-default);
}
.prop-list-row:hover { background: var(--color-sidebar-hover); }
.prop-list-row:last-child { border-bottom: none; }
.prop-list-head-row {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 8px 4px;
  cursor: default;
}
.prop-list-head-row:hover { background: transparent; }
.prop-list-number {
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
.prop-list-subject {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.prop-list-amount {
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  color: var(--color-text-primary);
}
@media (max-width: 768px) {
  .prop-list-row { grid-template-columns: 1fr auto; gap: 4px; }
  .prop-list-head-row { display: none; }
  .prop-list-row > span:nth-child(3),
  .prop-list-row > span:nth-child(4),
  .prop-list-row > span:nth-child(6) { display: none; }
  .prop-list-row {
    grid-template-areas:
      "number   status"
      "client   client"
      "amount   amount";
  }
  .prop-list-row > span:nth-child(1) { grid-area: number; }
  .prop-list-row > span:nth-child(2) { grid-area: client; }
  .prop-list-row > span:nth-child(5) { grid-area: amount; }
  .prop-list-row > span:nth-child(7) { grid-area: status; justify-self: end; }
}

/* ─── Colored tier pills (used in list + totals card) ─────────────────── */
.prop-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: var(--weight-medium);
  text-transform: capitalize;
  border: 1px solid transparent;
}
.prop-pill-good   { background: #fef3e7; color: #8b5a2b; border-color: #f5e0c4; }
.prop-pill-better { background: #eef0f3; color: #4b5563; border-color: #d7dbe1; }
.prop-pill-best   { background: #fdf6d0; color: #8c6d10; border-color: #ecd872; }

/* ─── Template-select dropdown (in the editor action bar) ─────────────── */
.prop-template-select {
  height: 32px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-size: var(--text-sm);
  font-family: inherit;
  max-width: 240px;
  cursor: pointer;
}
.prop-template-select:focus {
  outline: 2px solid var(--color-brand-emerald);
  outline-offset: -1px;
  border-color: transparent;
}

/* ─── Tier columns (Good / Better / Best) ──────────────────────────────── */
.prop-tiers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
}
@media (max-width: 1000px) { .prop-tiers { grid-template-columns: 1fr; } }

.prop-tier {
  position: relative;
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-3);
  background: var(--color-bg-primary);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.prop-tier.is-recommended {
  border-color: var(--color-brand-emerald);
  box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.12);
}
.prop-tier-bronze { --tier-accent: #b97a3e; }
.prop-tier-silver { --tier-accent: #6b7280; }
.prop-tier-gold   { --tier-accent: #c49a1f; }

.prop-tier-ribbon {
  position: absolute;
  top: -10px;
  right: 12px;
  background: var(--color-brand-emerald);
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-semibold);
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 999px;
}

.prop-tier-head {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
}
.prop-tier-label {
  border: 0; padding: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--tier-accent, var(--color-text-primary));
  background: transparent;
}
.prop-tier-label:focus { outline: none; background: var(--color-sidebar-hover); border-radius: 4px; }
.prop-tier-headline {
  border: 0; padding: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-primary);
  background: transparent;
}
.prop-tier-subtitle {
  border: 0; padding: 0;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  background: transparent;
}

.prop-tier-price { text-align: center; padding: 4px 0; }
.prop-tier-price-num {
  display: block;
  font-size: 26px;
  font-weight: var(--weight-bold);
  color: var(--tier-accent, var(--color-text-primary));
  font-variant-numeric: tabular-nums;
}
.prop-tier-price-meta {
  display: block;
  font-size: 11px;
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.prop-tier-section {
  border-top: 1px solid var(--color-border-subtle);
  padding-top: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.prop-tier-section:first-of-type { border-top: 0; padding-top: 0; }
.prop-tier-section-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; font-weight: var(--weight-semibold);
  text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-secondary);
}

.prop-tier-items, .prop-tier-addons {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}

.prop-tier-item {
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  background: var(--color-bg-secondary);
  display: flex; flex-direction: column; gap: 6px;
}
.prop-tier-item-name { display: flex; gap: 6px; align-items: center; }
.prop-tier-item-name input {
  flex: 1; border: 0; background: transparent;
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  padding: 2px 0;
  color: var(--color-text-primary);
}
.prop-tier-item-name input:focus { outline: none; }
.prop-tier-item-desc {
  width: 100%;
  border: 0;
  background: transparent;
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  padding: 0;
}
.prop-tier-item-row {
  display: grid;
  grid-template-columns: 70px 90px 1fr;
  gap: 6px;
  align-items: center;
}
.prop-tier-item-row input[type="number"] {
  border: 1px solid var(--color-border-subtle);
  padding: 4px 6px;
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.prop-tier-addon {
  display: grid;
  grid-template-columns: auto 1fr 80px auto auto;
  gap: 6px;
  align-items: center;
  font-size: var(--text-xs);
}
.prop-tier-addon input[type="text"],
.prop-tier-addon input:not([type]),
.prop-tier-addon input[type="number"] {
  border: 1px solid var(--color-border-subtle);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
}

.prop-x {
  background: none; border: 0;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 18px; line-height: 1;
  padding: 0 6px;
  border-radius: var(--radius-sm);
}
.prop-x:hover { background: var(--color-sidebar-hover); color: var(--color-danger, #dc2626); }

.prop-link {
  background: none; border: 0;
  color: var(--color-brand-emerald);
  cursor: pointer;
  font-size: var(--text-xs);
  padding: 2px 6px;
}
.prop-link:hover { text-decoration: underline; }

/* Narrow inline checkbox style used inside tier columns (for Tax / Optional
   toggles on items/add-ons). Toggle switches on the main Toggles & Options
   section use .inv-toggle-row / .inv-switch from invoices.css instead. */
.prop-inline-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-xs);
  color: var(--color-text-primary);
  cursor: pointer;
}
.prop-inline-check input { margin: 0; }

/* ─── Per-tier totals card (inside .inv-section wrapper) ──────────────── */
.prop-card-totals .prop-totals-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--space-2);
}
.prop-card-totals .prop-totals-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.prop-totals-foot {
  margin-top: var(--space-2);
  font-size: var(--text-xs);
}

/* ─── Preview modal (customer-facing approval screen) ─────────────────── */
.prop-modal {
  position: fixed; inset: 0; z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.prop-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(12, 16, 24, 0.55);
}
.prop-modal-body {
  position: relative;
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  max-width: 1100px; width: 100%;
  max-height: 92vh; overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.prop-modal-close {
  position: absolute; top: 12px; right: 12px;
  background: none; border: 0;
  font-size: 22px; cursor: pointer;
  color: var(--color-text-secondary);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  z-index: 2;
}
.prop-modal-close:hover { background: var(--color-sidebar-hover); }

.prop-preview { padding: 40px 44px; }
.prop-preview-head { text-align: center; margin-bottom: 28px; }
.prop-preview-head h1 {
  font-size: 28px;
  font-weight: var(--weight-bold);
  margin: 0 0 6px 0;
}
.prop-preview-head p { margin: 0; color: var(--color-text-secondary); }
.prop-preview-intro {
  margin-top: 12px !important;
  max-width: 640px;
  margin-left: auto; margin-right: auto;
  line-height: 1.5;
}
.prop-preview-tiers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) { .prop-preview-tiers { grid-template-columns: 1fr; } }

.prop-preview-tier {
  border: 2px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  background: var(--color-bg-primary);
  display: flex; flex-direction: column;
  gap: 12px;
  position: relative;
}
.prop-preview-tier.is-recommended {
  border-color: var(--color-brand-emerald);
  transform: translateY(-8px);
  box-shadow: 0 12px 40px rgba(5, 150, 105, 0.15);
}
.prop-preview-tier h2 {
  font-size: 22px; margin: 0;
  color: var(--tier-accent, var(--color-text-primary));
}
.prop-preview-price {
  font-size: 34px;
  font-weight: var(--weight-bold);
  color: var(--tier-accent, var(--color-text-primary));
}
.prop-preview-tier ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 6px;
  font-size: var(--text-sm);
}
.prop-preview-tier ul li { padding: 4px 0; }
.prop-preview-optional {
  border-top: 1px dashed var(--color-border-subtle);
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.prop-preview-foot {
  border-top: 1px solid var(--color-border-subtle);
  padding-top: 16px;
  font-size: 11px;
}
