/* ========== WATCH PARTY PANEL & MODAL STYLES ========== */

/* -------------------------------------------------------
   LAYOUT — playerPartyContainer: flex row (video + panel)
   ------------------------------------------------------- */
.player-party-container {
  display: flex;
  align-items: stretch;
  position: relative;
  background: #000;
  width: 100%;
}

.player-party-container .player-wrap {
  flex: 1 1 auto;
  min-width: 0;
}

/* -------------------------------------------------------
   SIDEBAR — BASE
   Default: hidden. When party is active and is-open in
   normal (non-fullscreen) mode → inline column beside video.
   ------------------------------------------------------- */
.party-sidebar {
  display: none;
  width: 340px;
  flex-shrink: 0;
  flex-direction: column;
  background: rgba(13, 13, 22, 0.98);
  border-left: 1px solid rgba(233, 69, 96, 0.22);
  box-sizing: border-box;
  overflow: hidden;
}

/* Normal (non-fullscreen): show as static inline column */
.party-sidebar.is-open:not(.party-fs-mode) {
  display: flex;
}

/* Hide X close button in normal inline mode — not needed since panel is always visible */
.party-fs-close-btn {
  display: none !important;
}

/* -------------------------------------------------------
   SIDEBAR — FULLSCREEN MODE (class added by JS on fullscreenchange)
   Becomes an absolute overlay on the right edge of the fullscreen element.
   ------------------------------------------------------- */
.party-sidebar.party-fs-mode {
  display: flex;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  height: 100%;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2147483647;
  border-left: 1px solid rgba(233, 69, 96, 0.3);
  box-shadow: -10px 0 35px rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  background: rgba(11, 11, 19, 0.92);
}

.party-sidebar.party-fs-mode.is-open {
  transform: translateX(0);
}

/* Show X close button only in fullscreen overlay mode */
.party-sidebar.party-fs-mode .party-fs-close-btn {
  display: flex !important;
}

/* -------------------------------------------------------
   SIDEBAR HEADER
   ------------------------------------------------------- */
.party-header {
  padding: 14px 16px;
  background: rgba(18, 18, 28, 0.98);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  gap: 8px;
}

.party-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
}

.party-title-icon {
  width: 18px;
  height: 18px;
  color: var(--accent, #e94560);
  flex-shrink: 0;
}

.party-header-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
}

.party-room-code-tag {
  font-size: 0.68rem;
  background: rgba(233, 69, 96, 0.14);
  border: 1px solid rgba(233, 69, 96, 0.28);
  color: #ff7a8f;
  padding: 2px 7px;
  border-radius: 5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  font-family: monospace;
  white-space: nowrap;
  flex-shrink: 0;
}

.party-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #aaa;
  cursor: pointer;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  flex-shrink: 0;
}

.party-close-btn:hover {
  background: rgba(233, 69, 96, 0.2);
  border-color: rgba(233, 69, 96, 0.4);
  color: #fff;
}

.party-close-btn svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------------------------------
   TOOLBAR
   ------------------------------------------------------- */
