/* Bid Support — complete layout & controls */

:root {
  --color-primary: #0e7490;
  --color-primary-hover: #155e75;
  --color-success: #059669;
  --color-danger: #b91c1c;
  --color-warning: #d97706;
  --color-gray-50: #f8fafc;
  --color-gray-100: #f1f5f9;
  --color-gray-200: #e2e8f0;
  --color-gray-300: #cbd5e1;
  --color-gray-600: #475569;
  --color-gray-700: #334155;
  --color-gray-900: #0f172a;
  --bid-radius: 12px;
  --bid-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.04);
}

body.bidsupport-page {
  padding-top: 70px;
  background: linear-gradient(180deg, #f0f9ff 0%, #f8fafc 28%, #f8fafc 100%);
  min-height: 100vh;
  color: var(--color-gray-900);
}

/* Breadcrumb */
.bid-breadcrumb {
  max-width: 1400px;
  margin: 1.25rem auto 0;
  padding: 0 2rem;
  font-size: 0.875rem;
  color: var(--color-gray-600);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.bid-breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

.bid-breadcrumb a:hover {
  text-decoration: underline;
}

.bid-breadcrumb .sep {
  color: var(--color-gray-300);
}

.bid-project-context {
  max-width: 1400px;
  margin: 0.85rem auto 0;
  padding: 0.75rem 1rem;
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  border-radius: 10px;
  color: #0e7490;
  font-size: 0.875rem;
  font-weight: 600;
  box-sizing: border-box;
  width: calc(100% - 4rem);
}

.bid-project-context a {
  color: #155e75;
  font-weight: 700;
}

/* Layout */
.bidsupport-container {
  display: flex;
  max-width: 1400px;
  margin: 1.25rem auto 3rem;
  gap: 1.5rem;
  padding: 0 2rem;
  min-height: 70vh;
  align-items: flex-start;
}

.bidsupport-sidebar {
  width: 280px;
  background: #fff;
  border-radius: var(--bid-radius);
  padding: 1.25rem;
  height: fit-content;
  box-shadow: var(--bid-shadow);
  border: 1px solid var(--color-gray-200);
  flex-shrink: 0;
  position: sticky;
  top: 88px;
}

.sidebar-section {
  margin-bottom: 1.5rem;
}

.sidebar-section:last-child {
  margin-bottom: 0;
}

.sidebar-section h3 {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--color-gray-600);
  letter-spacing: 0.06em;
  margin: 0 0 0.75rem;
}

.bids-list {
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.requirements-list,
.team-list {
  max-height: none;
}

.bid-item {
  padding: 0.75rem 0.85rem;
  margin-bottom: 0.5rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.bid-item:hover {
  background: #ecfeff;
  border-color: #67e8f9;
}

.bid-item.active {
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 100%);
  color: #fff;
  border-color: #0e7490;
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.25);
}

.bid-item .bid-item-title {
  font-weight: 600;
  line-height: 1.3;
}

.bid-item .bid-item-meta {
  font-size: 0.75rem;
  margin-top: 0.3rem;
  opacity: 0.85;
}

.bid-item .bid-item-status {
  display: inline-block;
  margin-top: 0.4rem;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.06);
}

.bid-item.active .bid-item-status {
  background: rgba(255, 255, 255, 0.2);
}

.stats-box {
  background: var(--color-gray-50);
  border-radius: 10px;
  padding: 0.9rem 1rem;
  border: 1px solid var(--color-gray-200);
}

.stat-item {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.stat-item:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--color-gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.2rem;
  font-weight: 600;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--color-gray-900);
  letter-spacing: -0.02em;
}

.quick-action {
  display: block;
  width: 100%;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.45rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-gray-700);
  transition: all 0.15s;
  box-sizing: border-box;
  text-decoration: none;
  font-family: inherit;
}

.quick-action:hover {
  background: #ecfeff;
  border-color: #67e8f9;
  color: #0e7490;
}

.quick-action-link {
  display: block;
}

/* Bid templates dropdown (sidebar) */
.template-dropdown {
  margin: 0 0 0.55rem;
  width: 100%;
}

.template-dropdown-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-gray-600);
  margin: 0 0 0.35rem;
}

.template-select {
  width: 100%;
  box-sizing: border-box;
  padding: 0.65rem 2rem 0.65rem 0.75rem;
  border: 1.5px solid var(--color-gray-200);
  border-radius: 8px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.65rem center;
  background-size: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--color-gray-900);
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  line-height: 1.35;
  max-height: none;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.template-select:hover {
  border-color: #67e8f9;
  background-color: #ecfeff;
}

