/* IKRAMED_TICKET_FRAMEWORK_RESPONSIVE_V1
 * Zentrale Ticket-Komponente.
 * Keine Aenderungen an bestehenden Praxis-CSS-Dateien.
 * Feste Dreier-Geometrie haelt die Mitte bei Power EIN/AUS stabil.
 */

[data-ikra-ticket-pane] .ikra-ticket-component {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

[data-ikra-ticket-pane] .ikra-ticket-component,
[data-ikra-ticket-pane] .ikra-ticket-component * {
  box-sizing: border-box;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-stage {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
  overflow: visible;
}

/* Drei symmetrische Spalten: links / Mitte / rechts */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-grid {
  display: grid;
  grid-template-columns: minmax(0, 19fr) minmax(0, 22fr) minmax(0, 19fr);
  gap: clamp(8px, 1.2vw, 22px);
  align-items: center;
  width: 100%;
  min-width: 0;
  padding-block: clamp(20px, 3vw, 28px);
  overflow: visible;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell {
  display: block;
  width: auto;
  max-width: none;
  min-width: 0;
  min-height: 0;
  flex: initial;
}

/* IKRAMED_TICKET_CENTER_UNIFIED_V2
 * Einheitliche Kartengroessenlogik bei allen Viewports.
 */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell--center {
  container-type: inline-size;
  overflow: visible;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell > .u-container-layout {
  display: block;
  width: 100%;
  min-height: 0;
  padding: 0;
}

/* Flexible Karten ohne feste Nicepage-Pixelbreiten */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: clamp(190px, 24vw, 355px);
  height: auto;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-radius: clamp(18px, 2vw, 30px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center {
  min-height: clamp(250px, 29vw, 415px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card > .u-container-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(6px, 1vw, 18px);
  width: 100%;
  min-height: inherit;
  padding: clamp(9px, 1.15vw, 24px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center > .u-container-layout {
  justify-content: space-between;
  gap: clamp(6px, 1.78cqw, 10px);
  padding: clamp(9px, 2.05cqw, 12px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card .u-custom-html {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: 0;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card .panelMedPrxn {
  width: 100%;
  min-width: 0;
}

/* Wartenummern skalieren mit der Fensterbreite */
[data-ikra-ticket-pane] .ikra-ticket-component .counterPanelMedPrxn {
  margin: 0;
  max-width: 100%;
  font-size: clamp(1.1rem, 3.5vw, 5.75rem);
  line-height: 1.15;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center .counterPanelMedPrxn {
  font-size: clamp(1.36rem, 15.9375cqw, 89.25px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .roomPanelMedPrxn {
  margin: 0;
  max-width: 100%;
  font-size: clamp(.85rem, 2.3vw, 2.7rem);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center .roomPanelMedPrxn {
  font-size: clamp(.9rem, 8.22cqw, 46px);
  margin-top: clamp(0.75rem, 4.3cqw, 24px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center .u-text-9 {
  width: 100%;
  margin: 0;
  font-size: clamp(1.2rem, 10cqw, 56px);
  line-height: 1.2;
}

/* Kundenlogo: breit, quadratisch und hochkant proportional einpassen */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-logo {
  display: block;
  width: min(84%, 370px);
  max-width: 100%;
  height: clamp(40px, 13.29cqw, 74.4px);
  max-height: 105px;
  min-width: 0;
  margin: auto auto 0;
  object-fit: contain;
  object-position: center;
}

/* Timer und Standortauswahl innerhalb der Monitorbreite */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-patient-number,
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  height: auto;
  margin: clamp(7px, 1.25vw, 16px) auto 0;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls .u-custom-html-8 {
  width: 100%;
  max-width: min(100%, 420px);
  min-height: 0;
  margin: 0 auto;
}

[data-ikra-ticket-pane] .ikra-ticket-component #prxn-select {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-pairing {
  max-width: 100%;
}

/* Mobile: Nur die mittlere Karte, vollstaendig zentriert */
/* IKRAMED_TICKET_CONTROLS_AXIS_RESPONSIVE_V1
 * Gemeinsame Mittelachse für Karte, Standort und Displayzugang.
 * Bestehende Power-/QR-Steuerung bleibt unverändert.
 */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: auto;
}

/* IKRAMED_TICKET_CENTER_CONTROLS_ACTIVE_V1
 * Standort und Zugang mittig zur Karte.
 * Nur sichtbar bei aktivem Powerstatus.
 * QR-Kopplungsbereich bleibt unabhängig.
 */
/* IKRAMED_TICKET_CONTROLS_FADE_V1
 * Displayzugang und Standort sanft ein-/ausblenden.
 * Kein Layoutsprung, keine QR-/Kartenänderung.
 */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls > .u-container-layout-22 {
  display: grid;
  justify-items: center;
  justify-content: center;
  row-gap: clamp(8px, 1.4vw, 14px);
  width: min(100%, 560px);
  margin-inline: auto;
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  transition:
    opacity 360ms ease,
    transform 360ms ease,
    visibility 0s linear 0s;
  will-change: opacity, transform;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls .u-custom-html-7 {
  width: 100%;
  text-align: center;
}

[data-ikra-ticket-pane] .ikra-ticket-component #accessTimer {
  max-width: 100%;
  text-align: center;
}

[data-ikra-ticket-pane] .ikra-ticket-component:not(:has(#prxn-load[data-active="true"])) .ikra-ticket-controls > .u-container-layout-22 {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 360ms ease,
    transform 360ms ease,
    visibility 0s linear 360ms;
}

@media (max-width: 991px) {
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-grid {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
    padding-inline: clamp(8px, 3vw, 16px);
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell[data-ikra-call-side] {
    display: none;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell--center {
    width: min(100%, 560px);
    justify-self: center;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center {
    min-height: clamp(255px, 69.64cqw, 390px);
  }

  body.ikra-monitor-fullscreen [data-ikra-ticket-pane] {
    overflow-x: hidden !important;
    overflow-y: auto !important;
  }
}

/* Kompakte Monitore mit geringer Hoehe */
@media (max-height: 540px) and (min-width: 561px) {
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card {
    min-height: 175px;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center {
    min-height: 220px;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-logo {
    height: 42px;
  }
}


/* IKRAMED_TICKET_PAIRING_DESKTOP_LAYOUT_V1
 * QR-Bereich neben der Standortauswahl.
 * Mobile Pairing-Berechtigung bleibt unverändert.
 */
@media (min-width: 992px) {
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, min(44%, 560px)) minmax(0, 1fr);
    align-items: center;
    column-gap: clamp(12px, 1.8vw, 24px);
    row-gap: 5px;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls > .u-container-layout-22 {
    min-width: 0;
    width: 100%;
    padding: 0;
    grid-column: 2;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-pairing {
    grid-column: 3;
    position: relative;
    z-index: 5;
    width: max-content;
    min-height: 0;
    height: auto;
    margin: 0;
    overflow: visible;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-pairing::before {
    content: none;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-pairing > .u-container-layout,
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-pairing .u-custom-html-9 {
    position: relative;
    width: auto;
    min-width: 0;
    min-height: 0;
    height: auto;
    margin: 0;
    padding: 0;
  }

  [data-ikra-ticket-pane] .ikra-ticket-component #btnEnablePairing {
    position: relative;
    z-index: 6;
    pointer-events: auto;
    margin: 0;
  }
}

/* Einheitliche horizontale Ausrichtung */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center .u-text-9,
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-patient-number {
  text-align: center;
}


/* IKRAMED_TICKET_PATIENT_NUMBER_TYPE_V1
 * Beide Zeilen gleich gross: responsiv 30 bis 36 px.
 * Authentifizierung und Sichtbarkeit bleiben unveraendert.
 */
[data-ikra-ticket-pane] .ikra-ticket-component [data-ikra-patient-ticket] .u-text-10,
[data-ikra-ticket-pane] .ikra-ticket-component [data-ikra-patient-ticket] .u-text-11 {
  font-size: clamp(30px, 3.2vw, 36px);
  line-height: 1.16;
}

/* IKRAMED_TICKET_SIDE_TYPOGRAPHY_V1
 * Seitenkarten optisch an mittlere Karte angeglichen.
 * Schrift passt sich an kleinere Kartenbreiten an.
 * Keine inneren Rahmenlinien und kein innerer Box-Schatten.
 * Aeusserer Karten-Leuchtrand bleibt unveraendert.
 */
[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell[data-ikra-call-side] {
  container-type: inline-size;
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--side .counterPanelMedPrxn {
  font-size: clamp(1rem, 21cqw, 89.25px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--side .roomPanelMedPrxn {
  font-size: clamp(.9rem, 12cqw, 46px);
  margin-top: clamp(18px, 4.3cqw, 24px);
}

[data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--side .u-custom-html {
  border: 0 !important;
  box-shadow: none !important;
}

/* IKRAMED_TICKET_CENTER_STABLE_990_V1
 * Mittlere Karte bei drei Anzeigen konstant dimensionieren.
 * Unterhalb 992px gelten unverändert die mobilen Regeln.
 */
@media (min-width: 992px) {
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-grid {
    grid-template-columns:
      minmax(0, 1fr) minmax(0, min(44%, 560px)) minmax(0, 1fr);
  }

  /* IKRAMED_TICKET_SIDE_SHADOW_INSET_V1
   * Schattenabstand nur an den äußeren Karten.
   * Die Mittelkarte und Grid-Spalten bleiben unverändert.
   */
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell[data-ikra-call-side="left"] {
    box-sizing: border-box;
    padding-left: clamp(20px, 1.6vw, 28px);
  }

  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell[data-ikra-call-side="right"] {
    box-sizing: border-box;
    padding-right: clamp(20px, 1.6vw, 28px);
  }
}

@media (min-width: 992px) and (min-height: 541px) {
  [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-card--center {
    min-height: clamp(250px, 69.64cqw, 390px);
  }
}

/* IKRAMED_TICKET_FULLSCREEN_CARD_STAGGER_V1
 * Nur Desktop-Vollbild:
 * - mittlere Karte leicht tiefer
 * - linke/rechte Karte noch weiter nach unten
 *   bis auf die Höhenlage von Standort/Displayzugang
 * - Controls bleiben darunter
 */
@media (min-width: 992px) {
  body.ikra-monitor-fullscreen [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell--center {
    position: relative;
    top: clamp(0px, calc((100vh - 540px) * 0.36), 85px);
  }

  body.ikra-monitor-fullscreen [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-cell[data-ikra-call-side] {
    position: relative;
    top: clamp(0px, calc((100vh - 540px) * 1.08), 223px);
  }

  body.ikra-monitor-fullscreen [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-patient-number,
  body.ikra-monitor-fullscreen [data-ikra-ticket-pane] .ikra-ticket-component .ikra-ticket-controls {
    position: relative;
    top: clamp(0px, calc((100vh - 540px) * 0.24), 70px);
  }
}
