/* ============================================================
   PR318 RFI Engine — TradeRail Field Portal
   Class prefix: .pr318-
   TradeRail brand: Primary Orange #FF6B00, Dark #1A1A2E
   ============================================================ */

/* ── Page header ────────────────────────────────────────────── */
.pr318-page-header {
  background: #1A1A2E;
  padding: 20px 24px 0;
  border-bottom: 3px solid #FF6B00;
}

.pr318-page-title {
  font-size: 22px;
  font-weight: 700;
  color: #FFFFFF;
  margin: 0 0 4px 0;
}

.pr318-page-subtitle {
  font-size: 13px;
  color: #FF6B00;
  margin: 0 0 8px 0;
  font-style: italic;
}

.pr318-tab-ribbon {
  height: 4px;
  background: #FF6B00;
  margin-top: 12px;
  border-radius: 2px 2px 0 0;
}

/* ── Lily bar ───────────────────────────────────────────────── */
.pr318-lily-bar {
  background: #1A1A2E;
  border-left: 4px solid #FF6B00;
  padding: 10px 16px;
  margin: 0 0 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pr318-lily-text {
  color: #FFFFFF;
  font-size: 13px;
  line-height: 1.4;
}

/* ── Stats row ──────────────────────────────────────────────── */
.pr318-stats-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 12px 24px;
  background: #f7f7f9;
  border-bottom: 1px solid #e0e0e8;
}

.pr318-stats-wrapper {
  margin-bottom: 0;
}

.pr318-stat-pill {
  background: #FFFFFF;
  border: 1px solid #e0e0e8;
  border-radius: 6px;
  padding: 8px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}

.pr318-stat-label {
  font-size: 11px;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pr318-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #1A1A2E;
}

.pr318-overdue-count {
  color: #CC0000;
}

/* ── Action bar ─────────────────────────────────────────────── */
.pr318-action-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 24px;
  background: #FFFFFF;
  border-bottom: 1px solid #e0e0e8;
}

/* ── Filter bar ─────────────────────────────────────────────── */
.pr318-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.pr318-filter-status,
.pr318-filter-priority {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  background: #FFFFFF;
  color: #1A1A2E;
  cursor: pointer;
}

.pr318-filter-status:focus,
.pr318-filter-priority:focus {
  outline: none;
  border-color: #FF6B00;
}

.pr318-search-input {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  min-width: 200px;
  background: #FFFFFF;
  color: #1A1A2E;
}

.pr318-search-input:focus {
  outline: none;
  border-color: #FF6B00;
}

/* ── Buttons ────────────────────────────────────────────────── */
.pr318-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.pr318-btn-primary {
  background: #FF6B00;
  color: #FFFFFF;
}

.pr318-btn-primary:hover {
  background: #e55e00;
}

.pr318-btn-secondary {
  background: #1A1A2E;
  color: #FFFFFF;
}

.pr318-btn-secondary:hover {
  background: #2a2a3e;
}

.pr318-btn-ghost {
  background: transparent;
  color: #6B7280;
  border: 1px solid #d1d5db;
}

.pr318-btn-ghost:hover {
  background: #f3f4f6;
}

.pr318-btn-danger {
  background: #CC0000;
  color: #FFFFFF;
}

.pr318-btn-danger:hover {
  background: #aa0000;
}

.pr318-btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.pr318-btn-new {
  margin-right: 4px;
}

.pr318-btn-download {
  margin-right: 4px;
}

/* ── Table ──────────────────────────────────────────────────── */
.pr318-list-wrapper {
  padding: 0 24px 24px;
  overflow-x: auto;
}

.pr318-table {
  width: 100%;
  border-collapse: collapse;
  background: #FFFFFF;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  margin-top: 12px;
  table-layout: auto;
}

.pr318-table thead tr {
  background: #1A1A2E;
}

.pr318-table th {
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #FFFFFF;
  text-align: left;
  white-space: nowrap;
}

.pr318-table td {
  padding: 10px 12px;
  font-size: 13px;
  color: #374151;
  border-bottom: 1px solid #f0f0f4;
  vertical-align: top;
}

.pr318-row:hover td {
  background: #fafafa;
}

.pr318-row-overdue td {
  background: #fff0f0;
}

.pr318-row-overdue:hover td {
  background: #ffe8e8;
}

.pr318-subject-cell {
  max-width: 280px;
}

.pr318-subject-link {
  color: #FF6B00;
  cursor: pointer;
  font-weight: 500;
  text-decoration: underline;
}

.pr318-subject-link:hover {
  color: #e55e00;
}

.pr318-actions-cell {
  white-space: nowrap;
}

/* ── Badges ─────────────────────────────────────────────────── */
.pr318-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #FFFFFF;
  white-space: nowrap;
}

