/**
 * Feedback Widget Styles
 * Production-ready CSS for the beta testing feedback widget
 */

/* ============================================
   CSS Variables
   ============================================ */
:root {
  --feedback-primary: #2563eb;
  --feedback-primary-hover: #1d4ed8;
  --feedback-primary-light: #dbeafe;
  --feedback-success: #10b981;
  --feedback-success-light: #d1fae5;
  --feedback-error: #ef4444;
  --feedback-error-light: #fee2e2;
  --feedback-warning: #f59e0b;
  --feedback-text: #1f2937;
  --feedback-text-light: #6b7280;
  --feedback-border: #e5e7eb;
  --feedback-background: #ffffff;
  --feedback-overlay: rgba(0, 0, 0, 0.5);
  --feedback-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --feedback-shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --feedback-radius: 12px;
  --feedback-radius-sm: 8px;
  --feedback-transition: 0.2s ease;
  --feedback-z-index: 10000;
}

/* ============================================
   Floating Button
   ============================================ */
.feedback-widget-button {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--feedback-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--feedback-shadow-sm);
  z-index: var(--feedback-z-index);
  transition: all var(--feedback-transition);
  overflow: hidden;
}

.feedback-widget-button:hover {
  background: var(--feedback-primary-hover);
  transform: scale(1.05);
  box-shadow: var(--feedback-shadow);
  width: auto;
  padding: 0 20px;
  border-radius: 30px;
}

.feedback-widget-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--feedback-primary-light), var(--feedback-shadow);
}

.feedback-widget-button:focus-visible {
  outline: 2px solid var(--feedback-primary);
  outline-offset: 2px;
}

.feedback-widget-button svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.feedback-button-text {
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  margin-left: 0;
  opacity: 0;
  transition: all var(--feedback-transition);
  font-size: 14px;
  font-weight: 600;
}

.feedback-widget-button:hover .feedback-button-text {
  max-width: 100px;
  margin-left: 8px;
  opacity: 1;
}

/* ============================================
   Modal Container
   ============================================ */
.feedback-widget-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: calc(var(--feedback-z-index) + 1);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--feedback-transition), visibility var(--feedback-transition);
}

.feedback-widget-modal.feedback-modal-open {
  opacity: 1;
  visibility: visible;
}

/* Overlay */
.feedback-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--feedback-overlay);
  animation: feedbackFadeIn 0.2s ease;
}

/* Modal Content */
.feedback-modal-content {
  position: relative;
  background: var(--feedback-background);
  border-radius: var(--feedback-radius);
  box-shadow: var(--feedback-shadow);
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow: hidden;
  transform: scale(0.95) translateY(10px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.feedback-modal-open .feedback-modal-content {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* ============================================
   Modal Header
   ============================================ */
.feedback-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--feedback-border);
}

.feedback-modal-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--feedback-text);
}

.feedback-close-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: var(--feedback-radius-sm);
  cursor: pointer;
  color: var(--feedback-text-light);
  transition: all var(--feedback-transition);
}

.feedback-close-button:hover {
  background: var(--feedback-border);
  color: var(--feedback-text);
}

.feedback-close-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--feedback-primary-light);
}

/* ============================================
   Modal Body
   ============================================ */
.feedback-modal-body {
  padding: 24px;
  overflow-y: auto;
  max-height: calc(90vh - 70px);
}

/* ============================================
   Feedback Options
   ============================================ */
.feedback-options-intro {
  margin: 0 0 16px;
  font-size: 14px;
  color: var(--feedback-text-light);
  text-align: center;
}

.feedback-option-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.feedback-option-button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: var(--feedback-background);
  border: 2px solid var(--feedback-border);
  border-radius: var(--feedback-radius);
  cursor: pointer;
  transition: all var(--feedback-transition);
  color: #ffffff !important;
  font-size: 14px;
  font-weight: 500;
}

.feedback-option-button,
.feedback-option-button * {
  color: #ffffff !important;
}

.feedback-option-button:hover {
  border-color: var(--feedback-primary);
  background: var(--feedback-primary-light);
  color: #ffffff !important;
}