.template-select:focus,
.template-select.is-expanded {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
  background-color: #fff;
}

/* Expanded list (size attribute) — taller dropdown in sidebar */
.template-select.is-expanded,
.template-select[size]:not([size="1"]) {
  padding-right: 0.75rem;
  background-image: none;
  overflow-y: auto;
  min-height: 2.5rem;
  max-height: 16rem;
  border-radius: 8px;
  z-index: 5;
  position: relative;
}

.template-select option {
  padding: 0.45rem 0.55rem;
  font-weight: 600;
  white-space: normal;
}

.template-dropdown-hint {
  margin: 0.4rem 0 0;
  font-size: 0.75rem;
  color: #64748b;
  line-height: 1.4;
}

.bidsupport-main {
  flex: 1;
  min-width: 0;
  background: #fff;
  border-radius: var(--bid-radius);
  box-shadow: var(--bid-shadow);
  border: 1px solid var(--color-gray-200);
  overflow: hidden;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 2.5rem 1.5rem;
  text-align: center;
  color: var(--color-gray-600);
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  margin: 0 auto 1rem;
  border-radius: 14px;
  background: linear-gradient(145deg, #ecfeff 0%, #e0f2fe 100%);
  border: 1px solid #bae6fd;
  color: #0e7490;
}

.empty-icon .ui-icon {
  width: 1.7rem;
  height: 1.7rem;
}

.empty-state h2 {
  color: var(--color-gray-900);
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
}

.empty-state p {
  margin: 0 0 1.25rem;
  max-width: 36rem;
  line-height: 1.5;
}

.empty-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

/* Editor */
.bid-editor {
  padding: 1.75rem 2rem 2.25rem;
}

.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.editor-heading {
  margin: 0;
  font-size: 1.25rem;
  color: var(--color-gray-900);
}

.editor-sub {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--color-gray-600);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: #e0f2fe;
  color: #0369a1;
  white-space: nowrap;
}

.status-pill.is-submitted {
  background: #d1fae5;
  color: #065f46;
}

.status-pill.is-draft {
  background: #f1f5f9;
  color: #475569;
}

.editor-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.75rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.editor-section:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.section-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-gray-900);
  margin: 0 0 1rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.section-header .section-title {
  margin: 0;
}

.form-group {
  margin-bottom: 1.1rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 0;
}

.form-row .form-group {
  margin-bottom: 1.1rem;
}

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 0.4rem;
}

.form-control {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1.5px solid var(--color-gray-300);
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--color-gray-900);
  background: #fff;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

textarea.form-control {
  resize: vertical;
  min-height: 96px;
  line-height: 1.45;
}

.form-control:hover {
  border-color: #94a3b8;
}

.form-control:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.12);
}

.form-control::placeholder {
  color: #94a3b8;
}

/* AI tools */
.ai-tools {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}