.party-toolbar {
  padding: 9px 14px;
  background: rgba(8, 8, 16, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.party-tool-btn {
  flex: 1;
  padding: 6px 8px;
  font-size: 0.74rem;
  font-weight: 600;
  border-radius: 7px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #ddd;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.party-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.party-tool-btn.danger {
  color: #ff6b81;
  border-color: rgba(255, 107, 129, 0.2);
}

.party-tool-btn.danger:hover {
  background: rgba(255, 107, 129, 0.18);
  color: #fff;
}

/* -------------------------------------------------------
   MEMBERS SECTION
   ------------------------------------------------------- */
.party-members-section {
  padding: 10px 14px;
  background: rgba(10, 10, 20, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.party-section-label {
  font-size: 0.67rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #666;
  margin-bottom: 7px;
  font-weight: 700;
}

.party-members-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 60px;
  overflow-y: auto;
}

.party-member-chip {
  padding: 3px 9px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: #eee;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.party-member-chip.is-host {
  border-color: rgba(233, 69, 96, 0.4);
  background: rgba(233, 69, 96, 0.12);
}

.party-host-badge {
  font-size: 0.6rem;
  background: var(--accent, #e94560);
  color: #fff;
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 800;
}

/* -------------------------------------------------------
   CHAT SECTION
   ------------------------------------------------------- */
.party-chat-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.party-chat-messages {
  flex: 1;
  padding: 12px 14px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  -webkit-overflow-scrolling: touch;
}

.party-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.party-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.party-msg-system {
  text-align: center;
  font-size: 0.71rem;
  color: #666;
  padding: 3px 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  align-self: center;
}

.party-msg-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 88%;
}

.party-msg-item.is-me { align-self: flex-end; }
.party-msg-item.is-other { align-self: flex-start; }

.party-msg-author {
  font-size: 0.69rem;
  color: #ff8598;
  font-weight: 600;
  padding: 0 3px;
}

.party-msg-item.is-me .party-msg-author {
  color: #888;
  text-align: right;
}

.party-msg-body {
  padding: 7px 11px;
  border-radius: 12px;
  font-size: 0.83rem;
  line-height: 1.45;
  word-break: break-word;
}

.party-msg-item.is-other .party-msg-body {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #eee;
  border-bottom-left-radius: 3px;
}

.party-msg-item.is-me .party-msg-body {
  background: linear-gradient(135deg, var(--accent, #e94560), #c72c47);
  color: #fff;
  border-bottom-right-radius: 3px;
  box-shadow: 0 2px 8px rgba(233, 69, 96, 0.3);
}

/* -------------------------------------------------------
   CHAT INPUT BAR
   ------------------------------------------------------- */
.party-chat-input-row {
  padding: 10px 14px;
  background: rgba(14, 14, 24, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
}

.party-chat-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.83rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.18s;
}

.party-chat-input:focus {
  border-color: var(--accent, #e94560);
}

.party-chat-send-btn {
  background: var(--accent, #e94560);
  color: #fff;
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.18s, transform 0.12s;
  flex-shrink: 0;
}

.party-chat-send-btn:hover { opacity: 0.88; }
.party-chat-send-btn:active { transform: scale(0.93); }

.party-chat-send-btn svg {
  width: 16px;
  height: 16px;
}

/* -------------------------------------------------------
   ODA MODAL
   ------------------------------------------------------- */
.party-modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
  padding: 16px;
  box-sizing: border-box;
}

.party-modal-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.party-modal {
  background: var(--bg-card, #14141f);
  border: 1px solid rgba(233, 69, 96, 0.28);
  border-radius: 16px;
  width: 100%;
  max-width: 420px;
  padding: 26px;
  box-shadow: 0 20px 55px rgba(0, 0, 0, 0.75), 0 0 26px rgba(233, 69, 96, 0.1);
  transform: translateY(14px) scale(0.97);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.party-modal-backdrop.is-visible .party-modal {
  transform: translateY(0) scale(1);
}

.party-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.party-modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}

.party-modal-title svg {
  width: 22px;
  height: 22px;
  color: var(--accent, #e94560);
}

.party-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #888;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s;
}

.party-modal-close:hover {
  background: rgba(233, 69, 96, 0.18);
  color: #fff;
}

.party-form-group { margin-bottom: 16px; }

.party-form-label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: #ccc;
  margin-bottom: 7px;
}

.party-form-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 9px;
  padding: 10px 13px;
  color: #fff;
  font-size: 0.9rem;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
}

.party-form-input:focus { border-color: var(--accent, #e94560); }

.party-modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 22px;
}

.party-modal-btn {
  flex: 1;
  padding: 11px 16px;
  border-radius: 9px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
}

.party-modal-btn.primary {
  background: linear-gradient(135deg, var(--accent, #e94560), #c72c47);
  color: #fff;
  box-shadow: 0 4px 14px rgba(233, 69, 96, 0.35);
}

.party-modal-btn.primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.party-modal-btn.secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ddd;
}

.party-modal-btn.secondary:hover {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

/* -------------------------------------------------------
   MOBILE — stack vertically, party panel below video
   ------------------------------------------------------- */
@media (max-width: 768px) {
  .player-party-container {
    flex-direction: column;
  }

  /* Inline (non-fs) mode: expand below the video */
  .party-sidebar.is-open:not(.party-fs-mode) {
    display: flex;
    width: 100%;
    height: 350px;
    border-left: none;
    border-top: 1px solid rgba(233, 69, 96, 0.22);
  }

  /* Fullscreen mode on mobile: absolute overlay bottom sheet */
  .party-sidebar.party-fs-mode {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100% !important;
    height: 55vh;
    border-left: none;
    border-top: 1px solid rgba(233, 69, 96, 0.3);
    transform: translateY(100%);
  }

  .party-sidebar.party-fs-mode.is-open {
    transform: translateY(0);
  }

  .party-chat-input-row {
    padding: 8px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}
