/* urbanXplorer collaboration: reusable groups/family + shared itinerary events. */

.collaboration-groups {
  position: fixed;
  z-index: 2550;
  inset: 0;
  width: 100vw;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #F8FAFC;
  color: #0F172A;
  opacity: 0;
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(.22,.8,.26,1), opacity 180ms ease;
  pointer-events: none;
}

.collaboration-groups[hidden],
.shared-event-panel[hidden] {
  display: none !important;
}

.collaboration-groups.is-open {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}

.collaboration-groups *,
.shared-event-panel * {
  box-sizing: border-box;
  font-family: var(--font-family);
}

.collaboration-groups-header {
  flex: 0 0 auto;
  min-height: calc(66px + env(safe-area-inset-top));
  padding: calc(11px + env(safe-area-inset-top)) 14px 10px 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid rgba(100,116,139,.16);
  background: linear-gradient(180deg,#FFFFFF,#F8FAFC);
}

.collaboration-groups-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.collaboration-groups-header strong {
  color: #0F172A;
  font-size: 20px;
  font-weight: 900;
  letter-spacing: -.02em;
}

.collaboration-groups-header small {
  max-width: 720px;
  color: #64748B;
  font-size: 12px;
  line-height: 1.35;
}

.collaboration-groups-header button,
.shared-event-header button {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 0;
  border-radius: 50%;
  background: #F1F5F9;
  color: #475569;
  font-size: 25px;
  cursor: pointer;
}

.collaboration-groups-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 14px calc(30px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
}

.collaboration-group-create-card,
.collaboration-group-card {
  width: min(100%, 900px);
  margin: 0 auto 14px;
  padding: 16px;
  border: 1px solid rgba(100,116,139,.16);
  border-radius: 20px;
  background: #FFFFFF;
  box-shadow: 0 8px 26px rgba(15,23,42,.05);
}

.collaboration-group-create-card > strong {
  display: block;
  margin-bottom: 10px;
  font-size: 15px;
  font-weight: 900;
}

.collaboration-inline-form {
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  gap: 8px;
}

.collaboration-inline-form input,
.shared-event-field select {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #CBD5E1;
  border-radius: 12px;
  background: #FFFFFF;
  color: #0F172A;
  font-size: 14px;
  outline: none;
}

.collaboration-inline-form input:focus,
.shared-event-field select:focus {
  border-color: rgba(13,148,136,.48);
  box-shadow: 0 0 0 3px rgba(13,148,136,.10);
}

.collaboration-inline-form button,
.shared-event-primary,
.shared-event-secondary {
  min-height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 850;
  cursor: pointer;
}

.collaboration-inline-form button,
.shared-event-primary {
  border: 0;
  background: #0D9488;
  color: #FFFFFF;
}

.shared-event-secondary {
  border: 1px solid #CBD5E1;
  background: #FFFFFF;
  color: #334155;
}

.shared-event-secondary.is-danger {
  border-color: #FECACA;
  background: #FEF2F2;
  color: #B91C1C;
}

.collaboration-group-list {
  width: min(100%, 900px);
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.collaboration-group-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.collaboration-group-card-header > div {
  min-width: 0;
}

.collaboration-group-card-header h3 {
  margin: 0;
  color: #0F172A;
  font-size: 18px;
  font-weight: 900;
}

.collaboration-group-card-header small {
  display: block;
  margin-top: 3px;
  color: #64748B;
  font-size: 11px;
}

.collaboration-role-badge {
  flex: 0 0 auto;
  padding: 6px 9px;
  border-radius: 999px;
  background: #ECFDF5;
  color: #047857;
  font-size: 10px;
  font-weight: 850;
}

.collaboration-member-list {
  display: grid;
  gap: 8px;
}

.collaboration-member-row {
  min-width: 0;
  min-height: 56px;
  display: grid;
  grid-template-columns: 38px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid #E2E8F0;
  border-radius: 14px;
  background: #F8FAFC;
}

.collaboration-member-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #CCFBF1;
  color: #0F766E;
  font-size: 11px;
  font-weight: 900;
}

.collaboration-member-copy {
  min-width: 0;
}

.collaboration-member-copy strong,
.collaboration-member-copy small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collaboration-member-copy strong {
  color: #0F172A;
  font-size: 13px;
  font-weight: 850;
}

.collaboration-member-copy small {
  margin-top: 3px;
  color: #64748B;
  font-size: 10.5px;
}

.collaboration-member-invite-actions,
.shared-event-invite-inline,
.shared-event-rsvp-inline {
  display: flex;
  align-items: center;
  gap: 5px;
}

.collaboration-member-invite-actions button,
.shared-event-invite-inline button,
.shared-event-rsvp-inline button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid #D7E0E8;
  border-radius: 10px;
  background: #FFFFFF;
  color: #334155;
  cursor: pointer;
}

.shared-event-rsvp-inline button.is-current {
  border-color: rgba(13,148,136,.38);
  background: #CCFBF1;
  color: #0F766E;
}

