/* Parish Meet - Mobile-first styles */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --danger: #dc2626;
  --text: #1e293b;
  --text-muted: #64748b;
  --bg: #f8fafc;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 6px rgba(0,0,0,0.1), 0 2px 4px rgba(0,0,0,0.06);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 24px;
}

.hero {
  padding: 32px 0 16px;
}

.logo {
  font-size: 48px;
  margin-bottom: 8px;
}

h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

h2 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  color: var(--text-muted);
  font-size: 15px;
  margin-top: 4px;
}

.back-link {
  display: inline-block;
  color: var(--primary);
  text-decoration: none;
  font-size: 15px;
  margin-bottom: 12px;
}

/* Cards */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.card-secondary {
  background: var(--primary-light);
  text-align: center;
}

/* Forms */
label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 16px;
}

label:first-child {
  margin-top: 0;
}

input[type="text"],
select {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--card-bg);
  color: var(--text);
  transition: border-color 0.2s;
}

input[type="text"]:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
}

input[type="text"]::placeholder {
  color: #94a3b8;
}

#session-code {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.2s;
  width: 100%;
  margin-top: 16px;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  background: #94a3b8;
  cursor: not-allowed;
}

.btn-outline {
  background: transparent;
  color: var(--primary);
  border: 2px solid var(--primary);
}

.btn-outline:hover {
  background: var(--primary-light);
}

.btn-danger {
  color: var(--danger);
  border-color: var(--danger);
}

.btn-danger:hover {
  background: #fef2f2;
}

.btn-large {
  padding: 16px 32px;
  font-size: 18px;
}

.btn-small {
  padding: 8px 16px;
  font-size: 14px;
  width: auto;
  margin-top: 8px;
}

/* Divider */
.divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 14px;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.divider span {
  padding: 0 12px;
}

/* Code badge */
.code-badge {
  display: inline-block;
  background: var(--primary);
  color: white;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 2px;
  font-family: monospace;
}

/* Share box */
.share-box {
  text-align: center;
}

.qr-placeholder {
  margin: 12px auto;
  display: inline-block;
}

.qr-placeholder img,
.qr-placeholder canvas {
  border-radius: 8px;
}

.join-url {
  font-size: 13px;
  color: var(--text-muted);
  word-break: break-all;
  margin: 8px 0;
}

/* Participant list */
.participant-list {
  list-style: none;
  margin-top: 12px;
}

.participant-list li {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.participant-list li:last-child {
  border-bottom: none;
}

.participant-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  margin-right: 12px;
  flex-shrink: 0;
}

.participant-name {
  font-weight: 600;
  font-size: 15px;
}

.participant-bio {
  font-size: 13px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
}

/* Host controls */
.host-controls {
  text-align: center;
  padding: 16px 0;
}

.hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Waiting message */
.waiting-msg {
  text-align: center;
  padding: 24px;
  color: var(--text-muted);
}

.waiting-msg p {
  font-size: 15px;
}

/* ========================= */
/* LIVE VIEW */
/* ========================= */

.round-indicator {
  font-size: 16px;
  color: var(--text-muted);
}

.round-indicator span:first-child {
  font-weight: 700;
  color: var(--text);
  font-size: 20px;
}

/* Timer */
.timer-container {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 16px auto;
}

.timer-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.timer-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 8;
}

.timer-ring {
  fill: none;
  stroke: var(--primary);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.292;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.25s linear, stroke 0.3s;
}

.timer-ring.warning {
  stroke: #f59e0b;
}

.timer-ring.danger {
  stroke: var(--danger);
}

.timer-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 40px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Partner card */
.partner-card {
  text-align: center;
}

.partner-card h2 {
  font-size: 24px;
  margin-bottom: 4px;
}

.partner-bio {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 12px;
}

/* BYE card */
.bye-card {
  text-align: center;
  background: #fefce8;
}

.bye-card h2 {
  color: #a16207;
}

