/* =========================================================
   styles/realtime-share.css
   SpinChoice — Realtime share modal (premium WHITE + centered)
   Includes:
   - White, bigger modal centered in viewport
   - Clean typography + spacing
   - Link input with copy icon
   - Green "Spin With Friends" button + pen icon support
   ========================================================= */

/* ---------- Modal shell ---------- */
.rt-modal{
  position: fixed;
  inset: 0;
  display: none;
  z-index: 9999;
}
.rt-modal.is-open{ display: block; }

.rt-modal__backdrop{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.22);
  backdrop-filter: blur(8px);
}

/* ---------- Panel ---------- */
.rt-modal__panel{
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);

  width: min(760px, calc(100vw - 32px));
  background: #fff;
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0,0,0,.18);
  overflow: hidden;
}

/* ---------- Header ---------- */
.rt-modal__head{
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;

  padding: 22px 22px 14px;
  border-bottom: 1px solid rgba(15,23,42,.08);
}

.rt-modal__title{
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: .2px;
  color: #0f172a;
}

.rt-modal__close{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  border: 1px solid rgba(15,23,42,.10);
  background: #fff;
  color: rgba(15,23,42,.70);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;

  display: grid;
  place-items: center;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.rt-modal__close:hover{
  border-color: rgba(15,23,42,.18);
  box-shadow: 0 12px 34px rgba(15,23,42,.10);
  transform: translateY(-1px);
}

/* ---------- Body (centered + premium) ---------- */
.rt-modal__body{
  padding: 14px 26px 26px;
  display: grid;
  gap: 14px;

  text-align: center;
  justify-items: center;

  color: rgba(15,23,42,.80);
  font-size: 15px;
  line-height: 1.55;
}

.rt-modal__body p{
  margin: 0;
  max-width: 60ch;
  color: rgba(15,23,42,.70);
  font-weight: 420;
}

/* Rows are centered and consistent width */
.rt-modal__row{
  width: 100%;
  max-width: 560px;
  display: grid;
  justify-items: center;
  gap: 10px;
}

/* ---------- Link field + copy icon ---------- */
.rt-modal__linkwrap{
  position: relative;
  width: 100%;
}

.rt-modal__input{
  width: 100%;
  height: 48px;
  padding: 0 52px 0 14px; /* space for copy icon */
  border-radius: 14px;

  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  color: rgba(15,23,42,.90);
  outline: none;

  box-shadow: 0 10px 30px rgba(15,23,42,.05);
}

.rt-modal__copyicon{
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);

  width: 36px;
  height: 36px;
  border-radius: 12px;

  border: 1px solid rgba(15,23,42,.12);
  background: #fff;

  display: grid;
  place-items: center;

  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.rt-modal__copyicon svg{
  width: 18px;
  height: 18px;
  fill: rgba(15,23,42,.78);
}

.rt-modal__copyicon:hover{
  border-color: rgba(15,23,42,.22);
  box-shadow: 0 10px 26px rgba(15,23,42,.10);
  transform: translateY(-50%) scale(1.04);
}

/* “Copied” micro animation */
.rt-modal__copyicon.is-copied{
  animation: rtCopyPop .6s ease;
}
@keyframes rtCopyPop{
  0%   { transform: translateY(-50%) scale(1); }
  30%  { transform: translateY(-50%) scale(1.10); }
  100% { transform: translateY(-50%) scale(1); }
}

/* ---------- Buttons layout ---------- */
/* Your modal has exactly 2 .rt-modal__row blocks:
   1) input row
   2) buttons row
   So we style row #2 as a 2-col grid on desktop. */
.rt-modal__body .rt-modal__row:nth-of-type(2){
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Make the two modal buttons premium (do NOT affect site buttons) */
#rtCreateBtn,
#rtCopyBtn{
  width: 100%;
  height: 46px;
  border-radius: 14px;
  font-weight: 650;
  letter-spacing: .2px;
}

/* Primary */
#rtCreateBtn.btn--primary{
  background: #0f172a;
  color: #fff;
  border: 1px solid rgba(15,23,42,.10);
  box-shadow: 0 14px 40px rgba(15,23,42,.14);
}
#rtCreateBtn.btn--primary:hover{
  filter: brightness(.98);
  transform: translateY(-1px);
}

