/* ─── FEEDBACK WIDGET ─────────────────────────────────────────── */

#feedback-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  font-family: 'Geist', sans-serif;
  pointer-events: none;
}

#feedback-trigger,
#feedback-panel {
  pointer-events: auto;
}

/* ── Trigger button ── */
#feedback-trigger {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--text-primary);
  color: var(--bg-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(0,0,0,0.14);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  flex-shrink: 0;
}

#feedback-trigger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.18);
}

#feedback-trigger:active {
  transform: translateY(0);
}

#feedback-trigger svg {
  transition: transform 0.25s ease;
  display: block;
}

#feedback-trigger.is-open {
  background: var(--text-brand-primary);
}

#feedback-trigger.is-open svg {
  transform: rotate(180deg);
}

/* ── Panel ── */
#feedback-panel {
  width: 320px;
  background: var(--bg-surface);
  border-radius: var(--radius-l);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.07), 0 8px 32px rgba(0,0,0,0.12);
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0.92) translateY(8px);
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.18s ease, visibility 0s linear 0.22s;
}

#feedback-panel.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: auto;
  visibility: visible;
  transition: transform 0.22s cubic-bezier(0.34, 1.2, 0.64, 1), opacity 0.18s ease, visibility 0s linear 0s;
}

/* ── Panel header ── */
.fb-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 0;
}

.fb-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
}

.fb-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 4px 0 0;
  line-height: 1.5;
}

.fb-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px;
  color: var(--text-label);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: color 0.15s ease, background 0.15s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.fb-close:hover {
  color: var(--text-primary);
  background: var(--bg-container);
}

/* ── Form ── */
.fb-form {
  padding: 14px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Category pills ── */
.fb-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fb-cat {
  font-size: 11px;
  font-weight: 500;
  font-family: 'Geist', sans-serif;
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-container);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
  line-height: 1.4;
}

.fb-cat:hover {
  border-color: var(--text-primary);
  color: var(--text-primary);
}

.fb-cat.is-selected {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: var(--bg-surface);
}

/* ── Inputs ── */
.fb-textarea,
.fb-input {
  width: 100%;
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-container);
  border: 1px solid transparent;
  border-radius: var(--radius-m);
  padding: 10px 12px;
  resize: none;
  transition: border-color 0.15s ease;
  box-sizing: border-box;
  -webkit-appearance: none;
}

.fb-textarea::placeholder,
.fb-input::placeholder {
  color: var(--text-label);
}

.fb-textarea:focus,
.fb-input:focus {
  outline: none;
  border-color: var(--text-primary);
}

.fb-textarea {
  height: 88px;
  line-height: 1.5;
}

/* ── Optional fields toggle ── */
.fb-optional-toggle {
  font-size: 11px;
  color: var(--text-label);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: 'Geist', sans-serif;
  text-align: left;
  transition: color 0.15s ease;
}

.fb-optional-toggle:hover {
  color: var(--text-secondary);
}

.fb-optional-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.25s ease, opacity 0.2s ease;
}

.fb-optional-fields.is-open {
  max-height: 200px;
  opacity: 1;
}

/* ── Star rating ── */
.fb-rating-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.fb-rating-label-title {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}

.fb-stars {
  display: flex;
  gap: 4px;
}

.fb-star {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  opacity: 0.3;
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.fb-star:hover,
.fb-star.is-active {
  opacity: 1;
}

.fb-star:hover {
  transform: scale(1.2);
}


/* ── Submit button ── */
.fb-submit {
  width: 100%;
  height: 38px;
  background: var(--text-primary);
  color: var(--bg-surface);
  border: none;
  border-radius: var(--radius-m);
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.fb-submit:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.fb-submit:active {
  transform: translateY(0);
}

.fb-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Success / Error states ── */
.fb-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 10px;
}

.fb-state.is-visible {
  display: flex;
}

.fb-state-icon {
  font-size: 28px;
  line-height: 1;
}

.fb-state-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.fb-state-body {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fb-state-back {
  font-size: 12px;
  color: var(--text-brand-primary);
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Geist', sans-serif;
  padding: 0;
  margin-top: 4px;
  transition: opacity 0.15s ease;
}

.fb-state-back:hover {
  opacity: 0.7;
}

/* ── Mobile ── */
@media (max-width: 600px) {
  #feedback-widget {
    bottom: 16px;
    right: 16px;
  }

  #feedback-panel {
    width: calc(100vw - 32px);
    max-height: calc(100svh - 100px);
    overflow-y: auto;
    transform-origin: bottom right;
  }
}
