/**
 * projects.css — Module-specific styles for Projects
 * spec: §6.2 Coloured-pill and badge palette
 * visual: U2 SS1, SS3, SS4, SS5, SS6
 */

/* ── Module CSS custom properties ── */
:root {
  --pill-pending-bg:       #f3f4f6;
  --pill-pending-text:     #374151;
  --pill-partial-bg:       #fef3c7;
  --pill-partial-text:     #92400e;
  --pill-full-bg:          #dcfce7;
  --pill-full-text:        #166534;
  --pill-on-hold-text:     #374151;
  --pill-on-hold-border:   #9ca3af;
}

/* ── Status pills (spec §6.2) ── */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  line-height: 1.5;
}

.pill-pending {
  background: var(--pill-pending-bg);
  color: var(--pill-pending-text);
}

.pill-partial {
  background: var(--pill-partial-bg);
  color: var(--pill-partial-text);
}

.pill-full {
  background: var(--pill-full-bg);
  color: var(--pill-full-text);
}

.pill-on-hold {
  background: transparent;
  color: var(--pill-on-hold-text);
  border: 1px solid var(--pill-on-hold-border);
}

.pill-na {
  background: #f1f5f9;
  color: #94a3b8;
  border: 1px solid #e2e8f0;
  font-style: italic;
}

/* ── Urgency badges (spec §6.2, visual U2 SS1.1) ── */
.badge-normal {
  background: #f3f4f6;
  color: #374151;
}

.badge-urgent {
  background: #fef3c7;
  color: #92400e;
}

.badge-super-urgent {
  background: #fee2e2;
  color: #991b1b;
}

.badge-orphaned {
  background: var(--danger-bg);
  color: var(--danger-text);
}

/* ── Monospace cell (visual U2 SS3.3) ── */
.cell-mono {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary, #0f172a);
}

/* ── Project-specific filter sizing (visual U2 SS6.1) ── */
.filter-select {
  width: auto;          /* override design-system's width:100% on .form-select */
  height: 34px;
  font-size: 12px;
  padding: 0 28px 0 10px;
  min-width: 140px;
  max-width: 200px;
}

.filter-date-input {
  width: 130px !important; /* override design-system's width:100% on .form-input */
  height: 34px;
  font-size: 12px;
  padding: 0 10px;
}

/* ── Orphaned banner (visual U2 SS6.3) ── */
.orphaned-banner {
  background: var(--danger-bg);
  color: var(--danger-text);
  border: 1px solid #fca5a5;
  border-radius: 6px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Discard strip (visual U2 SS6.4) ── */
.discard-strip {
  background: var(--warning-bg);
  color: var(--warning-text);
  border: 1px solid #fcd34d;
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.discard-strip-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ── Same-as-billing tag (visual U2 SS6.5) ── */
.same-as-billing-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--info-bg);
  color: var(--info-text);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
}

/* ── Edit actions sticky footer (visual U2 SS4.2) ── */
.edit-actions-sticky {
  position: sticky;
  bottom: 0;
  background: var(--surface, #ffffff);
  border-top: 1px solid var(--border, #e2e8f0);
  padding: 14px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.06);
}

/* ── Diff list in save confirmation modal (visual U2 SS5.1) ── */
.diff-list {
  list-style: disc;
  padding-left: 20px;
  margin: 0;
}

.diff-list li {
  font-size: 13px;
  color: var(--text-secondary, #475569);
  margin-bottom: 4px;
}

.diff-old {
  color: var(--text-muted);
  text-decoration: line-through;
}

.diff-new {
  color: var(--text-primary, #0f172a);
  font-weight: 500;
}

/* ── Detail label-value grid ── */
.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 32px;
}

/* ── Form container centering (visual U2 SS2.6) ── */
.pv2-form-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 24px;
}

/* ── Table truncation ── */
.cell-truncate {
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  max-width: 200px;
}

/* ── Contact link styling ── */
.contact-link {
  color: var(--primary, #3b82f6);
  text-decoration: none;
  cursor: pointer;
}

.contact-link:hover {
  text-decoration: underline;
}

.contact-link-disabled {
  color: var(--text-muted, #94a3b8);
  cursor: default;
  text-decoration: none;
}

/* ── Autocomplete positioned container ── */
.autocomplete-wrap {
  position: relative;
}

/* ── sr-only helper text ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Mobile full-screen modal (visual U2 SS5.4) ── */
@media (max-width: 767px) {
  .modal-fullscreen-mobile .modal {
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    margin: 0;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .edit-actions-sticky {
    position: fixed;
    left: 0;
    right: 0;
    padding: 12px 16px;
  }

  .pv2-form-container {
    padding: 16px 12px;
  }
}

@media (max-width: 1023px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .pv2-form-container {
    max-width: 100%;
    padding: 20px 16px;
  }
}

/* Project completion status badges — spec: project-status-ui-spec §4 */
.badge-active-project {
  background: var(--badge-normal-bg, #dbeafe);
  color: var(--badge-normal-color, #1e40af);
}
.badge-on-hold {
  background: var(--badge-urgent-bg, #fef3c7);
  color: var(--badge-urgent-color, #92400e);
}
.badge-completed {
  background: var(--pill-full-bg, #dcfce7);
  color: var(--pill-full-color, #166534);
}
.badge-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

/* Row background colors by project_status — spec: project-status-ui-spec §3.3 */
.row-completed { background-color: #f0fdf4 !important; }
.row-cancelled { background-color: #fef2f2 !important; }
.row-on-hold { background-color: #fffbeb !important; }
