/* VitalDamageDetection Portal — scrollable layout + analysis UI */

.vdd-brand-logo {
  display: block;
  width: auto;
  height: auto;
  max-height: 52px;
  max-width: min(360px, 62vw);
  object-fit: contain;
  object-position: left center;
}

.portal-brand.vdd-brand-lockup {
  gap: 0;
  align-items: center;
}

.portal-brand.vdd-brand-lockup .portal-brand-mark,
.portal-brand.vdd-brand-lockup .portal-brand-text {
  display: none;
}

.vdd-login-brand {
  margin-bottom: 1.25rem;
}

.vdd-login-brand .vdd-brand-logo {
  max-height: 88px;
  max-width: min(520px, 92vw);
  width: auto;
  height: auto;
  object-fit: contain;
}

html[data-portal-shell="true"].dd-scroll-root,
html[data-portal-shell="true"].dd-scroll-root body {
  height: auto;
  overflow: auto;
}

.portal-app-scrollable {
  min-height: 100dvh;
  height: auto;
  overflow: visible;
}

.portal-body-scrollable,
.portal-main-scrollable {
  overflow: visible;
  min-height: 0;
}

.dd-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

.dd-page-header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 0.5rem;
}

.dd-lead {
  color: var(--text-muted, var(--muted));
  margin: 0 0 1.25rem;
  line-height: 1.5;
}

.dd-muted {
  color: var(--text-muted, var(--muted));
  font-size: 0.9rem;
}

.dd-card {
  margin-bottom: 1.25rem;
}

.dd-card-static {
  cursor: default;
  text-decoration: none;
  color: inherit;
}

.dd-upload-zone {
  border: 2px dashed var(--sidebar-border, rgba(128,128,128,0.35));
  border-radius: 12px;
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--portal-surface, rgba(255,255,255,0.04));
  transition: border-color 0.15s, background 0.15s;
}

.dd-upload-zone.dd-dragover {
  border-color: var(--portal-accent, #0ea5e9);
  background: rgba(14, 165, 233, 0.08);
}

.dd-thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.75rem;
  list-style: none;
  padding: 1rem 0 0;
  margin: 0;
}

.dd-thumb {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--sidebar-border);
  background: var(--portal-surface);
}

.dd-thumb img {
  width: 100%;
  height: 100px;
  object-fit: cover;
  display: block;
}

.dd-thumb-meta {
  padding: 0.4rem 0.5rem;
  font-size: 0.75rem;
}

.dd-thumb-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  border: none;
  border-radius: 6px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  cursor: pointer;
  font-size: 0.7rem;
  padding: 0.2rem 0.45rem;
}

.dd-checklist {
  margin: 0;
  padding-left: 1.25rem;
  columns: 2;
  gap: 1.5rem;
}

.dd-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.dd-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 1.5rem 0;
  flex-wrap: wrap;
}

.dd-loading {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  background: var(--portal-surface);
  border: 1px solid var(--sidebar-border);
}

.dd-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--sidebar-border);
  border-top-color: var(--portal-accent, #0ea5e9);
  border-radius: 50%;
  animation: dd-spin 0.8s linear infinite;
}

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

.hidden { display: none !important; }

.dd-badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: capitalize;
  background: var(--portal-surface);
  border: 1px solid var(--sidebar-border);
  margin-right: 0.35rem;
  margin-bottom: 0.35rem;
}

.dd-badge-warn { border-color: #f59e0b; color: #f59e0b; }
.dd-badge-ok { border-color: #10b981; color: #10b981; }
.dd-badge-danger { border-color: #ef4444; color: #ef4444; }

.dd-result-section {
  margin-bottom: 1.25rem;
}

.dd-result-section h3 {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
}

.dd-finding-card {
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--portal-surface);
}

.dd-report-box {
  font-family: ui-monospace, monospace;
  font-size: 0.8rem;
  white-space: pre-wrap;
  background: var(--portal-surface);
  border: 1px solid var(--sidebar-border);
  border-radius: 10px;
  padding: 1rem;
  max-height: 420px;
  overflow: auto;
}

.dd-disclaimer {
  margin-top: 2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.portal-field select,
.portal-field textarea {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  border: 1px solid var(--sidebar-border);
  background: var(--input-bg, var(--portal-surface));
  color: var(--text);
  font: inherit;
}

.dd-chat-layout {
  max-width: 920px;
  margin: 0 auto;
}

.dd-chat-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 420px;
}

.dd-chat-messages {
  flex: 1;
  min-height: 280px;
  max-height: 52vh;
  overflow-y: auto;
  padding: 1rem;
  border-radius: 12px;
  border: 1px solid var(--sidebar-border);
  background: rgba(0, 0, 0, 0.18);
}

.dd-chat-empty {
  color: var(--text-muted, #94a3b8);
  font-size: 0.95rem;
}

.dd-chat-message {
  margin-bottom: 0.85rem;
}

.dd-chat-user .dd-chat-bubble {
  margin-left: auto;
  max-width: 85%;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.dd-chat-assistant .dd-chat-bubble {
  max-width: 92%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--sidebar-border);
}

.dd-chat-bubble {
  padding: 0.75rem 0.9rem;
  border-radius: 12px;
  line-height: 1.45;
}

.dd-chat-form {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
}

.dd-chat-form textarea {
  flex: 1;
  resize: vertical;
  min-height: 52px;
}

.dd-chat-status {
  min-height: 1.25rem;
  font-size: 0.85rem;
  color: var(--text-muted, #94a3b8);
}

.dd-chat-status.error {
  color: #f87171;
}