.collaboration-member-add {
  margin-top: 10px;
}

.collaboration-status {
  width: min(100%, 900px);
  min-height: 0;
  margin: 0 auto 12px;
  padding: 10px 12px;
  border-radius: 12px;
  color: #475569;
  background: #F1F5F9;
  font-size: 12px;
  line-height: 1.4;
}

.collaboration-status[hidden] {
  display: none !important;
}

.collaboration-status.is-success {
  background: #ECFDF5;
  color: #047857;
}

.collaboration-status.is-warning {
  background: #FFFBEB;
  color: #92400E;
}

.collaboration-status.is-error {
  background: #FEF2F2;
  color: #B91C1C;
}

.collaboration-empty {
  margin: 18px 0;
  padding: 18px;
  border: 1px dashed #CBD5E1;
  border-radius: 16px;
  background: #FFFFFF;
  color: #64748B;
  text-align: center;
  font-size: 13px;
}

/* Shared-event entry inside itinerary cards. */
.shared-event-card-row {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-top: 6px;
}

.shared-event-card-action {
  min-height: 30px;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid rgba(13,148,136,.24);
  border-radius: 999px;
  background: rgba(13,148,136,.07);
  color: #0F766E;
  font-size: 10.5px;
  font-weight: 850;
  cursor: pointer;
}

.shared-event-card-action.is-shared {
  background: #ECFDF5;
  border-color: rgba(4,120,87,.20);
  color: #047857;
}

/* Share/invite dialog. */
.shared-event-panel {
  position: fixed;
  z-index: 6200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.shared-event-panel.is-open {
  opacity: 1;
  pointer-events: auto;
}

.shared-event-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.shared-event-card {
  position: relative;
  z-index: 1;
  width: min(100%, 520px);
  max-height: min(88dvh, 760px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 24px;
  background: #FFFFFF;
  box-shadow: 0 24px 70px rgba(15,23,42,.28);
}

.shared-event-header {
  flex: 0 0 auto;
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  border-bottom: 1px solid #E2E8F0;
}

.shared-event-header > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.shared-event-header strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0F172A;
  font-size: 18px;
  font-weight: 900;
}

.shared-event-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #64748B;
  font-size: 11px;
}

.shared-event-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

.shared-event-panel .collaboration-status {
  width: auto;
  margin: 0 16px 16px;
}

.shared-event-share-form {
  display: grid;
  gap: 14px;
}

.shared-event-field {
  display: grid;
  gap: 6px;
}

.shared-event-field > span,
.shared-event-section-title {
  color: #334155;
  font-size: 12px;
  font-weight: 850;
}

.shared-event-people,
.shared-event-participant-list {
  display: grid;
  gap: 8px;
}

.shared-event-person-option {
  min-height: 48px;
  display: grid;
  grid-template-columns: 20px minmax(0,1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 13px;
  background: #F8FAFC;
}

.shared-event-person-option input {
  width: 18px;
  height: 18px;
  accent-color: #0D9488;
}

.shared-event-person-option span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0F172A;
  font-size: 13px;
  font-weight: 800;
}

.shared-event-person-option small {
  color: #64748B;
  font-size: 10px;
}

.shared-event-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #F0FDFA;
  color: #0F766E;
}

.shared-event-summary strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.shared-event-summary span {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 850;
}

.shared-event-participant-row {
  min-width: 0;
  min-height: 54px;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 13px;
  background: #FFFFFF;
}

.shared-event-participant-row > div:first-child {
  min-width: 0;
}

.shared-event-participant-row strong,
.shared-event-participant-row small {
  display: block;
}

.shared-event-participant-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #0F172A;
  font-size: 13px;
  font-weight: 850;
}

.shared-event-participant-row small {
  margin-top: 3px;
  color: #64748B;
  font-size: 10px;
}

.shared-event-invite-message {
  margin: 4px 0 12px;
  color: #334155;
  font-size: 15px;
  line-height: 1.5;
}

.shared-event-invite-meta {
  display: block;
  margin-bottom: 18px;
  color: #64748B;
  font-size: 12px;
  line-height: 1.4;
}

.shared-event-invite-response {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 8px;
}

.shared-event-invite-response:has(.shared-event-primary:only-child) {
  grid-template-columns: 1fr;
}

@media (max-width: 560px) {
  .collaboration-groups-scroll {
    padding-inline: 10px;
  }

  .collaboration-group-create-card,
  .collaboration-group-card {
    padding: 13px;
    border-radius: 17px;
  }

  .collaboration-member-row {
    grid-template-columns: 36px minmax(0,1fr);
  }

  .collaboration-member-invite-actions {
    grid-column: 2;
    justify-content: flex-start;
  }

  .shared-event-panel {
    align-items: end;
    padding: 8px 8px max(8px,env(safe-area-inset-bottom));
  }

  .shared-event-card {
    width: 100%;
    max-height: 86dvh;
    border-radius: 24px;
  }

  .shared-event-invite-response {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .collaboration-groups,
  .shared-event-panel {
    transition: none;
  }
}
