/* profile-style.css
   Styles for the profile dashboard page.
*/

@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Nunito:wght@400;600&display=swap');

/* ── Profile hero ────────────────────────────────────────────────────────── */
.profile-hero {
  display: flex;
  gap: 32px;
  align-items: flex-start;
  max-width: 1100px;
  margin: 32px auto 0;
  padding: 0 24px;
  flex-wrap: wrap;
}

.profile-hero-avatar {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--text);
  overflow: hidden;
  flex-shrink: 0;
}

#pv-canvas {
  display: block;
  width: 200px;
  height: 200px;
  image-rendering: pixelated;
}

.profile-hero-info {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 8px;
}

.profile-hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

#pv-edit-link {
  text-decoration: none;
}

.btn-participate {
  font-family: var(--pixel);
  font-size: 9px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.1s;
  box-shadow: 3px 3px 0 var(--border);
}

.btn-participate:hover {
  border-color: var(--accent2);
  box-shadow: 3px 3px 0 var(--accent2);
}

.btn-participate.active {
  background: var(--accent2);
  border-color: var(--accent2);
  color: white;
  box-shadow: 3px 3px 0 #0c447c;
}

/* ── Dashboard grid ──────────────────────────────────────────────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto;
  gap: 20px;
  max-width: 1100px;
  margin: 24px auto 48px;
  padding: 0 24px;
}

.dash-card {
  background: var(--surface);
  border: 2px solid var(--text);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--text);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dash-card-title {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--text);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-card-title i {
  font-size: 16px;
  flex-shrink: 0;
}

.dash-label {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--muted);
  margin: 0;
}

.empty-hint {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── Movies ──────────────────────────────────────────────────────────────── */
.movies-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 350px;
  overflow-y: auto;
  flex: 1;
}

.movie-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 13px;
  gap: 8px;
}

.movie-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}

.movie-delete:hover { color: #a32d2d; }

.movie-add-row {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

.movie-add-row input {
  flex: 1;
  font-family: var(--body-font);
  font-size: 13px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.movie-add-row input:focus {
  outline: none;
  border-color: var(--accent2);
}

/* ── Participants ─────────────────────────────────────────────────────────── */
.participants-wrap { display: flex; flex-direction: column; gap: 6px; }

.participants-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.participant-wrap {
  position: relative;
}

.participant-avatar {
  width: 52px;
  height: 52px;
  image-rendering: pixelated;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.1s;
  display: block;
}

.participant-avatar:hover { border-color: var(--accent); }

.participant-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
  min-width: 120px;
}

.participant-tooltip strong {
  font-family: var(--pixel);
  font-size: 8px;
  display: block;
  margin-bottom: 6px;
}

.participant-tooltip ul {
  margin: 0;
  padding-left: 14px;
  font-size: 11px;
  line-height: 1.7;
}

.participant-wrap:hover .participant-tooltip { display: block; }

/* ── Picker ──────────────────────────────────────────────────────────────── */
.picker-wrap {
  background: var(--bg);
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  padding: 16px;
}

.picker-stage { min-height: 120px; display: flex; align-items: center; justify-content: center; }

.picker-idle { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.btn-pick {
  font-family: var(--pixel);
  font-size: 10px;
  padding: 12px 24px;
  background: var(--accent);
  color: white;
  border: 2px solid var(--text);
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--text);
  transition: transform 0.08s, box-shadow 0.08s;
}

.btn-pick:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 var(--text);
}

.btn-pick:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--text);
}

.picker-hint { font-size: 10px; color: var(--muted); }

/* Spinning stage */
.picker-spinning {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.spin-avatars {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

.spin-avatar-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: opacity 0.3s, transform 0.3s;
}

.spin-avatar-canvas {
  width: 60px;
  height: 60px;
  image-rendering: pixelated;
  border: 2px solid var(--border);
  border-radius: var(--radius);
}

.spin-avatar-name {
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--muted);
}

@keyframes spinEnter {
  from { opacity: 0; transform: scale(0.5) translateY(10px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}

@keyframes spinPulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.12); border-color: var(--accent); }
}

@keyframes spinOut {
  to { opacity: 0; transform: scale(0.4) rotate(20deg); }
}

.spin-enter { animation: spinEnter 0.3s ease-out both; }

.spin-pulsing .spin-avatar-canvas {
  animation: spinPulse 0.4s ease-in-out infinite;
}

.spin-out {
  animation: spinOut 0.3s ease-in forwards;
}

.spin-label {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--muted);
  text-align: center;
}

/* Result */
.picker-result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  animation: spinEnter 0.4s ease-out;
}

.winner-avatar {
  width: 90px;
  height: 90px;
  image-rendering: pixelated;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 3px 3px 0 var(--accent);
}

.winner-name {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--text);
}

.winner-movie {
  font-family: var(--pixel);
  font-size: 10px;
  color: var(--accent);
  text-align: center;
  min-height: 20px;
  transition: color 0.1s;
}

@keyframes flashMovie {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

.shuffle-flash { animation: flashMovie 0.15s ease; }

.shuffle-final {
  color: var(--accent) !important;
  font-size: 12px;
}

/* Past picks */
.past-picks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.past-pick-row {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: var(--radius);
  gap: 2px;
}

.past-pick-movie { font-size: 13px; font-weight: 600; }

.past-pick-meta {
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--muted);
}

/* ── Chat ────────────────────────────────────────────────────────────────── */
.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.chat-msg {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  row-gap: 2px;
}

.chat-author {
  font-family: var(--pixel);
  font-size: 8px;
  color: var(--accent2);
  grid-column: 1;
  grid-row: 1;
}

.chat-time {
  font-size: 10px;
  color: var(--muted);
  grid-column: 2;
  grid-row: 1;
  text-align: right;
}

.chat-content {
  font-size: 13px;
  line-height: 1.5;
  grid-column: 1 / -1;
  grid-row: 2;
  margin: 0;
}

.chat-input-row {
  display: flex;
  gap: 8px;
}

.chat-input-row input {
  flex: 1;
  font-family: var(--body-font);
  font-size: 13px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.chat-input-row input:focus {
  outline: none;
  border-color: var(--accent2);
}

/* ── Calendar ────────────────────────────────────────────────────────────── */
.calendar-events {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 240px;
  overflow-y: auto;
}

.cal-event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  background: var(--bg);
  border-radius: var(--radius);
}

.cal-event-date {
  font-family: var(--pixel);
  font-size: 7px;
  color: var(--accent2);
  flex-shrink: 0;
  width: 72px;
}

.cal-event-title {
  flex: 1;
  font-size: 13px;
}

.cal-event-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  flex-shrink: 0;
}

.cal-event-delete:hover { color: #a32d2d; }

.calendar-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.calendar-add-row input[type=text] {
  flex: 1;
  min-width: 120px;
}

.calendar-add-row input {
  font-family: var(--body-font);
  font-size: 13px;
  padding: 6px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

.calendar-add-row input:focus {
  outline: none;
  border-color: var(--accent2);
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  #pv-canvas { width: 160px; height: 160px; }
}