/* Ghost */
#rtCopyBtn.btn--ghost{
  background: #fff;
  color: rgba(15,23,42,.88);
  border: 1px solid rgba(15,23,42,.14);
  box-shadow: 0 10px 30px rgba(15,23,42,.06);
}
#rtCopyBtn.btn--ghost:hover{
  border-color: rgba(15,23,42,.22);
  transform: translateY(-1px);
}

/* ---------- Status ---------- */
.rt-modal__status{
  min-height: 18px;
  font-size: 13px;
  color: rgba(15,23,42,.62);
  text-align: center;
}

/* ---------- Presence row (centered pill) ---------- */
.rt-modal__presence{
  width: 100%;
  max-width: 560px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.10);
  background: rgba(15,23,42,.03);

  color: rgba(15,23,42,.78);
  font-size: 13px;
}

/* Room badge inside presence row */
.rt-modal__badge{
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15,23,42,.12);
  background: #fff;
  color: rgba(15,23,42,.70);
  font-size: 12px;
}

/* ---------- Note ---------- */
.rt-modal__note{
  width: 100%;
  max-width: 60ch;
  padding-top: 10px;
  margin-top: 2px;

  border-top: 1px solid rgba(15,23,42,.08);
  color: rgba(15,23,42,.52);
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
}

/* ---------- Spin With Friends button (green) ---------- */
#shareLiveBtn{
  background: #16a34a;
  color: #fff;
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 12px;
  padding: 10px 14px;

  display: inline-flex;
  align-items: center;
  gap: 8px;

  font-weight: 650;
  letter-spacing: .2px;
}
#shareLiveBtn:hover{ filter: brightness(0.97); }
#shareLiveBtn:active{ transform: translateY(1px); }

/* Pen icon (used when button becomes "Edit Room") */
#shareLiveBtn .rt-pen{
  width: 16px;
  height: 16px;
  display: inline-block;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  opacity: 0.95;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 520px){
  .rt-modal__panel{
    width: calc(100vw - 22px);
    border-radius: 18px;
  }

  .rt-modal__head{
    padding: 18px 16px 12px;
  }

  .rt-modal__body{
    padding: 12px 16px 18px;
  }

  /* stack buttons */
  .rt-modal__body .rt-modal__row:nth-of-type(2){
    grid-template-columns: 1fr;
  }
}
/* ===== Modal actions row (3 buttons) ===== */
/* Actions row: supports 2 buttons now + easy to add a centered one later */
.rt-modal__actions{
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left | center | right */
  align-items: center;
  gap: 12px;
}

/* stack actions on mobile */
@media (max-width: 520px){
  .rt-modal__actions{ grid-template-columns: 1fr; }
}

/* ===== Delete Room button (danger / red) ===== */
#rtDeleteBtn{
  width: 100%;
  height: 46px;
  border-radius: 14px;

  background: #ef4444;
  color: #fff;

  border: 1px solid rgba(0,0,0,.10);
  box-shadow: 0 14px 40px rgba(239,68,68,.18);

  font-weight: 650;
  letter-spacing: .2px;

  transition: transform .15s ease, filter .15s ease, box-shadow .15s ease;
}
#rtDeleteBtn:hover{
  filter: brightness(.98);
  transform: translateY(-1px);
  box-shadow: 0 18px 46px rgba(239,68,68,.22);
}
#rtDeleteBtn:active{
  transform: translateY(0px);
}
/* --- SOLO CREATE BUTTON: perfect center --- */
#rtActionsRow{
  justify-content: center !important;
}

