/* Feedback Tab - floating side tab */

/* Tab trigger - vertical label on the right edge */
.feedback-tab {
  position: fixed;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1000;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  background: var(--accent-primary);
  color: var(--text-inverse);
  padding: var(--space-lg) 10px;
  border-radius: var(--border-radius-sm) 0 0 var(--border-radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  box-shadow: -2px 0 12px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  user-select: none;
}

.feedback-tab:hover {
  padding-right: 14px;
  background: var(--accent-secondary);
}

.feedback-tab-icon {
  font-size: 16px;
}

/* Slide-out panel */
.feedback-panel {
  position: fixed;
  right: -380px;
  top: 50%;
  transform: translateY(-50%);
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--bg-primary);
  border-radius: var(--border-radius) 0 0 var(--border-radius);
  box-shadow: var(--shadow-lg);
  z-index: 1001;
  transition: right 0.3s ease;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.feedback-panel.is-open {
  right: 0;
}

/* Panel header */
.feedback-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
}

.feedback-panel-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

.feedback-panel-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  padding: var(--space-xs);
  line-height: 1;
  border-radius: var(--space-xs);
  transition: color 0.2s, background 0.2s;
}

.feedback-panel-close:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

/* Panel body */
.feedback-panel-body {
  padding: var(--space-xl);
  overflow-y: auto;
  flex: 1;
}

.feedback-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.feedback-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedback-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.feedback-label-optional {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 13px;
}

.feedback-textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  font-family: inherit;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-primary);
  color: var(--text-primary);
  box-sizing: border-box;
}

.feedback-textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.feedback-textarea::placeholder {
  color: var(--text-muted);
}

.feedback-input {
  width: 100%;
  padding: 10px var(--space-md);
  border: 1px solid var(--border-light);
  border-radius: var(--border-radius-sm);
  font-size: 16px; /* 16px prevents iOS zoom on focus */
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--bg-primary);
  color: var(--text-primary);
  box-sizing: border-box;
}

.feedback-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.feedback-input::placeholder {
  color: var(--text-muted);
}

.feedback-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Submit button */
.feedback-submit {
  width: 100%;
  padding: var(--space-md) var(--space-xl);
  background: var(--accent-primary);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--border-radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.feedback-submit:hover:not(:disabled) {
  background: var(--accent-secondary);
}

.feedback-submit:active:not(:disabled) {
  transform: scale(0.98);
}

.feedback-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Success state */
.feedback-success {
  display: none;
  text-align: center;
  padding: var(--space-3xl) var(--space-xl);
}

.feedback-success.is-visible {
  display: block;
}

.feedback-success-icon {
  font-size: 48px;
  margin-bottom: var(--space-lg);
}

.feedback-success-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 var(--space-sm);
}

.feedback-success-message {
  font-size: 14px;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.5;
}

/* Error message */
.feedback-error {
  display: none;
  padding: var(--space-md);
  background: var(--warning-bg);
  border: 1px solid var(--warning-border);
  border-radius: var(--border-radius-sm);
  color: var(--error-color);
  font-size: 14px;
}

.feedback-error.is-visible {
  display: block;
}

/* Backdrop for mobile */
.feedback-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.feedback-backdrop.is-visible {
  display: block;
  opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 480px) {
  .feedback-tab {
    top: 61%;
    bottom: auto;
    transform: translateY(-50%);
    padding: var(--space-sm) 6px;
    writing-mode: horizontal-tb;
    border-radius: 20px 0 0 20px;
    opacity: 0.6;
    background: var(--accent-secondary);
  }
  
  /* Hide text on mobile, show only emoji */
  .feedback-tab-text {
    display: none;
  }
  
  .feedback-tab-icon {
    font-size: 20px;
  }
  
  .feedback-panel {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100%;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
    max-height: 80vh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
  }
  
  .feedback-panel.is-open {
    transform: translateY(0);
  }
  
  .feedback-panel-body {
    padding: var(--space-lg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  .feedback-textarea {
    min-height: 100px;
  }
}

/* Hide tab when panel is open */
.feedback-tab.is-hidden {
  opacity: 0;
  pointer-events: none;
}

