/**
 * tendera-ui.css — Shared component styles.
 *
 * Owns: tender cards, section cards, generic card, drag-and-drop,
 *       large block buttons (btn-primary/ghost/portal), small action buttons.
 *
 * Load order: theme.css → layout.css → tendera-ui.css → typography.css
 *
 * NOTE: .section-label and .sub are defined in typography.css — do not redeclare here.
 * NOTE: Button font-size overrides live in typography.css to keep type scale in one place.
 */


/* ─── Tender list container ──────────────────────────────────────────────── */

/* Vertical feed used by dashboard-new.html, tender-detail.html, response builder */
.tenders {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem;
  width: 100%;
  min-width: 0;
  align-items: stretch;
}
.tenders > .tender,
.tenders > .tender-card {
  flex: 0 0 auto;
}

/* Saved tenders panel — same column layout, extra specificity to override .tenders */
#savedList.tenders {
  display: flex !important;
  flex-direction: column !important;
  gap: 1rem !important;
  width: 100%;
}
#savedList.tenders > .tender {
  flex: 0 0 auto !important;
  cursor: default;
}


/* ─── Drag-and-drop (saved tenders reorder) ─────────────────────────────── */

.saved-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  cursor: grab;
  color: var(--text-tertiary);
  font-size: 1rem;
  line-height: 1;
  border-radius: 4px;
  transition: color 0.15s;
  user-select: none;
}
.saved-drag-handle:hover  { color: var(--text-secondary); }
.saved-drag-handle:active { cursor: grabbing; }

/* Card state while being dragged */
.tender.saved-dragging {
  opacity: 0.4;
  border-style: dashed !important;
}

/* Drop target highlight */
.tender.drag-over {
  border-color: #000 !important;
  box-shadow: 0 0 0 2px rgba(0,0,0,0.15), 0 4px 16px rgba(0,0,0,0.15) !important;
}
[data-theme="dark"] .tender.drag-over {
  border-color: rgba(255,255,255,0.5) !important;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.1), 0 4px 16px rgba(0,0,0,0.3) !important;
}


/* ─── Tender card ────────────────────────────────────────────────────────── */

.tender,
.tender-card,
.card.tender-style {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-wrap: break-word;
  word-wrap: break-word;
}
[data-theme="dark"] .tender,
[data-theme="dark"] .tender-card,
[data-theme="dark"] .card.tender-style {
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.35);
}
.tender:hover,
.tender-card:hover,
.card.tender-style:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.1), 0 14px 40px rgba(0,0,0,0.28);
  border-color: #000;
}
[data-theme="dark"] .tender:hover,
[data-theme="dark"] .tender-card:hover,
[data-theme="dark"] .card.tender-style:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.25), 0 14px 40px rgba(0,0,0,0.45);
}


/* ─── Section card (response builder, profile sections) ─────────────────── */

.section-card {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
[data-theme="dark"] .section-card {
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.35);
}
.section-card:hover {
  box-shadow: 0 4px 8px rgba(0,0,0,0.1), 0 14px 40px rgba(0,0,0,0.28);
}
/* Highlighted when a section has been saved to the user's profile */
.section-card.saved-to-profile {
  border-color: rgba(16,185,129,0.6);
  border-width: 2px;
}


/* ─── Generic card ───────────────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08), 0 6px 20px rgba(0,0,0,0.2);
  transition: box-shadow 0.2s, border-color 0.2s;
}
[data-theme="dark"] .card {
  border-color: rgba(255,255,255,0.08);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2), 0 6px 20px rgba(0,0,0,0.35);
}


/* ─── Large block buttons ────────────────────────────────────────────────── */
/*
 * Base colours come from var(--btn-border), var(--btn-hover-bg) etc. in theme.css.
 * Font sizes are overridden in typography.css to keep the type scale centralised.
 */

.btn-primary {
  width: 100%;
  min-height: 50px;
  border-radius: 6px;
  border: var(--btn-border);
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-primary:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: #000;
}
.btn-primary:active:not(:disabled) { opacity: 0.95; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-ghost {
  width: 100%;
  min-height: 50px;
  border-radius: 6px;
  border: var(--btn-border);
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-ghost:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: #000;
}

/* Portal / external link button — same visual as btn-ghost */
.btn-portal {
  width: 100%;
  min-height: 50px;
  border-radius: 6px;
  border: var(--btn-border);
  background: transparent;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 0.85rem 1rem;
  cursor: pointer;
  font-family: var(--font);
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn-portal:hover:not(:disabled) {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: #000;
}
.btn-portal:disabled { opacity: 0.5; cursor: not-allowed; }


/* ─── Small inline action buttons (tender cards) ─────────────────────────── */

.save-btn, .btn-pipeline, .remove-btn {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: var(--btn-border);
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font-family: var(--font);
  flex-shrink: 0;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.save-btn:hover, .btn-pipeline:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: #000;
}
/* Confirmed state — green tint shown after saving or adding to pipeline */
.save-btn.saved, .btn-pipeline.saved {
  background: rgba(16,185,129,0.25);
  color: var(--success);
  border-color: rgba(16,185,129,0.45);
  cursor: default;
}
/* Remove button uses dashed border to signal a destructive action */
.remove-btn { border-style: dashed; }
.remove-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--btn-hover-text);
  border-color: #000;
}


/* ─── Utility labels ─────────────────────────────────────────────────────── */

/* Small helper text beneath cards or form fields */
.hint {
  font-size: 0.8rem;
  color: var(--text-tertiary);
}
