/* Shared overlay chassis: modal, drawer and popover foundations */

html.str-modal-open,
body.str-modal-open,
html.str-overlay-open,
body.str-overlay-open {
  overflow: hidden;
}

.str-overlay,
.str-modal,
.str-drawer {
  position: fixed;
  inset: 0;
  display: none;
  z-index: var(--str-z-modal);
}

.str-overlay.is-open,
.str-modal.is-open,
.str-drawer.is-open {
  display: block;
}

.str-modal.str-modal--center.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.str-overlay__backdrop,
.str-modal__backdrop,
.str-drawer__backdrop {
  position: absolute;
  inset: 0;
  background: var(--str-color-overlay);
}

.str-modal__dialog,
.str-overlay__dialog {
  position: relative;
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  margin: 16px auto;
  overflow: auto;
  border-radius: var(--str-radius-lg);
  background: var(--str-color-surface);
  box-shadow: var(--str-shadow-xl);
}

.str-modal__dialog--large,
.str-overlay__dialog--large {
  width: min(840px, calc(100vw - 32px));
}

.str-modal__dialog--wide,
.str-overlay__dialog--wide {
  width: min(1140px, calc(100vw - 32px));
}

.str-drawer__panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(440px, 100vw);
  height: 100%;
  overflow: auto;
  background: var(--str-color-surface);
  box-shadow: var(--str-shadow-xl);
}

.str-modal__header,
.str-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 16px;
  border-bottom: 1px solid var(--str-color-border);
}

.str-modal__header h3,
.str-drawer__header h4 {
  margin: 0;
  color: var(--str-color-text);
}

.str-modal__body,
.str-drawer__body {
  overflow: auto;
  padding: 12px;
}

.str-player-profile-modal__dialog {
  max-height: 92vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.str-player-profile-modal__header h3 {
  font-size: 1.12rem;
}

.str-player-profile-modal__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
}

.str-player-profile-modal__body .str-player-profile {
  max-width: none;
  margin: 0;
  padding: 6px;
}

.str-player-profile-modal__loading,
.str-player-profile-modal__error {
  border: 1px solid var(--str-color-court-soft);
  background: var(--str-color-court-soft);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.str-player-profile-modal__error {
  border-color: var(--str-color-error-soft);
  background: var(--str-color-error-soft);
  color: var(--str-color-error-hover);
}

.str-popover {
  position: absolute;
  z-index: calc(var(--str-z-modal) + 1);
  width: min(320px, calc(100vw - 24px));
  border: 1px solid var(--str-color-border);
  border-radius: var(--str-radius-md);
  background: var(--str-color-surface);
  box-shadow: var(--str-shadow-lg);
  color: var(--str-color-text);
}

.str-modal__close,
.str-overlay__close,
.str-drawer__close {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--str-color-danger-soft);
  border-radius: var(--str-radius-sm);
  background: var(--str-color-surface);
  color: var(--str-color-danger);
  cursor: pointer;
}

@media (max-width: 980px) {
  .str-modal.str-modal--center.is-open {
    padding: 10px;
  }

  .str-player-profile-modal__dialog {
    max-height: 94vh;
  }

  .str-player-profile-modal__header {
    padding: 12px;
  }

  .str-player-profile-modal__body {
    padding: 8px;
  }
}
