/* === APP STYLES — SubQuote Dashboard ===
   Extends theme.css (loaded first). Do not duplicate base variables here.
*/

/* --- APP LAYOUT --- */
.app-wrap {
  min-height: 100vh;
  padding-top: 72px; /* nav height */
}

.app-header {
  padding: 40px 32px 0;
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}

.app-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -1px;
  color: var(--fg-primary);
  margin-bottom: 4px;
}

.app-subtitle {
  font-size: 15px;
  color: var(--fg-secondary);
}

.app-body {
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px;
}

/* --- BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: var(--bg-primary);
}
.btn-primary:hover:not(:disabled) { opacity: 0.9; }

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--fg-primary);
  border: 1px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { border-color: var(--border-accent); }

.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  font-size: 13px;
}
.btn-ghost:hover:not(:disabled) { color: var(--fg-primary); border-color: var(--border-accent); }

.btn-danger {
  background: rgba(220, 60, 60, 0.1);
  color: #f87171;
  border: 1px solid rgba(220, 60, 60, 0.2);
}
.btn-danger:hover:not(:disabled) { background: rgba(220, 60, 60, 0.18); }

.btn-sm { padding: 8px 16px; font-size: 13px; }

/* --- STATUS BADGES --- */
.badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 100px;
  border: 1px solid transparent;
}
.badge-draft    { background: rgba(100,100,120,0.15); color: #9b978f; border-color: rgba(100,100,120,0.2); }
.badge-sent     { background: rgba(59,130,246,0.12);  color: #60a5fa; border-color: rgba(59,130,246,0.2); }
.badge-accepted { background: rgba(34,197,94,0.12);   color: #4ade80; border-color: rgba(34,197,94,0.2); }
.badge-declined { background: rgba(239,68,68,0.1);    color: #f87171; border-color: rgba(239,68,68,0.2); }
.badge-expired  { background: rgba(234,179,8,0.1);    color: #facc15; border-color: rgba(234,179,8,0.2); }

/* --- CARDS --- */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 32px;
}

/* --- FORM ELEMENTS --- */
.form-group {
  margin-bottom: 24px;
}
.form-label {
  display: block;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--fg-primary);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--border-accent);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--fg-muted); }
.form-textarea { resize: vertical; min-height: 80px; }
.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235e5b55' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}
.form-hint { font-size: 12px; color: var(--fg-muted); margin-top: 4px; }

/* --- QUOTES LIST --- */
.quotes-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quote-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}
.quote-row:hover { border-color: var(--border-accent); background: var(--bg-tertiary); }

.quote-row-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.quote-project  { font-family: var(--font-display); font-size: 17px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quote-client   { font-size: 14px; color: var(--fg-secondary); }
.quote-row-right { display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.quote-total    { font-family: var(--font-display); font-size: 20px; font-weight: 700; color: var(--accent); letter-spacing: -0.3px; }
.quote-date     { font-size: 13px; color: var(--fg-muted); }

.empty-state {
  text-align: center;
  padding: 80px 32px;
  color: var(--fg-muted);
}
.empty-state-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.empty-state h3 { font-family: var(--font-display); font-size: 20px; font-weight: 600; color: var(--fg-secondary); margin-bottom: 8px; }
.empty-state p  { font-size: 15px; }

/* --- QUOTE BUILDER --- */
.builder-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 28px;
  align-items: start;
}

.builder-section-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

/* --- LINE ITEMS TABLE --- */
.line-items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.line-items-table th {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--fg-muted);
  padding: 8px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.line-items-table th.right { text-align: right; }
.line-items-table td { padding: 10px 12px; border-bottom: 1px solid rgba(240,236,228,0.04); vertical-align: middle; }
.line-items-table td.right { text-align: right; }
.li-input {
  width: 100%;
  background: transparent;
  border: none;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--fg-primary);
  outline: none;
  padding: 4px 0;
}
.li-input:focus { border-bottom: 1px solid var(--border-accent); }
.li-input-sm { width: 80px; text-align: right; }
.li-input-xs { width: 60px; text-align: right; }
.li-input-unit { width: 60px; }
.li-select {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--fg-primary);
  cursor: pointer;
  outline: none;
}
.li-amount {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--fg-primary);
  font-size: 14px;
  min-width: 80px;
  text-align: right;
}
.li-delete-btn {
  background: none;
  border: none;
  color: var(--fg-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 16px;
  line-height: 1;
  transition: color 0.15s;
}
.li-delete-btn:hover { color: #f87171; }

.total-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 24px;
  padding: 16px 12px;
  border-top: 1px solid var(--border);
}
.total-label { font-size: 14px; color: var(--fg-secondary); }
.total-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; color: var(--accent); letter-spacing: -0.5px; }

/* --- QUOTE DETAIL --- */
.quote-detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.quote-detail-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.detail-meta {
  display: flex;
  gap: 32px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.meta-item { display: flex; flex-direction: column; gap: 4px; }
.meta-label { font-size: 11px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--fg-muted); }
.meta-value { font-size: 16px; color: var(--fg-primary); }

.followup-list { display: flex; flex-direction: column; gap: 8px; }
.followup-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
}
.fu-seq   { font-family: var(--font-display); font-weight: 700; color: var(--accent); width: 28px; }
.fu-date  { color: var(--fg-secondary); flex: 1; padding-left: 8px; }
.fu-badge-sent    { color: #4ade80; font-size: 12px; font-weight: 600; }
.fu-badge-pending { color: #60a5fa; font-size: 12px; font-weight: 600; }
.fu-badge-skipped { color: var(--fg-muted); font-size: 12px; font-weight: 600; }

/* --- ALERTS --- */
.alert {
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success { background: rgba(34,197,94,0.1); border: 1px solid rgba(34,197,94,0.2); color: #4ade80; }
.alert-error   { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }

/* --- SIDEBAR SUMMARY --- */
.summary-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  position: sticky;
  top: 100px;
}
.summary-total-label { font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--fg-muted); margin-bottom: 6px; }
.summary-total-value { font-family: var(--font-display); font-size: 36px; font-weight: 700; color: var(--accent); letter-spacing: -1px; margin-bottom: 24px; }
.summary-divider { height: 1px; background: var(--border); margin: 20px 0; }
.summary-row { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 10px; }
.summary-row-label { color: var(--fg-secondary); }
.summary-row-value { color: var(--fg-primary); font-weight: 500; }

/* --- NAV LINKS (add to landing nav) --- */
.nav-actions { display: flex; align-items: center; gap: 12px; }
.nav-link {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 0.2s;
}
.nav-link:hover { color: var(--fg-primary); }

/* --- LOADING --- */
.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(232,140,48,0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- RESPONSIVE --- */
@media (max-width: 900px) {
  .builder-layout { grid-template-columns: 1fr; }
  .summary-card { position: static; }
}
@media (max-width: 640px) {
  .app-body { padding: 20px; }
  .app-header { padding: 24px 20px 0; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; }
  .quote-row { flex-wrap: wrap; }
  .line-items-table { font-size: 13px; }
  .line-items-table th, .line-items-table td { padding: 8px 6px; }
}
