/* ---------- multi-pane layout ---------------------------------------- */

#wiki-multipane {
  display: grid;
  grid-template-columns: minmax(25rem, 1fr) minmax(20rem, 1fr);
  grid-template-rows: 1fr;
  gap: 1rem;
}

#wiki-main-pane {
  display: block;
}

/* Source pane - fixed sidebar for reference content */
#wiki-source-pane {
  border-left: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 0.5rem 0 0 0.5rem;
  position: fixed;
  top: 2.5rem;
  right: 0;
  width: calc(40% - 1.5rem);
  min-width: 20rem;
  height: calc(100vh - 2.5rem);
  padding: 0;
  background: var(--md-default-bg-color);
  z-index: 100;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Source pane header with controls */
.source-pane-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  background: var(--md-default-bg-color);
  flex-shrink: 0;
  position: absolute;
  width: 100%;
  min-width: 20rem;
  z-index: 1000;
  opacity: 1.0;
}

.source-pane-links {
  display: flex;
  gap: 0;
  align-items: center;
}

.source-pane-controls {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.source-control-btn {
  background: var(--md-default-accent-fg-color);
  color: var(--md-default-fg-color);
  font-size: 12px;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: background-color 0.2s;
}

.source-control-btn:hover {
  background: var(--md-default-fg-color--lightest);
  text-decoration: none;
}

.source-control-btn .icon {
  font-size: 10px;
}

#source-frame {
  width: 100%;
  height: 100%;
  flex: 1;
  border: none;
  border-radius: 0;
}

/* Close button styling */
.close-btn {
  background: var(--md-accent-fg-color);
  color: white;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  line-height: 1;
  font-weight: bold;
}

.close-btn:hover {
  opacity: 0.8;
}

/* Source pane loading indicator */
.source-loading-indicator {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  z-index: 500;
  color: var(--md-default-fg-color--light);
  font-size: 0.8rem;
}

.source-loading-spinner {
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--md-default-fg-color--lightest);
  border-top-color: var(--md-accent-fg-color);
  border-radius: 50%;
  animation: source-spin 0.8s linear infinite;
}

@keyframes source-spin {
  to { transform: rotate(360deg); }
}

/* Hide source pane on narrow screens */
@media (max-width: 64rem) {
  #wiki-multipane       { grid-template-columns: 1fr; }
  #wiki-source-pane     { display: none !important; }
  #wiki-main-pane       { margin-right: 0 !important; }
}

/* ---------- surgeon cards -------------------------------------------- */

.surgeon-card {
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 3px;
  padding: 0.4rem 0.5rem;
  margin-bottom: 0;
  background: var(--md-default-bg-color);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.15s ease;
  line-height: 1.3;
}

.surgeon-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.10);
}

.surgeon-card .surgeon-name {
  font-weight: 600;
  font-size: 0.85rem;
  margin: 0 0 0.1rem 0;
  line-height: 1.2;
}

.surgeon-card .surgeon-name a {
  color: var(--md-typeset-a-color);
  text-decoration: none;
}

.surgeon-card .surgeon-name a:hover {
  text-decoration: underline;
}

.surgeon-card .surgeon-location {
  font-size: 0.72rem;
  color: var(--md-default-fg-color--light);
  margin: 0 0 0.2rem 0;
  line-height: 1.2;
}

.surgeon-card .surgeon-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem;
}

.surgeon-card .badge {
  display: inline-block;
  font-size: 0.62rem;
  padding: 0.05rem 0.3rem;
  border-radius: 2px;
  background: var(--md-default-fg-color--lightest);
  color: var(--md-default-fg-color--light);
  white-space: nowrap;
  line-height: 1.3;
}

.badge-high { background: #c8e6c9; color: #2e7d32; }
.badge-mid  { background: #fff9c4; color: #f57f17; }
.badge-low  { background: var(--md-default-fg-color--lightest); color: var(--md-default-fg-color--light); }
.badge-none { background: var(--md-default-fg-color--lightest); color: var(--md-default-fg-color--lighter); }
.badge-photo { background: #e3f2fd; color: #1565c0; }
.badge-proc  { background: #f3e5f5; color: #7b1fa2; }
.badge-years { background: var(--md-default-fg-color--lightest); color: var(--md-default-fg-color--light); }

[data-md-color-scheme="slate"] .badge-high  { background: #1b5e20; color: #a5d6a7; }
[data-md-color-scheme="slate"] .badge-mid   { background: #e65100; color: #ffe0b2; }
[data-md-color-scheme="slate"] .badge-photo { background: #0d47a1; color: #90caf9; }
[data-md-color-scheme="slate"] .badge-proc  { background: #4a148c; color: #ce93d8; }

/* Surgeon list grid */
#surgeon-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.3rem;
}

#surgeon-list .surgeon-card {
  margin-bottom: 0;
}

/* Result count */
#result-count {
  font-size: 0.75rem;
  color: var(--md-default-fg-color--light);
  margin-left: auto;
}

/* ---------- filter bar ----------------------------------------------- */

.filter-bar {
  position: sticky;
  top: 3rem;           /* sit below Material's sticky header (3rem tall) */
  z-index: 2;          /* below header (z-index:4) and tabs (z-index:3) */
  background: var(--md-default-bg-color);
  padding: 0.3rem 0;
  margin-bottom: 0.4rem;
  border-bottom: 1px solid var(--md-default-fg-color--lightest);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

[data-md-color-scheme="slate"] .filter-bar {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.filter-bar input,
.filter-bar select {
  font-family: var(--md-text-font-family);
  font-size: 0.75rem;
  padding: 0.25rem 0.4rem;
  border: 1px solid var(--md-default-fg-color--lightest);
  border-radius: 3px;
  background: var(--md-default-bg-color);
  color: var(--md-default-fg-color);
  outline: none;
  transition: border-color 0.15s ease;
}

.filter-bar input:focus,
.filter-bar select:focus {
  border-color: var(--md-accent-fg-color);
}

.filter-bar input::placeholder {
  color: var(--md-default-fg-color--lighter);
}

.filter-bar label {
  font-size: 0.7rem;
  color: var(--md-default-fg-color--light);
  font-weight: 600;
}

/* ---------- compact global typography -------------------------------- */

.md-typeset {
  font-size: 0.78rem;
  line-height: 1.5;
}

.md-typeset h1 {
  font-size: 1.4rem;
  margin: 0 0 0.3rem 0;
}

.md-typeset h2 {
  font-size: 1.05rem;
  margin: 0.6rem 0 0.2rem 0;
}

.md-typeset h3 {
  font-size: 0.9rem;
  margin: 0.4rem 0 0.15rem 0;
}

.md-typeset p {
  margin: 0 0 0.4rem 0;
}

.md-typeset ul, .md-typeset ol {
  margin: 0 0 0.4rem 0;
}

.md-typeset li {
  margin-bottom: 0.1rem;
}

.md-typeset hr {
  margin: 0.5rem 0;
}

/* Tighter content area */
.md-content__inner {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
}

/* Compact home page procedure cards */
.md-typeset .surgeon-card h3 {
  margin: 0 0 0.1rem 0;
  font-size: 0.9rem;
}

/* ---------- dark mode adjustments ------------------------------------ */

[data-md-color-scheme="slate"] .surgeon-card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

[data-md-color-scheme="slate"] .surgeon-card:hover {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* Hide footer */
.md-footer {
  display: none;
}