.ai-tool-btn {
  padding: 0.85rem 0.75rem;
  background: linear-gradient(135deg, #0e7490 0%, #0891b2 55%, #06b6d4 100%);
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 700;
  transition: transform 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.ai-tool-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(14, 116, 144, 0.28);
}

.ai-tool-btn:active {
  transform: translateY(0);
}

.ai-output {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 10px;
  color: var(--color-gray-700);
  font-size: 0.875rem;
  line-height: 1.55;
  white-space: pre-wrap;
}

.ai-output strong {
  display: block;
  color: var(--color-gray-900);
  margin-bottom: 0.4rem;
  font-size: 0.9rem;
}

/* Cards */
.requirement-card,
.team-member {
  padding: 0.9rem 1rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 10px;
  margin-bottom: 0.65rem;
}

.requirement-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.requirement-card .req-body {
  flex: 1;
  min-width: 0;
}

.requirement-card strong {
  display: block;
  color: var(--color-gray-900);
  margin-bottom: 0.25rem;
}

.requirement-card .req-desc {
  font-size: 0.85rem;
  color: var(--color-gray-600);
  line-height: 1.4;
}

.team-member {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.team-member-body {
  flex: 1;
  min-width: 0;
}

.team-member-meta {
  font-size: 0.8rem;
  color: #64748b;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.team-member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
  flex-shrink: 0;
}

.section-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.45;
}

.section-hint a {
  color: #0e7490;
  font-weight: 700;
  text-decoration: none;
}

.section-hint a:hover {
  text-decoration: underline;
}

.invite-status {
  display: inline-flex;
  margin-top: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.invite-status.is-pending {
  background: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.invite-status.is-confirmed {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.invite-status.is-declined {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

.invite-status.is-manual {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #e2e8f0;
}

.modal-lead {
  margin: 0 0 0.85rem;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.45;
}

.profile-pick-list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border: 1px solid var(--color-gray-200);
  border-radius: 10px;
  padding: 0.5rem;
  background: #f8fafc;
}

.profile-pick {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #fff;
  cursor: pointer;
}

.profile-pick:hover {
  border-color: #a5f3fc;
  background: #ecfeff;
}

.profile-pick.is-taken {
  opacity: 0.55;
  cursor: not-allowed;
}

.profile-pick input {
  margin-top: 0.2rem;
}

.profile-pick-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.profile-pick-body strong {
  font-size: 0.9rem;
  color: #0f172a;
}

.profile-pick-meta {
  font-size: 0.78rem;
  color: #64748b;
  line-height: 1.35;
}

.manual-add-details {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: #475569;
}

.manual-add-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #0e7490;
}

.modal-content-wide {
  max-width: 640px;
}

.list-empty {
  color: #94a3b8;
  font-size: 0.875rem;
  margin: 0;
  padding: 0.5rem 0;
}

/* Buttons */
.btn {
  padding: 0.7rem 1.15rem;
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  font-family: inherit;
  line-height: 1.2;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.25);
}

.btn-secondary {
  background: #fff;
  color: var(--color-gray-700);
  border: 1.5px solid var(--color-gray-300);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
  border-color: #94a3b8;
}

.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
  margin-bottom: 0.55rem;
}

.btn-icon {
  padding: 0.35rem 0.55rem;
  min-width: 2rem;
}

.editor-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: flex-end;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}

.modal-content {
  position: relative;
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.18);
  max-width: 480px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-gray-200);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.15rem 1.35rem;
  border-bottom: 1px solid var(--color-gray-200);
  gap: 0.75rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-close {
  background: var(--color-gray-100);
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--color-gray-600);
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: var(--color-gray-200);
  color: var(--color-gray-900);
}

.modal-body {
  padding: 1.25rem 1.35rem;
  overflow-y: auto;
}

.modal-footer {
  padding: 0.9rem 1.35rem 1.2rem;
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-gray-50);
}

.modal-body .form-group:last-child {
  margin-bottom: 0;
}

.guide-list {
  margin: 0;
  padding-left: 1.15rem;
  color: var(--color-gray-700);
  font-size: 0.9rem;
  line-height: 1.55;
}

.guide-list li {
  margin-bottom: 0.4rem;
}

.template-grid {
  display: grid;
  gap: 0.55rem;
}

.template-btn {
  text-align: left;
  width: 100%;
  padding: 0.85rem 1rem;
  border-radius: 10px;
  border: 1px solid var(--color-gray-200);
  background: #fff;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}

.template-btn:hover {
  border-color: #67e8f9;
  background: #ecfeff;
}

.template-btn strong {
  display: block;
  color: var(--color-gray-900);
  font-size: 0.9rem;
  margin-bottom: 0.2rem;
}

.template-btn span {
  font-size: 0.8rem;
  color: var(--color-gray-600);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  padding: 0.85rem 1.15rem;
  background: var(--color-gray-900);
  color: #fff;
  border-radius: 10px;
  z-index: 2000;
  font-size: 0.875rem;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  max-width: min(360px, calc(100vw - 2rem));
}

.toast[hidden] {
  display: none !important;
}

.toast.success {
  background: var(--color-success);
}

.toast.error {
  background: var(--color-danger);
}

.toast.info {
  background: var(--color-primary);
}

.toast.info {
  background: var(--color-primary);
}

/* Responsive */
@media (max-width: 900px) {
  .bidsupport-container {
    flex-direction: column;
    padding: 0 1rem;
  }

  .bid-breadcrumb {
    padding: 0 1rem;
  }

  .bid-project-context {
    width: calc(100% - 2rem);
  }

  .bidsupport-sidebar {
    width: 100%;
    position: static;
  }

  .bid-editor {
    padding: 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .editor-actions {
    justify-content: stretch;
  }

  .editor-actions .btn {
    flex: 1 1 auto;
  }
}