.feedback-option-button:hover,
.feedback-option-button:hover * {
  color: #ffffff !important;
}

.feedback-option-button:focus {
  outline: none;
  border-color: var(--feedback-primary);
  box-shadow: 0 0 0 3px var(--feedback-primary-light);
}

.feedback-option-icon {
  font-size: 32px;
  margin-bottom: 8px;
  line-height: 1;
}

.feedback-option-label {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff !important;
  text-align: center;
}

/* ============================================
   Form Container
   ============================================ */
.feedback-form-container {
  animation: feedbackSlideIn 0.2s ease;
}

.feedback-back-button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  margin-bottom: 16px;
  background: transparent;
  border: none;
  border-radius: var(--feedback-radius-sm);
  cursor: pointer;
  font-size: 14px;
  color: var(--feedback-text-light);
  transition: all var(--feedback-transition);
}

.feedback-back-button:hover {
  background: var(--feedback-border);
  color: var(--feedback-text);
}

.feedback-back-button:focus {
  outline: none;
  box-shadow: 0 0 0 2px var(--feedback-primary-light);
}

.feedback-form-type-badge {
  display: inline-block;
  padding: 6px 12px;
  background: var(--feedback-primary-light);
  color: var(--feedback-primary);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 20px;
}

/* ============================================
   Form Elements
   ============================================ */
.feedback-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.feedback-label,
.feedback-form-group label {
  font-size: 14px;
  font-weight: 500;
  color: #ffffff;
}

.feedback-required {
  color: var(--feedback-error);
}

.feedback-input,
.feedback-textarea,
.feedback-select {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  color: #ffffff;
  background: #333333;
  border: 2px solid var(--feedback-border);
  border-radius: var(--feedback-radius-sm);
  transition: all var(--feedback-transition);
  font-family: inherit;
  box-sizing: border-box;
}

.feedback-input:hover,
.feedback-textarea:hover,
.feedback-select:hover {
  border-color: #d1d5db;
}

.feedback-input:focus,
.feedback-textarea:focus,
.feedback-select:focus {
  outline: none;
  border-color: var(--feedback-primary);
  box-shadow: 0 0 0 3px var(--feedback-primary-light);
}

.feedback-input::placeholder,
.feedback-textarea::placeholder {
  color: #cccccc;
}

.feedback-textarea {
  resize: vertical;
  min-height: 120px;
}

.feedback-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
}

.feedback-hint {
  font-size: 12px;
  color: var(--feedback-text-light);
}

/* ============================================
   Form Actions
   ============================================ */
.feedback-form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.feedback-cancel-button,
.feedback-submit-button {
  flex: 1;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--feedback-radius-sm);
  cursor: pointer;
  transition: all var(--feedback-transition);
  font-family: inherit;
}

.feedback-cancel-button {
  background: transparent;
  border: 2px solid var(--feedback-border);
  color: var(--feedback-text-light);
}

.feedback-cancel-button:hover {
  background: var(--feedback-border);
  color: var(--feedback-text);
}

.feedback-cancel-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--feedback-primary-light);
}

.feedback-submit-button {
  background: var(--feedback-primary);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedback-submit-button:hover:not(:disabled) {
  background: var(--feedback-primary-hover);
}

.feedback-submit-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--feedback-primary-light);
}

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

.feedback-submit-loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.feedback-spinner {
  animation: feedbackSpin 1s linear infinite;
}

/* ============================================
   Success View
   ============================================ */
.feedback-success {
  text-align: center;
  padding: 24px 0;
  animation: feedbackFadeIn 0.3s ease;
}

.feedback-success-icon {
  font-size: 64px;
  margin-bottom: 16px;
  line-height: 1;
}

.feedback-success-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--feedback-text);
}

.feedback-success-message {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--feedback-text-light);
}

.feedback-success-button {
  padding: 12px 32px;
  background: var(--feedback-success);
  color: white;
  border: none;
  border-radius: var(--feedback-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--feedback-transition);
  font-family: inherit;
}

.feedback-success-button:hover {
  background: #059669;
}

.feedback-success-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--feedback-success-light);
}

