/* ===========================================================
   Workshop Feedback — Modern, mobile-first, light/dark aware
   =========================================================== */

/* ---- Core Theme Variables ---- */
:root {
  /* Surfaces */
  --bg-color: #f0f2f5;
  --card-bg: #ffffff;
  --card-border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);

  /* Text */
  --text-color: #1a1a2e;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --text-error: #ff4757;

  /* Accent */
  --accent: #0d9488;
  --accent-hover: #0f766e;
  --accent-light: rgba(13, 148, 136, 0.08);
  --accent-focus-ring: rgba(13, 148, 136, 0.35);

  /* Buttons */
  --primary-btn: #0d9488;
  --primary-btn-text: #ffffff;
  --primary-btn-hover: #0f766e;
  --secondary-btn-bg: transparent;
  --secondary-btn-border: #d1d5db;
  --secondary-btn-text: #374151;
  --danger-btn: #ef4444;
  --danger-btn-hover: #dc2626;

  /* Inputs */
  --input-bg: #ffffff;
  --input-border: #d1d5db;
  --input-border-focus: #0d9488;
  --input-placeholder: #9ca3af;

  /* Stars */
  --star-color: #d1d5db;
  --star-active: #f59e0b;

  /* Misc */
  --link-color: #0d9488;
  --link-hover: #0f766e;
  --divider: rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --radius-sm: 10px;
  --transition: 0.2s ease;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #0f0f14;
    --card-bg: #1a1a24;
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 4px 24px rgba(0, 0, 0, 0.4);

    --text-color: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-error: #ff4757;

    --accent: #2dd4bf;
    --accent-hover: #5eead4;
    --accent-light: rgba(45, 212, 191, 0.1);
    --accent-focus-ring: rgba(45, 212, 191, 0.3);

    --primary-btn: #2dd4bf;
    --primary-btn-text: #0f0f14;
    --primary-btn-hover: #5eead4;
    --secondary-btn-bg: transparent;
    --secondary-btn-border: #3f3f4a;
    --secondary-btn-text: #e2e8f0;
    --danger-btn: #f87171;
    --danger-btn-hover: #ef4444;

    --input-bg: #232330;
    --input-border: #3f3f4a;
    --input-border-focus: #2dd4bf;
    --input-placeholder: #64748b;

    --star-color: #3f3f4a;
    --star-active: #fbbf24;

    --link-color: #2dd4bf;
    --link-hover: #5eead4;
    --divider: rgba(255, 255, 255, 0.06);
  }
}

/* ---- Base ---- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  padding: 20px 16px 48px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition), color var(--transition);
}

/* ---- Container ---- */
.feedback-container {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background-color: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  padding: 32px 24px;
  animation: fade-in 0.4s ease;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---- Header ---- */
.form-header {
  text-align: center;
  margin-bottom: 20px;
}

.form-header h1 {
  margin: 0 0 6px;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.form-subtitle {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ---- Field Labels ---- */
.field-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-color);
}

/* ---- Form Groups ---- */
.rating-group,
.video-group,
.input-group,
.consent-group {
  margin-bottom: 24px;
}

/* ---- Star Rating ---- */
.stars {
  display: flex;
  flex-direction: row-reverse;
  justify-content: flex-start;
  gap: 4px;
}

.stars input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.stars label {
  font-size: 2rem;
  color: var(--star-color);
  cursor: pointer;
  transition: color var(--transition), transform var(--transition);
  line-height: 1;
  padding: 4px;
  user-select: none;
}

.stars label:hover,
.stars label:hover~label {
  color: var(--star-active);
  transform: scale(1.1);
}

.stars input:checked~label {
  color: var(--star-active);
}

.stars input:focus-visible~label {
  outline: 2px solid var(--accent-focus-ring);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---- Video Group ---- */
#publisher-container {
  width: 100%;
  aspect-ratio: 16 / 9;
  background-color: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--card-border);
}

.video-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #6b7280;
  background: linear-gradient(135deg, #1a1a24 0%, #0f0f14 100%);
}

.video-placeholder svg {
  opacity: 0.4;
}

.video-placeholder span {
  font-size: 0.8125rem;
  color: #9ca3af;
}

.video-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.timer-display {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* ---- Inputs ---- */
input[type="text"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9375rem;
  font-family: inherit;
  color: var(--text-color);
  background-color: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
  appearance: none;
}

input[type="text"]::placeholder,
textarea::placeholder {
  color: var(--input-placeholder);
}

input[type="text"]:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--input-border-focus);
  box-shadow: 0 0 0 3px var(--accent-focus-ring);
}

textarea {
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
}

/* ---- Social Picker ---- */
.social-picker {
  display: flex;
  gap: 10px;
}

.social-picker select {
  width: auto;
  flex: 0 0 42%;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%236b7280' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.social-picker input[type="text"] {
  flex: 1;
  min-width: 0;
}

/* ---- Two-column row (desktop) ---- */
.form-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.form-row .input-group {
  margin-bottom: 24px;
}

/* ---- Consent ---- */
.consent-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  background-color: var(--accent-light);
  border-radius: var(--radius-sm);
  border: 1px solid var(--divider);
}

.consent-group input[type="checkbox"] {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  margin-top: 2px;
  accent-color: var(--accent);
  cursor: pointer;
}

