/* ./css/icc.cockpit.v2.css
 * ICC Cockpit v2 layout overrides
 * - Patients (left) | Module workspace (middle) | Preview rail (right)
 * - Default ratio: 22 / 53 / 25
 * - Backward compatible: wsMount and vpMount remain
 */

/* Panel widths */
.icc-cockpit {
  display: grid;
  grid-template-columns: 22% 53% 25%;
  gap: var(--icc-gap, 14px);
}

/* Safety minimum widths (grid will overflow if too small; scrollbars handle) */
.icc-left  { min-width: 280px; }
.icc-mid   { min-width: 640px; }
.icc-right { min-width: 320px; }

/* ✅ Option A (elite cockpit): patient identity is owned by the top strip only */
#wsPatient #wsName,
#wsPatient #wsMeta {
  display: none !important;
}

/* ============================================================
   Cockpit v2 — Patient Strip micro-layout polish (Tier-D)
   Goals:
   - No wrap jitter
   - Title ellipsis
   - Tabs stay aligned (horizontal scroll instead of wrapping)
   - Consistent density
   ============================================================ */

/* Strip container: keep stable vertical rhythm */
#patientStripMount {
  overflow: hidden;
}

/* Make the main strip layout robust against long names */
#patientStripMount .u-between {
  align-items: flex-start;
}

/* Left block: allow ellipsis */
#patientStripMount .icc-title {
  min-width: 0;
}

/* Top line: clamp to 1 line and ellipsize */
#patientStripMount .icc-title.u-min0 {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Keep the allergy pill + top actions from forcing wraps */
#patientStripMount .icc-pill {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* Top actions (Edit/WhatsApp): always stay together */
#patientStripMount #btnPTopEdit,
#patientStripMount #btnPTopWA {
  height: 32px;
  padding: 0 10px;
  border-radius: 10px;
  white-space: nowrap;
}

/* Right-side tabs row:
   - never wrap
   - horizontal scroll if tight
   - keeps cockpit looking “engineered” */
#patientStripMount .u-row.u-wrap.u-gap-8 {
  flex-wrap: nowrap !important;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  padding-bottom: 2px; /* avoids clipping shadow/underline */
}

/* Prevent buttons from shrinking into weird widths */
#patientStripMount .u-row.u-wrap.u-gap-8 > button {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 12px;
  white-space: nowrap;
}

/* Optional: tighten “ghost” request button to match others */
#patientStripMount #btnWSRequest {
  height: 34px;
}

/* ============================================================
   Cockpit v2 — Strip buttons (luxury active state)
   Contract: ui.js toggles .is-active on [data-mod]
   ============================================================ */

#patientStripMount [data-mod]{
  position: relative;
  border-radius: 12px;
  transition: transform .12s ease, box-shadow .18s ease, border-color .18s ease, background .18s ease, opacity .18s ease;
  will-change: transform;
}

/* Soft hover lift */
#patientStripMount [data-mod]:not(:disabled):hover{
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(0,0,0,.30);
}

/* Disabled tabs look intentional */
#patientStripMount [data-mod]:disabled{
  opacity: .45;
  cursor: not-allowed;
  box-shadow: none !important;
  transform: none !important;
}

/* Active module highlight */
#patientStripMount [data-mod].is-active{
  border-color: rgba(187,146,90,.55) !important;
  background: rgba(187,146,90,.10) !important;
  box-shadow:
    0 0 0 1px rgba(187,146,90,.25) inset,
    0 14px 40px rgba(0,0,0,.38),
    0 0 0 6px rgba(187,146,90,.07);
  font-weight: 700;
  letter-spacing: .15px;
}

/* Active underline accent */
#patientStripMount [data-mod].is-active::after{
  content:"";
  position:absolute;
  left: 10px;
  right: 10px;
  bottom: -8px;
  height: 2px;
  border-radius: 2px;
  background: rgba(187,146,90,.70);
  box-shadow: 0 0 18px rgba(187,146,90,.30);
}

/* Records slightly calmer even when active */
#patientStripMount [data-mod="records"].is-active{
  background: rgba(255,255,255,.06) !important;
  border-color: rgba(255,255,255,.16) !important;
  box-shadow:
    0 0 0 1px rgba(255,255,255,.10) inset,
    0 14px 40px rgba(0,0,0,.38);
}

#patientStripMount [data-mod="records"].is-active::after{
  background: rgba(255,255,255,.35);
  box-shadow: 0 0 14px rgba(255,255,255,.18);
}

/* Middle: strip + workspace */
.icc-mid__bd {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.icc-mid__strip {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.icc-mid__workspace {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
}

/* Right: header + body */
.icc-right__bd {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.icc-right__hd {
  flex: 0 0 auto;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}

.icc-right__body {
  flex: 1 1 auto;
  min-height: 0;
  padding: 14px;
}

/* Ensure scroll containers behave correctly */
.icc-scroll {
  overflow: auto;
  min-height: 0;
}

/* Responsive fallback: stack right rail under middle on narrow screens */
@media (max-width: 1200px) {
  .icc-cockpit {
    grid-template-columns: 28% 72%;
    grid-template-rows: auto auto;
    grid-template-areas:
      "left mid"
      "left right";
  }
  .icc-left  { grid-area: left; }
  .icc-mid   { grid-area: mid; }
  .icc-right { grid-area: right; }
}

@media (max-width: 900px) {
  .icc-cockpit {
    grid-template-columns: 1fr;
    grid-template-areas:
      "left"
      "mid"
      "right";
  }
}