/* ============================================================================
 * Mundo Radiológico · Visor (OHIF Custom Branding & Lockdown)
 * P-005 T20: Clean Spanish patient viewer, Mundo navy/blue palette, no technical clutter.
 * ============================================================================ */

:root {
  /* Mundo Brand Colors */
  --mundo-navy: #00359e;
  --mundo-navy-dark: #002777;
  --mundo-navy-darker: #00143d;
  --mundo-blue: #0063bc;
  --mundo-blue-hover: #00509a;

  /* OHIF Theme Overrides */
  --default-color: #94a3b8;
  --hover-color: #ffffff;
  --active-color: #0063bc;
  --ui-border-color: #1e293b;
  --ui-border-color-dark: #0f172a;
  --ui-border-color-active: #0063bc;
  --primary-background-color: #000000;
  --ui-gray-dark: #00143d;
  --ui-gray-darker: #000f2e;
  --ui-gray-darkest: #000a20;
  --text-primary-color: #f8fafc;
}

/* ----------------------------------------------------------------------------
 * Header & Branding
 * ---------------------------------------------------------------------------- */
.entry-header,
header,
.header {
  background-color: #00143d !important;
  border-bottom: 2px solid #00359e !important;
  height: 52px !important;
}

/* Hide OHIF default logos and titles */
.header-logo-text,
.header-logo-image,
.brand-text,
.study-list-header {
  display: none !important;
}

.header-brand-mundo {
  display: flex !important;
  align-items: center !important;
  height: 38px !important;
  cursor: default !important;
  user-select: none !important;
}

.header-brand-mundo img {
  height: 34px !important;
  width: auto !important;
}

/* ----------------------------------------------------------------------------
 * Toolbar Lockdown: Zoom, Scroll, Descargar ONLY
 * ---------------------------------------------------------------------------- */
.ToolbarRow,
.ToolbarSection {
  background-color: #001845 !important;
  border-bottom: 1px solid #002878 !important;
  padding: 4px 8px !important;
}

/* Hide all toolbar buttons by default */
.ToolbarSection .toolbar-button,
.ToolbarRow .toolbar-button {
  display: none !important;
}

/* Show only Zoom, Stack Scroll, Contraste (Wwwc = "levels") and Medir (Length = "length") */
.ToolbarSection .toolbar-button[data-cy="zoom"],
.ToolbarSection .toolbar-button[data-cy="stack scroll"],
.ToolbarSection .toolbar-button[data-cy="levels"],
.ToolbarSection .toolbar-button[data-cy="length"],
.ToolbarRow .toolbar-button[data-cy="zoom"],
.ToolbarRow .toolbar-button[data-cy="stack scroll"],
.ToolbarRow .toolbar-button[data-cy="levels"],
.ToolbarRow .toolbar-button[data-cy="length"],
.ToolbarSection .toolbar-button.mundo-btn-extra,
.ToolbarRow .toolbar-button.mundo-btn-extra {
  display: flex !important;
}

/* Touch friendly: wrap on narrow screens, 44px targets */
.ToolbarSection,
.ToolbarRow {
  flex-wrap: wrap !important;
}
.toolbar-button.mundo-btn-extra {
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 44px !important;
  color: #cbd5e1 !important;
  user-select: none !important;
}
.mundo-preset-select {
  min-height: 44px;
  font-size: 16px;
  margin: 0 4px;
  padding: 0 8px;
  border-radius: 8px;
  border: 0;
  color: #0f172a;
  background: #fff;
}

/* Show custom Descargar button */
.ToolbarSection .toolbar-button.mundo-btn-descargar,
.ToolbarRow .toolbar-button.mundo-btn-descargar {
  display: flex !important;
}

/* Toolbar button styling */
.toolbar-button {
  border-radius: 8px !important;
  padding: 6px 12px !important;
  margin: 0 4px !important;
  transition: all 0.2s ease !important;
}

.toolbar-button:hover {
  background-color: rgba(0, 99, 188, 0.25) !important;
  color: #ffffff !important;
}

.toolbar-button.active {
  background-color: #0063bc !important;
  color: #ffffff !important;
}

.toolbar-button-label {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  margin-top: 4px !important;
}

/* Custom Descargar Button */
.mundo-btn-descargar {
  cursor: pointer !important;
  align-items: center !important;
  justify-content: center !important;
  flex-direction: column !important;
  padding: 6px 12px !important;
  color: #cbd5e1 !important;
  user-select: none !important;
}

.mundo-btn-descargar:hover {
  color: #ffffff !important;
  background-color: rgba(0, 99, 188, 0.25) !important;
}

.mundo-btn-descargar .mundo-download-icon {
  margin-bottom: 4px !important;
  stroke: #0063bc !important;
  transition: stroke 0.2s ease !important;
}

.mundo-btn-descargar:hover .mundo-download-icon {
  stroke: #ffffff !important;
}

/* ----------------------------------------------------------------------------
 * Remove Complex Technical UI: Panels, Choosers, Menus
 * ---------------------------------------------------------------------------- */
/* Hide Layout Chooser */
.layoutChooser,
.layoutChooser-dropdown-menu {
  display: none !important;
}

/* Hide side panels and toggle handles */
.sidepanel,
.sidepanel-toggle,
.side-panel-toggle,
.sb-topLeft,
.sb-topRight,
.sb-bottomLeft,
.sb-bottomRight {
  display: none !important;
}

/* Hide notification bar (INVESTIGATIONAL USE ONLY) */
.notification-bar {
  display: none !important;
}