.bye-card p {
  color: #854d0e;
}

/* Circle card (Welcome / Closing all-hands phases) */
.circle-card {
  text-align: center;
  background: #eef2ff;
}

.circle-card h2 {
  color: #4338ca;
}

.circle-card p {
  color: #4f46e5;
}

/* Ice breaker */
.icebreaker-card {
  text-align: center;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.icebreaker-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #16a34a;
  margin-bottom: 8px;
}

.icebreaker-text {
  font-size: 17px;
  font-weight: 500;
  color: #166534;
  font-style: italic;
}

/* Time's Up Overlay -- z-index high enough to sit above the embedded Jitsi iframe */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  animation: fadeIn 0.3s;
}

.overlay-content {
  background: white;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  max-width: 320px;
  margin: 0 16px;
  animation: scaleIn 0.3s;
}

.overlay-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

.overlay-content h2 {
  font-size: 24px;
  margin-bottom: 8px;
}

.overlay-content p {
  color: var(--text-muted);
}

/* ========================= */
/* RECAP VIEW */
/* ========================= */

.recap-list {
  list-style: none;
  margin-top: 12px;
}

.recap-list li {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.recap-list li:last-child {
  border-bottom: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* View transitions */
.view {
  animation: fadeIn 0.3s;
}

/* Desktop adjustments */
@media (min-width: 600px) {
  .container {
    padding: 32px 16px;
  }

  h1 {
    font-size: 32px;
  }

  .timer-container {
    width: 160px;
    height: 160px;
  }

  .timer-text {
    font-size: 48px;
  }
}

/* ========================= */
/* LIVE VIEW LAYOUT (embedded Jitsi) */
/* ========================= */

/* Live view drops the narrow .container width so the Jitsi iframe can dominate. */
.live-view {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
}

.live-layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.jitsi-container {
  width: 100%;
  min-height: 40vh;
  background: #1f2937;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

/* Jitsi External API mounts an <iframe> inside #jitsi-container -- make it fill. */
.jitsi-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0;
  display: block;
}

/* iOS Safari fallback card (hidden by default; shown by showJitsiFallback). */
.jitsi-fallback {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.jitsi-fallback p {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.live-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.live-info .round-indicator {
  text-align: center;
}

.live-info .timer-container {
  margin: 8px auto;
}

/* Tighten card spacing inside the side panel so they stack cleanly. */
.live-info .card {
  margin-bottom: 0;
}

/* Desktop: iframe on the left, info strip on the right, both filling the viewport. */
@media (min-width: 900px) {
  .live-view {
    height: 100dvh;
    max-height: 100dvh;
    padding: 16px;
  }

  .live-layout {
    flex-direction: row;
    align-items: stretch;
    height: calc(100dvh - 32px);
  }

  .jitsi-container {
    flex: 1 1 auto;
    min-width: 0;
    height: 100%;
    min-height: 0;
  }

  .jitsi-fallback {
    flex: 1 1 auto;
    min-width: 0;
    align-self: center;
  }

  .live-info {
    flex: 0 0 320px;
    overflow-y: auto;
    max-height: 100%;
    padding-right: 4px;
  }

  .live-info .timer-container {
    width: 120px;
    height: 120px;
  }

  .live-info .timer-text {
    font-size: 36px;
  }
}

/* ========================= */
/* HOST PRESENCE BADGE */
/* ========================= */

.presence-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85em;
  font-weight: 600;
  margin-top: 8px;
}

.presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.presence-here {
  background: #d1fae5;
  color: #065f46;
}

.presence-here .presence-dot {
  background: #10b981;
}

.presence-waiting {
  background: #fee2e2;
  color: #991b1b;
}

.presence-waiting .presence-dot {
  background: #ef4444;
}

.presence-stepped-away {
  background: #fef3c7;
  color: #92400e;
}

.presence-stepped-away .presence-dot {
  background: #f59e0b;
}