/* ============================================
   Error View
   ============================================ */
.feedback-error {
  text-align: center;
  padding: 24px 0;
  animation: feedbackFadeIn 0.3s ease;
}

.feedback-error-icon {
  font-size: 64px;
  margin-bottom: 16px;
  line-height: 1;
}

.feedback-error-title {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 600;
  color: var(--feedback-text);
}

.feedback-error-message {
  margin: 0 0 24px;
  font-size: 14px;
  color: var(--feedback-error);
}

.feedback-error-button {
  padding: 12px 32px;
  background: var(--feedback-error);
  color: white;
  border: none;
  border-radius: var(--feedback-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--feedback-transition);
  font-family: inherit;
}

.feedback-error-button:hover {
  background: #dc2626;
}

.feedback-error-button:focus {
  outline: none;
  box-shadow: 0 0 0 3px var(--feedback-error-light);
}

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

@keyframes feedbackSlideIn {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes feedbackSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ============================================
   Mobile Responsive
   ============================================ */
@media screen and (max-width: 480px) {
  .feedback-widget-button {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
  }

  .feedback-widget-button:hover {
    width: 56px;
    padding: 0;
    border-radius: 50%;
  }

  .feedback-widget-button:hover .feedback-button-text {
    max-width: 0;
    margin-left: 0;
    opacity: 0;
  }

  .feedback-modal-content {
    width: 90vw;
    max-width: none;
    max-height: 85vh;
    margin: 0 5vw;
  }

  .feedback-modal-header {
    padding: 16px 20px;
  }

  .feedback-modal-header h2 {
    font-size: 16px;
  }

  .feedback-modal-body {
    padding: 20px;
    max-height: calc(85vh - 60px);
  }

  .feedback-option-buttons {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .feedback-option-button {
    flex-direction: row;
    justify-content: flex-start;
    padding: 16px;
    gap: 12px;
  }

  .feedback-option-icon {
    font-size: 24px;
    margin-bottom: 0;
  }

  .feedback-form-actions {
    flex-direction: column-reverse;
  }

  .feedback-cancel-button,
  .feedback-submit-button {
    width: 100%;
  }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */
@media (prefers-contrast: high) {
  .feedback-widget-button {
    border: 2px solid white;
  }

  .feedback-modal-content {
    border: 2px solid var(--feedback-text);
  }

  .feedback-option-button {
    border-width: 3px;
  }

  .feedback-input,
  .feedback-textarea,
  .feedback-select {
    border-width: 3px;
  }
}

/* ============================================
   Reduced Motion Support
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .feedback-widget-button,
  .feedback-modal-content,
  .feedback-option-button,
  .feedback-input,
  .feedback-textarea,
  .feedback-select,
  .feedback-cancel-button,
  .feedback-submit-button,
  .feedback-close-button,
  .feedback-back-button {
    transition: none;
  }

  .feedback-widget-modal {
    transition: opacity 0.01s;
  }

  .feedback-spinner {
    animation: none;
  }

  .feedback-success,
  .feedback-error,
  .feedback-form-container {
    animation: none;
  }
}

/* ============================================
   Dark Mode Support (optional)
   ============================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --feedback-text: #f9fafb;
    --feedback-text-light: #9ca3af;
    --feedback-border: #374151;
    --feedback-background: #1f2937;
    --feedback-overlay: rgba(0, 0, 0, 0.7);
    --feedback-primary-light: rgba(37, 99, 235, 0.2);
    --feedback-success-light: rgba(16, 185, 129, 0.2);
    --feedback-error-light: rgba(239, 68, 68, 0.2);
  }

  .feedback-input,
  .feedback-textarea,
  .feedback-select {
    background: #111827;
  }

  .feedback-input::placeholder,
  .feedback-textarea::placeholder {
    color: #6b7280;
  }

  .feedback-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  }

  .feedback-cancel-button:hover {
    background: #374151;
  }
}

/* ============================================
   Print Styles (hide widget when printing)
   ============================================ */
@media print {
  .feedback-widget-button,
  .feedback-widget-modal {
    display: none !important;
  }
}
