/* Vanilla equivalents of the Customer Portal's Tailwind-styled FeedbackWidget. */

/* `display: flex` below overrides the browser's default styling for the
   [hidden] attribute, so make sure hidden state always wins. */
.fb-tab[hidden],
.fb-backdrop[hidden] {
  display: none !important;
}

/* Vertical tab on the right edge */
.fb-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  background: var(--color-canary-yellow);
  color: var(--color-steel-blue);
  padding: 16px 10px;
  border: none;
  border-radius: 6px 0 0 6px;
  box-shadow: 0 4px 12px rgba(33, 55, 65, 0.15);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  writing-mode: vertical-rl;
  margin: 0;
  text-transform: none;
  transition: background 0.15s, color 0.15s;
}

.fb-tab:hover {
  background: var(--color-steel-blue);
  color: var(--color-canary-yellow);
}

/* The global `button:active { transform: translateY(1px) }` in styles.css
   was clobbering our centering transform on mousedown — that's why the tab
   visibly dropped about half its height as you clicked it. Keep the centering
   pinned and use a soft shadow shift for the press feedback instead. */
.fb-tab:active:not(:disabled) {
  transform: translateY(-50%);
  box-shadow: 0 2px 6px rgba(33, 55, 65, 0.25);
}

/* Backdrop + modal */
.fb-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(33, 55, 65, 0.5);
  display: flex;
  justify-content: center;
  /* Anchor to top so the modal doesn't recenter (and visually "jump") when
     the improvement textarea expands its height. */
  align-items: flex-start;
  padding: 10vh 16px 16px;
  overflow-y: auto;
}

@media (max-width: 640px) {
  .fb-backdrop {
    align-items: flex-end;
    padding: 16px;
  }
}

.fb-modal {
  background: #fff;
  border: 2px solid var(--color-steel-blue);
  border-radius: 8px;
  width: 100%;
  max-width: 448px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(33, 55, 65, 0.25);
}

.fb-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 4px;
}

.fb-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-mid-grey);
  margin-bottom: 4px;
}

.fb-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: var(--display-leading);
  letter-spacing: -0.01em;
  color: var(--color-steel-blue);
  margin: 0;
}

.fb-close {
  background: transparent;
  border: none;
  color: var(--color-mid-grey);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  padding: 4px 8px;
  cursor: pointer;
  margin: 0;
  border-radius: 4px;
}

.fb-close:hover:not(:disabled) {
  color: var(--color-steel-blue);
  background: transparent;
}

.fb-close:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fb-sub {
  font-family: var(--font-body);
  color: var(--color-mid-grey);
  font-size: 0.875rem;
  margin: 8px 0 20px;
  line-height: 1.5;
}

/* Star row */
.fb-stars {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-star {
  background: transparent;
  border: none;
  padding: 4px;
  margin: 0;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.1s;
}

.fb-star:hover:not(:disabled) {
  transform: scale(1.1);
  background: transparent;
}

.fb-star:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fb-star:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bright-blue);
}

.fb-stars-count {
  margin-left: 8px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-mid-grey);
}

/* Improvement textarea */
.fb-improve {
  display: block;
  margin-top: 20px;
}

.fb-improve-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-mid-grey);
  margin-bottom: 6px;
}

.fb-required {
  color: var(--color-red-orange);
  font-weight: 700;
}

.fb-improve-input {
  width: 100%;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 0.9375rem;
  color: var(--color-steel-blue);
  resize: vertical;
  min-height: 88px;
}

.fb-improve-input:focus {
  outline: none;
  border-color: var(--color-bright-blue);
  box-shadow: 0 0 0 3px rgba(49, 113, 241, 0.3);
}

.fb-improve-input:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fb-improve-count {
  font-size: 0.75rem;
  color: var(--color-mid-grey);
  text-align: right;
  margin-top: 4px;
}

/* Error */
.fb-error {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid var(--color-red-orange);
  background: rgba(255, 96, 59, 0.1);
  border-radius: 2px;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-steel-blue);
}

/* Actions */
.fb-actions {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fb-btn {
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1.5px solid var(--color-steel-blue);
  cursor: pointer;
  margin: 0;
  text-transform: none;
}

.fb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.fb-btn-primary {
  background: var(--color-steel-blue);
  color: var(--color-canary-yellow);
}

.fb-btn-primary:hover:not(:disabled) {
  background: var(--color-canary-yellow);
  color: var(--color-steel-blue);
}

.fb-btn-secondary {
  background: transparent;
  color: var(--color-steel-blue);
}

.fb-btn-secondary:hover:not(:disabled) {
  background: var(--color-steel-blue);
  color: var(--color-canary-yellow);
}

/* Sent confirmation row */
.fb-sent-row {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-off-white);
  border-radius: 2px;
}

.fb-sent-check {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-steel-blue);
  color: var(--color-off-white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fb-sent-row p {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.875rem;
  color: var(--color-steel-blue);
  line-height: 1.5;
}