#rtCreateBtn{
  margin: 0 auto !important;  /* makes it dead-center even if something else is weird */
}
/* =========================================================
   FIX: When only "Create link" is shown, it must not sit in col 1
   Make it span the full actions grid so it’s perfectly centered.
   ========================================================= */

#rtCreateBtn{
  grid-column: 1 / -1;         /* ✅ spans all columns */
  justify-self: center;        /* ✅ centers itself */
  width: min(340px, 100%);     /* ✅ nicer centered width (not huge) */
}
/* Actions row: supports 2 buttons now + easy to add a centered one later */
.rt-modal__actions{
  width: 100%;
  max-width: 560px;
  display: grid;
  grid-template-columns: 1fr auto 1fr; /* left | center | right */
  align-items: center;
  gap: 12px;
}

/* 2 buttons now: lock positions */
#rtDeleteBtn{ grid-column: 1; justify-self: start; }
#rtCopyBtn{   grid-column: 3; justify-self: end; }

/* When you add a 3rd button later, give it this id/class and it will sit centered */
#rtMidBtn{ grid-column: 2; justify-self: center; }

/* Mobile: stack */
@media (max-width: 520px){
  .rt-modal__actions{ grid-template-columns: 1fr; }
  #rtDeleteBtn, #rtCopyBtn, #rtMidBtn{ grid-column: 1; justify-self: stretch; }
}
/* ===== Actions row: compact buttons close to link field ===== */
.rt-modal__actions{
  margin-top: -4px;                 /* pulls buttons closer to the link field */
  grid-template-columns: auto 1fr auto; /* left | spacer | right */
  align-items: center;
}

/* Make BOTH buttons compact (override older width:100% rules) */
#rtDeleteBtn,
#rtCopyBtn{
  width: auto !important;
  min-width: 140px;                 /* optional: keep them consistent */
  height: 40px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  font-size: 14px;
  font-weight: 650;
  letter-spacing: .2px;
}

/* Keep positions: delete left, copy right */
#rtDeleteBtn{ justify-self: start; }
#rtCopyBtn{   justify-self: end; }

/* Make delete look as “thin/premium” as copy (less chunky shadow) */
#rtDeleteBtn{
  box-shadow: 0 10px 26px rgba(239,68,68,.16) !important;
}
#rtDeleteBtn:hover{
  box-shadow: 0 14px 30px rgba(239,68,68,.20) !important;
}

/* Mobile: full width stacked is still best */
@media (max-width: 520px){
  #rtDeleteBtn,
  #rtCopyBtn{
    width: 100% !important;
    min-width: 0;
  }
}
/* =========================================================
   FINAL ACTIONS LAYOUT (override all older grid rules)
   - Disconnected: Create button centered
   - Connected: Delete (left) + Copy (right), same height
   ========================================================= */

#rtActionsRow{
  display: flex !important;          /* overrides any older grid rules */
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;

  justify-content: center;          /* default: center "Create link" */
  margin-top: -4px;                 /* optional: closer to link field */
}

/* When room exists: push buttons to edges */
#rtActionsRow.is-connected{
  justify-content: space-between;
}

/* Create link centered and not huge */
#rtCreateBtn{
  width: min(340px, 100%) !important;
  margin: 0 auto !important;

  /* neutralize old grid-only rules if they exist above */
  grid-column: auto !important;
  justify-self: auto !important;
}

/* Make Copy + Delete same size/height */
#rtDeleteBtn,
#rtCopyBtn{
  width: auto !important;
  min-width: 140px;
  height: 40px !important;
  padding: 0 14px !important;
  border-radius: 12px !important;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

/* Force visual order: Delete left, Copy right (even if HTML order differs) */
#rtDeleteBtn{ order: 1; }
#rtCopyBtn{   order: 2; }

/* Mobile: stack full width */
@media (max-width: 520px){
  #rtActionsRow{
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  #rtDeleteBtn,
  #rtCopyBtn,
  #rtCreateBtn{
    width: 100% !important;
    min-width: 0;
  }
}
