/* Portal extras: shared components for chat attachments, deadlines, timeline, quick replies, gate */

/* ---------- Attachment card inside chat bubbles ---------- */
.chat-file-card {
  margin-top: 0.6rem; padding: 0.5rem 0.8rem; background: #f8fafc; border: 1px solid #cbd5e1;
  border-radius: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; color: #0b1a30;
}
.chat-file-card.dark { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.22); color: #fff; }
.chat-file-info { display: flex; align-items: center; gap: 8px; min-width: 0; }
.chat-file-info > i { font-size: 1.35rem; color: var(--primary-navy); flex-shrink: 0; }
.chat-file-card.dark .chat-file-info > i { color: var(--gold-light); }
.chat-file-info > div { min-width: 0; }
.chat-file-name { font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.chat-file-size { font-size: 0.7rem; color: #64748b; }
.chat-file-card.dark .chat-file-size { color: #cbd5e1; }
.chat-file-actions { display: flex; gap: 6px; flex-shrink: 0; }
.chat-file-actions a {
  padding: 3px 9px; font-size: 0.75rem; border-radius: 5px; text-decoration: none; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px; transition: transform .15s, filter .15s;
}
.chat-file-actions a:hover { transform: translateY(-1px); filter: brightness(1.06); }
.chat-file-actions .cf-view { background: var(--primary-navy); color: #fff; }
.chat-file-actions .cf-dl { background: #e2e8f0; color: #334155; }
.chat-file-card.dark .cf-view { background: var(--gold-accent); color: #0b1a30; }
.chat-file-card.dark .cf-dl { background: rgba(255,255,255,0.2); color: #fff; }

/* ---------- Read receipts ---------- */
.chat-seen { font-size: 0.68rem; color: #10b981; font-weight: 600; margin-left: 6px; display: inline-flex; align-items: center; gap: 2px; }
.chat-seen.sent { color: #94a3b8; }

/* ---------- Deadline / limitation chips ---------- */
.dl-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 50px;
  font-size: 0.74rem; font-weight: 700; white-space: nowrap; border: 1px solid transparent;
}
.dl-chip.ok { background: #dcfce7; color: #166534; border-color: #bbf7d0; }
.dl-chip.soon { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.dl-chip.urgent { background: #fee2e2; color: #b91c1c; border-color: #fecaca; animation: dlPulse 2s infinite; }
.dl-chip.expired { background: #7f1d1d; color: #fff; }
.dl-chip.unknown { background: #f1f5f9; color: #64748b; border-color: #e2e8f0; }
@keyframes dlPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,.35); } 50% { box-shadow: 0 0 0 5px rgba(220,38,38,0); } }

.deadline-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; margin-bottom: 1rem;
}
.deadline-card {
  border: 1px solid #e2e8f0; border-radius: 12px; padding: 0.95rem 1.1rem; background: #fff; display: flex; flex-direction: column; gap: 4px;
}
.deadline-card .dc-label { font-size: 0.68rem; letter-spacing: 0.06em; text-transform: uppercase; color: #64748b; font-weight: 700; }
.deadline-card .dc-value { font-family: var(--font-serif); font-size: 1.25rem; color: var(--primary-navy); font-weight: 700; }
.deadline-card .dc-sub { font-size: 0.78rem; color: #64748b; }
.deadline-card.level-urgent { border-color: #fecaca; background: #fff7f7; }
.deadline-card.level-urgent .dc-value { color: #b91c1c; }
.deadline-card.level-expired { border-color: #fca5a5; background: #fef2f2; }
.deadline-card.level-expired .dc-value { color: #7f1d1d; }
.deadline-card.level-soon { border-color: #fde68a; background: #fffbeb; }
.deadline-card.level-ok .dc-value { color: #166534; }

/* ---------- Activity timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 11px; top: 6px; bottom: 6px; width: 2px; background: #e2e8f0; }
.timeline li { position: relative; padding: 0 0 1rem 32px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .tl-dot {
  position: absolute; left: 2px; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  border: 2px solid var(--gold-accent); color: var(--gold-hover); display: flex; align-items: center; justify-content: center; font-size: 0.7rem;
}
.timeline li.tl-status .tl-dot { border-color: #0284c7; color: #0284c7; }
.timeline li.tl-document .tl-dot { border-color: #7c3aed; color: #7c3aed; }
.timeline li.tl-hearing .tl-dot { border-color: #dc2626; color: #dc2626; }
.timeline .tl-title { font-size: 0.9rem; font-weight: 600; color: #0b1a30; line-height: 1.35; }
.timeline .tl-meta { font-size: 0.74rem; color: #94a3b8; margin-top: 2px; }
.timeline .tl-private { font-size: 0.65rem; background: #f1f5f9; color: #64748b; border-radius: 4px; padding: 1px 6px; margin-left: 6px; font-weight: 700; }

/* ---------- Quick replies ---------- */
.quick-replies { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.7rem; align-items: center; }
.quick-replies .qr-label { font-size: 0.72rem; color: #94a3b8; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 2px; }
.qr-chip {
  border: 1px solid #e2e8f0; background: #fff; color: #334155; border-radius: 50px; padding: 4px 12px; font-size: 0.78rem;
  font-weight: 600; cursor: pointer; font-family: inherit; transition: all .15s;
}
.qr-chip:hover { border-color: var(--gold-accent); background: #fffbeb; color: #92400e; transform: translateY(-1px); }

/* ---------- Unread badges ---------- */
.unread-pill {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px;
  background: #dc2626; color: #fff; border-radius: 50px; font-size: 0.72rem; font-weight: 800; margin-left: 6px; vertical-align: middle;
  box-shadow: 0 2px 6px rgba(220,38,38,.4);
}
tr.row-unread td:first-child { box-shadow: inset 3px 0 0 #dc2626; }

/* ---------- Metrics: fluid grid so extra cards fit ---------- */
.metrics-row { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important; }
.metric-card.clickable { cursor: pointer; transition: transform .15s, box-shadow .15s; }
.metric-card.clickable:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11,26,48,0.1); }
.metric-card.active-filter { outline: 2px solid var(--gold-accent); }

/* ---------- Toolbar buttons ---------- */
.toolbar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-left: auto; align-items: flex-end; }
.btn-tool {
  display: inline-flex; align-items: center; gap: 6px; padding: 0.55rem 0.95rem; border-radius: 8px; border: 1px solid #cbd5e1;
  background: #fff; color: #334155; font-weight: 700; font-size: 0.82rem; cursor: pointer; font-family: inherit; transition: all .15s;
}
.btn-tool:hover { border-color: var(--gold-accent); color: #92400e; background: #fffbeb; }
.btn-tool:disabled { opacity: .6; cursor: wait; }

/* ---------- Verification gate on tracking page ---------- */
.verify-card {
  max-width: 520px; margin: 0 auto; background: #fff; border: 1px solid #e2e8f0; border-radius: 16px; padding: 2rem 1.8rem;
  box-shadow: 0 18px 40px rgba(11,26,48,0.08); text-align: center;
}
.verify-card .vc-icon {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 0.9rem; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #fef3c7, #fde68a); color: #92400e; font-size: 1.6rem;
}
.verify-card h3 { font-family: var(--font-serif); color: var(--primary-navy); margin: 0 0 0.4rem; font-size: 1.35rem; }
.verify-card p { color: #64748b; font-size: 0.9rem; line-height: 1.55; margin: 0 0 1.2rem; }
.verify-card input {
  width: 100%; padding: 0.85rem 1rem; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 1rem; font-family: inherit;
  text-align: center; letter-spacing: 0.04em; outline: none; margin-bottom: 0.8rem;
}
.verify-card input:focus { border-color: var(--gold-accent); box-shadow: 0 0 0 3px rgba(197,160,89,.2); }
.verify-card .vc-error { color: #b91c1c; font-size: 0.84rem; margin-bottom: 0.8rem; min-height: 1.1em; font-weight: 600; }
.verify-card .vc-note { font-size: 0.74rem; color: #94a3b8; margin: 1rem 0 0; display: flex; gap: 6px; justify-content: center; align-items: center; }

/* ---------- Modal for reason prompts (replaces native prompt) ---------- */
.reason-overlay {
  position: fixed; inset: 0; background: rgba(6,14,27,0.55); backdrop-filter: blur(3px); z-index: 4000;
  display: flex; align-items: center; justify-content: center; padding: 1rem; animation: fadeIn .15s;
}
.reason-box { background: #fff; border-radius: 14px; width: 100%; max-width: 460px; padding: 1.5rem; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.reason-box h4 { margin: 0 0 0.3rem; font-family: var(--font-serif); color: var(--primary-navy); font-size: 1.15rem; }
.reason-box p { margin: 0 0 0.9rem; color: #64748b; font-size: 0.86rem; }
.reason-box textarea { width: 100%; min-height: 90px; padding: 0.7rem 0.9rem; border: 1px solid #cbd5e1; border-radius: 8px; font-family: inherit; font-size: 0.92rem; resize: vertical; outline: none; }
.reason-box textarea:focus { border-color: var(--gold-accent); box-shadow: 0 0 0 3px rgba(197,160,89,.18); }
.reason-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1rem; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Print: clean court brief ---------- */
@media print {
  .admin-header, .back-link-btn, .dossier-actions, .admin-chat-controls, .quick-replies, #adminChatFilePreview,
  .toast-stack, .btn-tool, .toolbar-actions { display: none !important; }
  .dossier-header { position: static !important; background: #fff !important; color: #000 !important; border-bottom: 2px solid #000; }
  .dossier-header * { color: #000 !important; }
  #adminChatMessages { max-height: none !important; overflow: visible !important; }
  body { background: #fff !important; }
}

/* Six metric cards on one row (desktop) */
@media (min-width: 1101px) {
  .metrics-row { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.8rem; }
  .metrics-row .metric-card { padding: 0.9rem; gap: 10px; }
  .metrics-row .metric-icon { width: 38px; height: 38px; font-size: 1.15rem; flex-shrink: 0; }
  .metrics-row .metric-info h3 { font-size: 1.5rem; }
  .metrics-row .metric-info p { font-size: 0.68rem; line-height: 1.25; }
}
