/* SMDG extensions on top of ReportAgent dashboard styles */

.header-actions .header-lang {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.header-actions .language-selector {
  margin-left: 0;
}

.file-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}

.file-picker__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker__name {
  font-size: .875rem;
}

.file-list .file-item,
.file-list .list-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .75rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--bg-card);
}

.file-info {
  flex: 1;
  min-width: 200px;
}

.file-name { font-weight: 600; margin-bottom: .2rem; }
.file-size, .file-id, .patient-id { font-size: .8rem; color: var(--text-muted); }
.file-actions { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }

.btn-primary, .btn-secondary, .btn-success, .btn-danger, .btn-info, .btn-small {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .35rem .65rem;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-size: .8rem;
}
.btn-primary, .btn-success { background: var(--primary); color: #fff; }
.btn-secondary, .btn-info { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-small { font-size: .75rem; }

.password-strength {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-top: .35rem;
  overflow: hidden;
}
.strength-bar { height: 100%; width: 0; transition: width .2s, background .2s; }

.info-list { margin: 0; padding-left: 1.1rem; }
.info-list li { margin-bottom: .35rem; }

.file-audit-tree details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: .5rem;
  background: var(--bg-card);
}
.file-audit-group__summary {
  cursor: pointer;
  padding: .75rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: .5rem;
}
.file-audit-group__meta { color: var(--text-muted); font-size: .8rem; }

.json-viewer {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow: auto;
  max-height: 320px;
  font-size: .8rem;
}

.legacy-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 9000;
  overflow: auto;
  padding: 1rem;
}
.legacy-modal .modal-content { max-width: 520px; margin: 8vh auto; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 9100;
  background: rgba(0,0,0,.5);
  display: none;
  overflow: auto;
  padding: 1rem;
}
.modal .modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 480px;
  margin: 8vh auto;
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

#statsGrid .stat-card,
#statsGrid > div {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}
#statsGrid .value,
#statsGrid .stat-value { font-size: 1.5rem; font-weight: 700; }

.dicom-modal {
  position: fixed;
  inset: 0;
  z-index: 9500;
  display: flex;
  flex-direction: column;
  background: #0f172a;
  animation: dicomFadeIn 0.25s ease;
}

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

.dicom-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  padding: .65rem 1rem;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  flex-shrink: 0;
}

.dicom-modal-title {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .875rem;
  overflow: hidden;
  min-width: 0;
}

.dicom-modal-filename {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dicom-modal-expires {
  color: var(--text-muted);
  font-size: .75rem;
  white-space: nowrap;
  flex-shrink: 0;
}

.dicom-modal-actions {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
}

.dicom-modal-btn {
  padding: .45rem .85rem;
  border: none;
  border-radius: var(--radius);
  font-size: .8rem;
  cursor: pointer;
}

.dicom-modal-btn-close {
  background: var(--danger);
  color: #fff;
}

.dicom-modal-btn-close:hover {
  filter: brightness(1.08);
}

.dicom-modal-body {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dicom-modal-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #111;
  z-index: 10;
}

.dicom-modal-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #333;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: dicomSpin 0.8s linear infinite;
  margin-bottom: .75rem;
}

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

.dicom-modal-loading p {
  color: var(--text-muted);
  font-size: .875rem;
  margin: 0;
}

.dicom-modal-error {
  color: var(--danger);
  text-align: center;
}

.dicom-modal-error a {
  color: var(--primary);
}

.dicom-modal-iframe {
  flex: 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  border: none;
  transition: opacity 0.3s;
}

.checkbox-inline {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: .5rem;
  font-size: .875rem;
  text-align: left;
  width: 100%;
  margin-bottom: 0;
  cursor: pointer;
}

.checkbox-inline input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  flex-shrink: 0;
  margin: 0.15rem 0 0;
  padding: 0;
  accent-color: var(--primary);
}

.empty, .error, .loading { padding: 1rem; text-align: center; color: var(--text-muted); }
.error { color: var(--danger); }

.download-link {
  background: rgba(37,99,235,.06);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-top: .75rem;
}

@media (max-width: 768px) {
  .file-actions { width: 100%; }
}
