/* ═══════════════════════════════════════════════════════════════════════════
   EXPERTS REQUESTS — View and manage submitted requests
   ═══════════════════════════════════════════════════════════════════════════ */

#experts-requests {
  position: fixed;
  inset: 0;
  background: #F9F8F6;
  z-index: 10000;
  overflow: hidden;
  animation: requestsFadeIn 0.2s ease;
}

@keyframes requestsFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

#experts-requests.fade-out {
  animation: requestsFadeOut 0.2s ease forwards;
}

@keyframes requestsFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.experts-requests-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Header ────────────────────────────────────────────────────────────────── */

.experts-requests-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #E8E7E3;
}

.experts-requests-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid #E8E7E3;
  border-radius: 8px;
  cursor: pointer;
  color: #5C5A54;
  transition: all 0.15s;
}

.experts-requests-back-btn:hover {
  background: #F4F3EE;
  border-color: #ff005c;
  color: #1A1918;
}

.experts-requests-title-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.experts-requests-title {
  font-size: 20px;
  font-weight: 600;
  color: #1A1918;
  margin: 0;
}

.experts-requests-header-spacer {
  width: 40px;
}

/* ─── Admin Badge ───────────────────────────────────────────────────────────── */

.admin-badge {
  padding: 4px 8px;
  background: linear-gradient(135deg, #7C3AED 0%, #9333EA 100%);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-radius: 4px;
  text-transform: uppercase;
}

#experts-requests.admin-mode .experts-requests-title-area {
  gap: 10px;
}

/* ─── Content ───────────────────────────────────────────────────────────────── */

.experts-requests-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── Toolbar ───────────────────────────────────────────────────────────────── */

.experts-requests-toolbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #E8E7E3;
}

.experts-requests-filters {
  display: flex;
  gap: 16px;
}

.experts-requests-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.experts-requests-filter label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8A8880;
}

.experts-requests-filter select {
  padding: 8px 32px 8px 12px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C5A54' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 10px center no-repeat;
  border: 1px solid #E8E7E3;
  border-radius: 6px;
  font-size: 13px;
  color: #1A1918;
  cursor: pointer;
  appearance: none;
  min-width: 160px;
}

.experts-requests-filter select:hover {
  border-color: #CDCBC4;
}

.experts-requests-filter select:focus {
  outline: none;
  border-color: #ff005c;
  box-shadow: 0 0 0 3px rgba(255, 0, 92, 0.1);
}

.experts-requests-stats {
  display: flex;
  gap: 16px;
}

.requests-stat {
  font-size: 13px;
  color: #5C5A54;
}

.requests-stat.pending {
  color: #B45309;
  font-weight: 500;
}

/* ─── Requests List ─────────────────────────────────────────────────────────── */

.experts-requests-list {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.experts-requests-loading,
.experts-requests-empty,
.experts-requests-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 40px;
  color: #5C5A54;
}

.experts-requests-loading .spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #E8E7E3;
  border-top-color: #ff005c;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.experts-requests-empty svg,
.experts-requests-error svg {
  margin-bottom: 16px;
  color: #CDCBC4;
}

.experts-requests-empty h3,
.experts-requests-error h3 {
  font-size: 18px;
  font-weight: 600;
  color: #1A1918;
  margin: 0 0 8px;
}

.experts-requests-empty p,
.experts-requests-error p {
  font-size: 14px;
  margin: 0;
  max-width: 300px;
}

.retry-btn {
  margin-top: 20px;
  padding: 10px 20px;
  background: #ff005c;
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

/* ─── Request Card ──────────────────────────────────────────────────────────── */

.experts-request-card {
  background: #fff;
  border: 1px solid #E8E7E3;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.experts-request-card:hover {
  border-color: #ff005c;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.experts-request-card-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.experts-request-type-badge {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'SF Mono', 'IBM Plex Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  border-radius: 6px;
}

.experts-request-info {
  flex: 1;
  min-width: 0;
}

.experts-request-title {
  font-size: 15px;
  font-weight: 600;
  color: #1A1918;
  margin: 0 0 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.experts-request-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #8A8880;
}

.experts-request-divider {
  color: #CDCBC4;
}

.experts-request-status {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}

.experts-request-card-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #F4F3EE;
}

.experts-request-requester {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #5C5A54;
}

.experts-request-notes {
  font-size: 13px;
  color: #8A8880;
  margin: 8px 0 0;
  line-height: 1.5;
}