/* Priority badges */
.pr318-priority-urgent {
  background: #CC0000;
}

.pr318-priority-high {
  background: #FF6B00;
}

.pr318-priority-medium {
  background: #2563EB;
}

.pr318-priority-low {
  background: #6B7280;
}

/* Status badges */
.pr318-status-open {
  background: #FF6B00;
}

.pr318-status-answered {
  background: #16A34A;
}

.pr318-status-closed {
  background: #6B7280;
}

.pr318-status-voided {
  background: #9CA3AF;
}

/* ── New RFI form ────────────────────────────────────────────── */
.pr318-form-panel {
  background: #FFFFFF;
  border: 1px solid #e0e0e8;
  border-radius: 6px;
  padding: 20px 24px;
  margin: 12px 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pr318-form-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0 0 16px 0;
}

.pr318-form-group {
  margin-bottom: 14px;
}

.pr318-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pr318-required {
  color: #CC0000;
}

.pr318-form-input,
.pr318-form-textarea,
.pr318-form-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 13px;
  color: #1A1A2E;
  background: #FFFFFF;
  box-sizing: border-box;
}

.pr318-form-input:focus,
.pr318-form-textarea:focus,
.pr318-form-select:focus {
  outline: none;
  border-color: #FF6B00;
}

.pr318-form-textarea {
  resize: vertical;
  min-height: 80px;
}

.pr318-form-row {
  display: flex;
  gap: 16px;
}

.pr318-form-row .pr318-form-group {
  flex: 1;
}

.pr318-form-error {
  background: #fff0f0;
  border: 1px solid #CC0000;
  border-radius: 4px;
  padding: 8px 12px;
  color: #CC0000;
  font-size: 13px;
  margin-bottom: 12px;
}

.pr318-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

/* ── Detail panel ────────────────────────────────────────────── */
.pr318-detail-panel {
  background: #FFFFFF;
  border: 1px solid #e0e0e8;
  border-radius: 6px;
  padding: 20px 24px;
  margin: 12px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}

.pr318-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
}

.pr318-detail-title {
  font-size: 16px;
  font-weight: 700;
  color: #1A1A2E;
  margin: 0;
  flex: 1;
}

.pr318-btn-close-panel {
  flex-shrink: 0;
}

.pr318-detail-meta {
  border: 1px solid #f0f0f4;
  border-radius: 4px;
  padding: 12px;
  margin-bottom: 16px;
  background: #f9f9fb;
}

.pr318-detail-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 13px;
}

.pr318-detail-label {
  font-weight: 600;
  color: #6B7280;
  min-width: 120px;
  flex-shrink: 0;
}

.pr318-detail-section-title {
  font-size: 13px;
  font-weight: 700;
  color: #1A1A2E;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 8px 0;
}

.pr318-detail-description,
.pr318-detail-response {
  margin-bottom: 16px;
}

.pr318-detail-desc-text,
.pr318-detail-response-text {
  font-size: 13px;
  color: #374151;
  line-height: 1.6;
  margin: 0;
  background: #f9f9fb;
  border: 1px solid #e0e0e8;
  border-radius: 4px;
  padding: 10px 12px;
}

.pr318-detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #e0e0e8;
  align-items: flex-start;
}

/* ── Two-tap confirm ─────────────────────────────────────────── */
.pr318-confirm-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pr318-confirm-pending {
  background: #f9f9fb;
  border: 1px solid #e0e0e8;
  border-radius: 4px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 240px;
}

.pr318-confirm-text {
  font-size: 13px;
  color: #374151;
  margin: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 767px) {
  .pr318-page-header {
    padding: 14px 14px 0;
  }

  .pr318-stats-row {
    padding: 10px 14px;
    gap: 8px;
  }

  .pr318-stat-pill {
    min-width: 80px;
    padding: 6px 10px;
  }

  .pr318-stat-value {
    font-size: 18px;
  }

  .pr318-action-bar {
    padding: 10px 14px;
  }

  .pr318-list-wrapper {
    padding: 0 14px 14px;
  }

  .pr318-form-panel,
  .pr318-detail-panel {
    margin: 10px 14px;
  }

  .pr318-form-row {
    flex-direction: column;
    gap: 0;
  }

  .pr318-table th,
  .pr318-table td {
    padding: 8px;
    font-size: 12px;
  }

  .pr318-detail-label {
    min-width: 90px;
  }

  .pr318-detail-actions {
    flex-direction: column;
  }

  .pr318-filter-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pr318-search-input {
    min-width: unset;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .pr318-table th:nth-child(5),
  .pr318-table td:nth-child(5),
  .pr318-table th:nth-child(6),
  .pr318-table td:nth-child(6) {
    display: none;
  }
}