.consent-group label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  cursor: pointer;
}

.consent-group a {
  color: var(--link-color);
  text-decoration: none;
  font-weight: 600;
  transition: color var(--transition);
}

.consent-group a:hover {
  color: var(--link-hover);
  text-decoration: underline;
}

/* ---- Buttons ---- */
.primary-btn,
.secondary-btn,
.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 13px 24px;
  font-size: 0.9375rem;
  font-weight: 600;
  font-family: inherit;
  border: 1.5px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition), border-color var(--transition),
    color var(--transition), transform var(--transition), opacity var(--transition);
}

.primary-btn {
  width: 100%;
  background-color: var(--primary-btn);
  color: var(--primary-btn-text);
  border-color: var(--primary-btn);
  margin-top: 4px;
}

.primary-btn:hover {
  background-color: var(--primary-btn-hover);
  border-color: var(--primary-btn-hover);
  transform: translateY(-1px);
}

.primary-btn:active {
  transform: translateY(0);
}

/* ---- Disabled Button State ---- */
.primary-btn:disabled {
  background-color: var(--input-border); /* Grays out the button */
  border-color: var(--input-border);
  color: var(--text-muted); /* Dims the text */
  cursor: not-allowed; /* Shows the 'no' icon on hover */
  transform: none; /* Prevents the hover lift effect */
  opacity: 0.7;
}

/* Ensure the hover effect doesn't override the disabled state */
.primary-btn:disabled:hover {
  background-color: var(--input-border);
  border-color: var(--input-border);
  transform: none;
}

.secondary-btn {
  background-color: var(--secondary-btn-bg);
  color: var(--secondary-btn-text);
  border-color: var(--secondary-btn-border);
}

.secondary-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

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

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

.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.danger-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-focus-ring);
}

/* ---- Confirmation ---- */
.confirmation {
  text-align: center;
  padding: 40px 20px;
  animation: fade-in 0.4s ease;
}

.confirmation-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background-color: var(--accent-light);
  display: flex;
  align-items: center;
  justify-content: center;
}

.confirmation-icon svg circle {
  stroke: var(--accent);
  stroke-width: 2;
  stroke-dasharray: 157;
  stroke-dashoffset: 0;
  animation: draw-circle 0.6s ease forwards;
}

.confirmation-icon svg path {
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 36;
  stroke-dashoffset: 36;
  animation: draw-check 0.4s 0.5s ease forwards;
}

@keyframes draw-circle {
  from {
    stroke-dashoffset: 157;
  }

  to {
    stroke-dashoffset: 0;
  }
}

@keyframes draw-check {
  from {
    stroke-dashoffset: 36;
  }

  to {
    stroke-dashoffset: 0;
  }
}

.confirmation h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 700;
}

.confirmation p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 0.9375rem;
}

/* ---- Responsive: Tablet & Desktop ---- */
@media (min-width: 640px) {
  body {
    padding: 40px 24px;
  }

  .feedback-container {
    padding: 40px 36px;
  }

  .form-header h1 {
    font-size: 2rem;
  }

  .form-row {
    flex-direction: row;
    gap: 20px;
  }

  .form-row .input-group {
    flex: 1;
    margin-bottom: 24px;
  }

  #publisher-container {
    max-width: 100%;
  }

  .stars label {
    font-size: 2.25rem;
  }
}

@media (min-width: 1024px) {
  .feedback-container {
    max-width: 620px;
  }
}


/* Floating Action Button Styles */
#setupFab {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #000;
  /* Match your app's primary color */
  color: #fff;
  font-size: 32px;
  line-height: 1;
  border: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#setupFab:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Native Dialog Styles */
dialog {
  border: none;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  width: 90%;
  max-width: 400px;
}

/* The semi-transparent overlay behind the modal */
dialog::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
  /* Modern frosted glass effect */
}

/* Style the top-right close button */
#closeDialogBtn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

.close-dialog {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #666;
}

/* =========================================
   HEADER: LOGGED OUT STATE
   ========================================= */
.header-logged-out {
  text-align: center;
  margin-top: 100px;
  transition: all 0.3s ease;
}

.header-logged-out .header-nav {
  display: block;
  /* Stacks the title and button */
}

.header-logged-out #header-title {
  font-size: 2.5rem;
  margin-bottom: 20px;
}

/* =========================================
   HEADER: LOGGED IN STATE (STICKY APP NAV)
   ========================================= */
.header-logged-in {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-color, #ffffff);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

.header-logged-in .header-nav {
  display: flex;
  justify-content: space-between;
  /* Pushes title left, button right */
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.header-logged-in #header-title {
  font-size: 1.5rem;
  margin: 0;
  /* Removes bottom margin for flexbox */
}

.header-logged-in #auth-btn {
  background: transparent;
  color: #333;
  border: 1px solid #ccc;
  padding: 5px 15px;
  max-width: 150px;
  width: 100%;
}

/* Stats Banner Flexbox (Only visible when logged in) */
.analytics-banner {
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 12px 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #ddd;
}

.stat-card {
  text-align: center;
  display: flex;
  align-items: center;
}

/* ---- No session ---- */
#no-session {
  text-align: center;
  padding: 40px 20px;
}

#no-session h2 {
  color: var(--text-error);
}

#no-session p {
  color: var(--text-secondary);
  margin-top: 10px;
}