/* PPortal Light Theme for OHIF Viewer */
/* Matches the white/slate/medical-blue palette from the patient portal */

/* ===== CSS Custom Properties ===== */
:root {
  /* Primary - Medical blue */
  --ui-color-primary: #0f87e9;
  --ui-color-primary-light: #e0effe;
  --ui-color-primary-dark: #036bc7;
  --ui-color-primary-active: #0455a1;

  /* Backgrounds - Light */
  --ui-color-bg: #f8fafc;
  --ui-color-bg-dark: #f1f5f9;
  --ui-color-bg-light: #ffffff;

  /* Secondary */
  --ui-color-secondary-dark: #e2e8f0;
  --ui-color-secondary-light: #f1f5f9;

  /* Text - Dark on light */
  --ui-color-text: #1e293b;
  --ui-color-text-secondary: #64748b;

  /* Accent */
  --ui-color-accent: #0f87e9;

  /* Active states */
  --ui-color-active: #0f87e9;
  --ui-color-active-dark: #036bc7;
}

/* ===== Font ===== */
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

/* ===== Top Header Bar ===== */
.bg-primary-dark,
header,
[class*="Header"] {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

/* Header text should be dark */
.bg-primary-dark *,
header *,
[class*="Header"] * {
  color: #1e293b !important;
}

/* Logo area text override */
.bg-primary-dark a *,
header a * {
  color: #1e293b !important;
}

/* ===== Side Panels (entire left/right sidebars) ===== */
.bg-secondary-dark,
.bg-secondary-light,
[class*="sidepanel"],
[class*="SidePanel"],
[class*="side-panel"],
[class*="ohif-left"],
[class*="ohif-right"],
[data-cy*="side-panel"],
[data-cy*="study-browser"] {
  background-color: #f8fafc !important;
  border-color: #e2e8f0 !important;
  color: #334155 !important;
}

.bg-secondary-dark *,
.bg-secondary-light *,
[class*="sidepanel"] *,
[class*="SidePanel"] *,
[class*="side-panel"] *,
[data-cy*="side-panel"] *,
[data-cy*="study-browser"] * {
  color: #334155 !important;
}

/* Side panel header "Studies" bar */
.bg-secondary-dark > div:first-child,
[class*="SidePanel"] > div:first-child,
[data-cy*="side-panel"] > div:first-child {
  background-color: #f1f5f9 !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

/* Active/selected items in sidebar */
[class*="SidePanel"] [class*="active"],
[data-cy*="study-browser"] [class*="active"] {
  background-color: #e0effe !important;
  color: #0f87e9 !important;
}

[class*="SidePanel"] [class*="active"] *,
[data-cy*="study-browser"] [class*="active"] * {
  color: #0f87e9 !important;
}

/* ===== Main Background ===== */
.bg-black,
.bg-primary-black {
  background-color: #f1f5f9 !important;
}

/* Keep the viewport/canvas area dark for DICOM images */
.viewport-wrapper,
[class*="viewport"],
[class*="Viewport"],
canvas {
  background-color: #000000 !important;
}

/* Cornerstone viewport overlays text should stay white on dark canvas */
.viewport-wrapper *,
[class*="viewport-overlay"],
[class*="ViewportOverlay"] {
  color: #ffffff !important;
}

/* ===== Toolbar ===== */
.bg-primary-dark .ohif-toolbar,
[class*="toolbar"],
[class*="Toolbar"],
[class*="ToolbarRow"] {
  background-color: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

/* Toolbar buttons */
[class*="toolbar"] button,
[class*="Toolbar"] button {
  color: #475569 !important;
}

[class*="toolbar"] button:hover,
[class*="Toolbar"] button:hover {
  background-color: #f1f5f9 !important;
  color: #0f87e9 !important;
}

[class*="toolbar"] button.active,
[class*="Toolbar"] button.active,
[class*="toolbar"] button[class*="active"],
[class*="Toolbar"] button[class*="active"] {
  background-color: #e0effe !important;
  color: #0f87e9 !important;
}

/* ===== Primary Buttons ===== */
.bg-primary-main,
.ohif-btn-primary,
[class*="btn-primary"] {
  background-color: #0f87e9 !important;
  color: #ffffff !important;
}

.bg-primary-main:hover,
.ohif-btn-primary:hover,
[class*="btn-primary"]:hover {
  background-color: #036bc7 !important;
}

/* Active tool highlight */
.active .bg-primary-light,
.bg-primary-light {
  background-color: #e0effe !important;
  color: #0f87e9 !important;
}

/* ===== Study List ===== */
.ohif-scrollbar thead th,
[class*="StudyList"] thead th,
table thead th {
  background-color: #f8fafc !important;
  color: #475569 !important;
  border-bottom: 2px solid #e2e8f0 !important;
}

table tbody tr {
  background-color: #ffffff !important;
  color: #334155 !important;
  border-bottom: 1px solid #f1f5f9 !important;
}

table tbody tr:hover {
  background-color: #f0f7ff !important;
}

/* ===== Panels & Cards ===== */
[class*="panel"],
[class*="Panel"],
[class*="segment"],
[class*="Segment"] {
  background-color: #ffffff !important;
  border-color: #e2e8f0 !important;
}

/* ===== Dropdowns & Menus ===== */
[class*="dropdown"],
[class*="Dropdown"],
[class*="menu"],
[class*="Menu"],
[class*="popover"],
[class*="Popover"],
[class*="Tooltip"],
[role="menu"],
[role="listbox"] {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1) !important;
  color: #334155 !important;
}

[class*="dropdown"] *,
[class*="Dropdown"] *,
[role="menu"] *,
[role="listbox"] * {
  color: #334155 !important;
}

[class*="dropdown"] [class*="hover"],
[role="menu"] [class*="hover"],
[role="menu"] *:hover,
[role="listbox"] *:hover {
  background-color: #f0f7ff !important;
}

/* ===== Inputs & Select ===== */
input, select, textarea {
  background-color: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #1e293b !important;
}

input:focus, select:focus, textarea:focus {
  border-color: #0f87e9 !important;
  box-shadow: 0 0 0 2px rgba(15,135,233,0.2) !important;
}

/* ===== Scrollbars ===== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #0f87e9;
}

/* ===== Tabs ===== */
[class*="tab"][class*="active"],
[class*="Tab"][class*="active"],
[role="tab"][aria-selected="true"] {
  background-color: #ffffff !important;
  color: #0f87e9 !important;
  border-color: #0f87e9 !important;
}

[role="tab"] {
  color: #64748b !important;
}

/* ===== Notification / Status Bars ===== */
[class*="notification"],
[class*="Notification"],
[class*="snackbar"],
[class*="Snackbar"] {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #334155 !important;
}

/* ===== Icons in light theme need darker color ===== */
svg:not([class*="viewport"] svg) {
  color: #475569 !important;
}

/* Active/selected icons get primary color */
.active svg,
[class*="active"] svg,
button:hover svg {
  color: #0f87e9 !important;
}

/* ===== Modal / Dialog ===== */
[class*="modal"],
[class*="Modal"],
[class*="dialog"],
[class*="Dialog"],
[role="dialog"] {
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  color: #1e293b !important;
}

/* Modal backdrop */
[class*="overlay"],
[class*="Overlay"] {
  background-color: rgba(15, 23, 42, 0.5) !important;
}

/* ===== Dividers ===== */
hr, [class*="divider"], [class*="Divider"] {
  border-color: #e2e8f0 !important;
}