/* Hide side panel toggle button groups (Secuencia / Measurements) in the toolbar */
.ToolbarRow > div:not(.ToolbarSection),
.ToolbarRow .pull-right,
.ToolbarRow .pull-left,
.ToolbarRow [class*="buttonGroup"],
.ToolbarRow [class*="ButtonGroup"],
.ToolbarRow [class*="btn-group"],
.ToolbarRow .btn-group {
  display: none !important;
}

/* Hide options, settings, help and hamburger menus */
.options-menu,
.settings-menu,
.help-menu,
.header-menu,
.header .options,
a[href="/"] {
  display: none !important;
}

/* ----------------------------------------------------------------------------
 * Minimal Viewport Overlay (Clean Medical Presentation)
 * ---------------------------------------------------------------------------- */
/* Typography */
.OHIFCornerstoneViewportOverlay .overlay-element {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  font-size: 13px !important;
  color: #f1f5f9 !important;
  text-shadow: 1px 1px 2px #000, 0 0 4px #000 !important;
  letter-spacing: 0.2px !important;
}

/* Hide technical bottom-right overlay (Zoom %, W/L, compression indicator) */
.OHIFCornerstoneViewportOverlay .bottom-right,
.OHIFCornerstoneViewportOverlay .bottom-left2,
.OHIFCornerstoneViewportOverlay .bottom-left3 {
  display: none !important;
}

/* Hide Patient ID (second div inside top-left) */
.OHIFCornerstoneViewportOverlay .top-left.overlay-element > div:nth-child(2) {
  display: none !important;
}

/* Hide technical fields in bottom-left (FPS, Ser, Thick, Loc); keep image number (div:nth-child(2)) */
.OHIFCornerstoneViewportOverlay .bottom-left.overlay-element > div:not(:nth-child(2)) {
  display: none !important;
}

/* ----------------------------------------------------------------------------
 * Unauthorized & Session Expired Patient Modal
 * ---------------------------------------------------------------------------- */
#mundo-unauthorized-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mundo-modal-backdrop {
  position: absolute;
  inset: 0;
  background-color: rgba(0, 15, 46, 0.85);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.mundo-modal-card {
  position: relative;
  background-color: #ffffff;
  color: #1e293b;
  border-radius: 14px;
  padding: 28px 32px;
  max-width: 440px;
  width: 90%;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
  animation: mundoModalFadeIn 0.25s ease-out;
}

@keyframes mundoModalFadeIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.mundo-modal-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.mundo-modal-title {
  font-size: 20px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 10px 0;
}

.mundo-modal-desc {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 24px 0;
  line-height: 1.5;
}

.mundo-modal-btn {
  background-color: #00359e;
  color: #ffffff;
  font-weight: 600;
  font-size: 15px;
  padding: 12px 24px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s;
  width: 100%;
}

.mundo-modal-btn:hover {
  background-color: #002777;
}

/* ----------------------------------------------------------------------------
 * Series navigation (series-selector.js)
 * ---------------------------------------------------------------------------- */
/* Desktop: reserve the strip width so it never covers the OHIF viewport (172px = STRIP_WIDTH) */
body.mundo-has-series-strip .FlexboxLayout {
  margin-left: 172px !important;
  width: calc(100% - 172px) !important;
}
#mundo-series-strip {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 900;
  overflow-y: auto;
  box-sizing: border-box;
  padding: 8px;
  background: #001845;
  border-right: 1px solid #002878;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
#mundo-series-strip .mundo-strip-title {
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px 2px;
}
.mundo-series-tile {
  display: block;
  width: 100%;
  margin: 0 0 8px;
  padding: 4px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #0b1f4d;
  color: #e2e8f0;
  cursor: pointer;
  text-align: left;
}
.mundo-series-tile:hover { border-color: #0063bc; }
.mundo-series-tile.active { border-color: #38bdf8; background: #0063bc; }
.mundo-tile-media {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}
.mundo-tile-media img { width: 100%; height: 100%; object-fit: contain; }
.mundo-tile-fallback { color: #64748b; font-size: 13px; }
.mundo-tile-label {
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.25;
  word-break: break-word;
}

/* Mobile: compact button; overlay only when open (does not cover the image when closed) */
#mundo-series-mobile .mundo-series-burger {
  position: fixed;
  left: 10px;
  bottom: 12px;
  z-index: 1000;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 22px;
  background: rgba(0, 53, 158, 0.92);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
#mundo-series-overlay {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: flex-end;
}
#mundo-series-overlay[hidden] { display: none; }
#mundo-series-overlay .mundo-overlay-panel {
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
#mundo-series-overlay .mundo-overlay-head {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #001845;
  color: #fff;
  font-weight: 600;
}
#mundo-series-overlay .mundo-overlay-close {
  min-width: 44px; min-height: 44px;
  border: 0; background: transparent; color: #fff; font-size: 20px;
}
#mundo-series-overlay ul {
  list-style: none;
  margin: 0;
  padding: 8px;
  width: 100%;
  flex: 1 1 auto;
  overflow-y: auto;
  box-sizing: border-box;
  background: #0b1f4d;
}
#mundo-series-overlay .mundo-overlay-item {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 0 0 6px;
  padding: 10px 12px;
  border: 0;
  border-radius: 8px;
  background: #13306b;
  color: #fff;
  font-size: 16px;
  text-align: left;
}
#mundo-series-overlay .mundo-overlay-item.active { background: #0063bc; }