/* ─── Request Detail Modal ──────────────────────────────────────────────────── */

.experts-request-modal {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: center;
}

.experts-request-modal.hidden {
  display: none;
}

.experts-request-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.experts-request-modal-content {
  position: relative;
  width: 100%;
  max-width: 600px;
  max-height: 80vh;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 20px;
}

.experts-request-modal-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #E8E7E3;
}

.experts-request-modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #1A1918;
  margin: 0;
}

.experts-request-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  border-radius: 6px;
  color: #5C5A54;
  cursor: pointer;
  transition: all 0.15s;
}

.experts-request-modal-close:hover {
  background: #F4F3EE;
  color: #1A1918;
}

.experts-request-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

.request-detail-section {
  margin-bottom: 24px;
}

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

.request-detail-section h4 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8A8880;
  margin: 0 0 12px;
}

.request-detail-row {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 8px 0;
}

.request-detail-label {
  flex-shrink: 0;
  width: 100px;
  font-size: 13px;
  color: #8A8880;
}

.request-detail-value {
  flex: 1;
  font-size: 14px;
  color: #1A1918;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.request-detail-email {
  color: #ff005c;
  text-decoration: none;
  font-size: 13px;
}

.request-detail-email:hover {
  text-decoration: underline;
}

.request-detail-criteria {
  background: #F9F8F6;
  border-radius: 8px;
  padding: 16px;
}

.request-detail-criterion {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid #E8E7E3;
}

.request-detail-criterion:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.request-detail-criterion:first-child {
  padding-top: 0;
}

.criterion-key {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #8A8880;
}

.criterion-value {
  font-size: 14px;
  color: #1A1918;
}

.request-detail-notes {
  font-size: 14px;
  color: #5C5A54;
  line-height: 1.6;
  margin: 0;
  white-space: pre-wrap;
}

/* ─── Modal Footer ──────────────────────────────────────────────────────────── */

.experts-request-modal-footer {
  flex-shrink: 0;
  padding: 16px 24px;
  border-top: 1px solid #E8E7E3;
  background: #F9F8F6;
}

.request-detail-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.request-status-select {
  padding: 10px 36px 10px 14px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235C5A54' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") right 12px center no-repeat;
  border: 1px solid #E8E7E3;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: #1A1918;
  cursor: pointer;
  appearance: none;
  min-width: 160px;
}

.request-status-select:focus {
  outline: none;
  border-color: #ff005c;
  box-shadow: 0 0 0 3px rgba(255, 0, 92, 0.1);
}

.request-delete-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: #fff;
  border: 1px solid #FEE2E2;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #991B1B;
  cursor: pointer;
  transition: all 0.15s;
}

.request-delete-btn:hover {
  background: #FEE2E2;
  border-color: #FECACA;
}

/* ─── Admin Workflow Actions ────────────────────────────────────────────────── */

.request-workflow-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.workflow-progression {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.workflow-btn-back {
  background: #fff;
  border: 1px solid #E8E7E3;
  color: #5C5A54;
}

.workflow-btn-back:hover {
  background: #F4F3EE;
  border-color: #CDCBC4;
}

.workflow-btn-forward {
  background: var(--btn-bg, #DBEAFE);
  border: 1px solid var(--btn-color, #1D4ED8);
  color: var(--btn-color, #1D4ED8);
}

.workflow-btn-forward:hover {
  filter: brightness(0.95);
}

.workflow-btn-decline {
  background: #fff;
  border: 1px solid #FEE2E2;
  color: #991B1B;
}

.workflow-btn-decline:hover {
  background: #FEE2E2;
  border-color: #FECACA;
}

/* ─── Read-only Footer (non-admin) ──────────────────────────────────────────── */

.request-detail-readonly {
  display: flex;
  align-items: center;
  gap: 12px;
}

.readonly-label {
  font-size: 13px;
  color: #8A8880;
}

/* ─── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .experts-requests-toolbar {
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
  }

  .experts-requests-filters {
    flex-direction: column;
  }

  .experts-requests-filter select {
    min-width: 100%;
  }

  .experts-requests-stats {
    justify-content: center;
  }

  .experts-request-modal-content {
    max-height: 90vh;
    margin: 10px;
    border-radius: 12px;
  }

  .request-detail-row {
    flex-direction: column;
    gap: 4px;
  }

  .request-detail-label {
    width: auto;
  }

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

  .request-status-select,
  .request-delete-btn {
    width: 100%;
    justify-content: center;
  }
}
