/**
 * Customer Feedback Manager - Frontend Styles
 * Modern CSS with custom properties for extensibility
 */

:root {
  /* Color Palette */
  --cfm-primary: #0073aa;
  --cfm-primary-hover: #005a87;
  --cfm-primary-light: #e6f3ff;
  --cfm-secondary: #666666;
  --cfm-success: #46b450;
  --cfm-error: #dc3232;
  --cfm-warning: #ffb900;
  --cfm-border: #ddd;
  --cfm-border-light: #f0f0f0;
  --cfm-text: #333333;
  --cfm-text-light: #666666;
  --cfm-text-muted: #999999;
  --cfm-background: #ffffff;
  --cfm-background-light: #f9f9f9;
  --cfm-background-dark: #f1f1f1;

  /* Typography */
  --cfm-font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu,
    Cantarell, "Helvetica Neue", sans-serif;
  --cfm-font-size-base: 16px;
  --cfm-font-size-small: 14px;
  --cfm-font-size-large: 18px;
  --cfm-line-height: 1.5;

  /* Spacing */
  --cfm-spacing-xs: 4px;
  --cfm-spacing-sm: 8px;
  --cfm-spacing-md: 16px;
  --cfm-spacing-lg: 24px;
  --cfm-spacing-xl: 32px;

  /* Border Radius */
  --cfm-radius-sm: 4px;
  --cfm-radius-md: 6px;
  --cfm-radius-lg: 8px;

  /* Shadows */
  --cfm-shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --cfm-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --cfm-shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);

  /* Transitions */
  --cfm-transition: all 0.3s ease;
  --cfm-transition-fast: all 0.15s ease;
}

/* Form Container */
.cfm-form-container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--cfm-spacing-lg);
  background: var(--cfm-background);
  border: 1px solid var(--cfm-border);
  border-radius: var(--cfm-radius-lg);
  box-shadow: var(--cfm-shadow-sm);
  font-family: var(--cfm-font-family);
}

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

/* Form Rows */
.cfm-form-row {
  display: flex;
  flex-direction: column;
  gap: var(--cfm-spacing-md);
}

.cfm-name-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--cfm-spacing-md);
}

@media (max-width: 600px) {
  .cfm-name-row {
    grid-template-columns: 1fr;
  }
}

/* Form Fields */
.cfm-form-field {
  display: flex;
  flex-direction: column;
  gap: var(--cfm-spacing-sm);
}

.cfm-field-label {
  font-weight: 600;
  color: var(--cfm-text);
  font-size: var(--cfm-font-size-base);
  line-height: var(--cfm-line-height);
}

.cfm-required {
  color: var(--cfm-error);
  margin-left: var(--cfm-spacing-xs);
}

/* Input Styles */
.cfm-input {
  padding: var(--cfm-spacing-md);
  border: 2px solid var(--cfm-border);
  border-radius: var(--cfm-radius-md);
  font-size: var(--cfm-font-size-base);
  font-family: var(--cfm-font-family);
  line-height: var(--cfm-line-height);
  transition: var(--cfm-transition-fast);
  background: var(--cfm-background);
  color: var(--cfm-text);
}

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

.cfm-input:invalid {
  border-color: var(--cfm-error);
}

.cfm-textarea-input {
  resize: vertical;
  min-height: 100px;
}

/* Star Rating */
.cfm-star-rating {
  display: flex;
  align-items: center;
  gap: var(--cfm-spacing-xs);
  margin: var(--cfm-spacing-sm) 0;
}

.cfm-star {
  cursor: pointer;
  color: var(--cfm-border);
  transition: var(--cfm-transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cfm-star:hover,
.cfm-star.active {
  color: var(--cfm-warning);
  transform: scale(1.1);
}

.cfm-star svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

.cfm-rating-text {
  margin-left: var(--cfm-spacing-md);
  font-size: var(--cfm-font-size-small);
  color: var(--cfm-text-light);
  font-weight: 500;
}

/* Character Counter */
.cfm-char-count {
  text-align: right;
  font-size: var(--cfm-font-size-small);
  color: var(--cfm-text-muted);
  margin-top: var(--cfm-spacing-xs);
}

.cfm-char-count.warning {
  color: var(--cfm-warning);
}

.cfm-char-count.error {
  color: var(--cfm-error);
}

/* Submit Button */
.cfm-submit-row {
  margin-top: var(--cfm-spacing-lg);
}

.cfm-submit-btn {
  background: var(--cfm-primary);
  color: white;
  border: none;
  padding: var(--cfm-spacing-md) var(--cfm-spacing-xl);
  border-radius: var(--cfm-radius-md);
  font-size: var(--cfm-font-size-base);
  font-weight: 600;
  cursor: pointer;
  transition: var(--cfm-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--cfm-spacing-sm);
  min-height: 48px;
  font-family: var(--cfm-font-family);
}

.cfm-submit-btn:hover:not(:disabled) {
  background: var(--cfm-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--cfm-shadow-md);
}

.cfm-submit-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.cfm-submit-loading {
  display: flex;
  align-items: center;
  gap: var(--cfm-spacing-sm);
}

.cfm-spinner {
  animation: spin 1s linear infinite;
}

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

/* Messages */
.cfm-form-messages {
  margin-top: var(--cfm-spacing-md);
}

.cfm-success-message,
.cfm-error-message {
  padding: var(--cfm-spacing-md);
  border-radius: var(--cfm-radius-md);
  font-weight: 500;
  margin-bottom: var(--cfm-spacing-md);
}

.cfm-success-message {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.cfm-error-message {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Celebration Success Message */
.cfm-success-celebration {
  animation: cfm-celebration-bounce 0.6s ease-out;
  background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
  border: 2px solid #28a745;
  box-shadow: 0 4px 20px rgba(40, 167, 69, 0.3);
  transform: scale(1.02);
  transition: all 0.3s ease;
}

.cfm-celebration-message {
  font-size: 1.1em;
  font-weight: 600;
  text-align: center;
  animation: cfm-text-glow 2s ease-in-out infinite alternate;
}

/* Celebration Animations */
@keyframes cfm-celebration-bounce {
  0% {
    transform: scale(0.8) translateY(20px);
    opacity: 0;
  }
  50% {
    transform: scale(1.05) translateY(-5px);
  }
  100% {
    transform: scale(1.02) translateY(0);
    opacity: 1;
  }
}

@keyframes cfm-text-glow {
  0% {
    text-shadow: 0 0 5px rgba(40, 167, 69, 0.5);
  }
  100% {
    text-shadow:
      0 0 15px rgba(40, 167, 69, 0.8),
      0 0 25px rgba(40, 167, 69, 0.4);
  }
}

/* Responsive adjustments for celebration */
@media (max-width: 600px) {
  .cfm-celebration-message {
    font-size: 1em;
  }

  .cfm-success-celebration {
    transform: scale(1.01);
  }
}

/* Feedback Display */
.cfm-feedback-display {
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--cfm-spacing-lg);
  font-family: var(--cfm-font-family);
}

.cfm-feedback-item {
  background: var(--cfm-background);
  border: 1px solid var(--cfm-border);
  border-radius: var(--cfm-radius-lg);
  padding: var(--cfm-spacing-lg);
  box-shadow: var(--cfm-shadow-sm);
  transition: var(--cfm-transition);
}

.cfm-feedback-item:hover {
  box-shadow: var(--cfm-shadow-md);
  transform: translateY(-2px);
}

.cfm-feedback-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--cfm-spacing-md);
  flex-wrap: wrap;
  gap: var(--cfm-spacing-sm);
}

.cfm-feedback-author {
  font-weight: 600;
  color: var(--cfm-text);
}

.cfm-feedback-rating {
  display: flex;
  align-items: center;
  gap: var(--cfm-spacing-sm);
}

.cfm-stars-display {
  display: flex;
  gap: 2px;
}

.cfm-star-filled {
  color: var(--cfm-warning);
}

.cfm-star-empty {
  color: var(--cfm-border);
}

.cfm-rating-text {
  font-size: var(--cfm-font-size-small);
  color: var(--cfm-text-light);
}

.cfm-feedback-date {
  font-size: var(--cfm-font-size-small);
  color: var(--cfm-text-muted);
}

.cfm-feedback-content {
  color: var(--cfm-text);
  line-height: var(--cfm-line-height);
}

.cfm-feedback-comment p {
  margin: 0 0 var(--cfm-spacing-md) 0;
  color: black !important;
}

.cfm-feedback-comment p:last-child {
  margin-bottom: 0;
  color: black !important;
}

/* No Feedback Message */
.cfm-no-feedback {
  text-align: center;
  padding: var(--cfm-spacing-xl);
  color: var(--cfm-text-muted);
  font-style: italic;
  background: var(--cfm-background-light);
  border: 1px solid var(--cfm-border-light);
  border-radius: var(--cfm-radius-md);
}

/* Feedback Stats */
.cfm-feedback-stats {
  background: var(--cfm-background);
  border: 1px solid var(--cfm-border);
  border-radius: var(--cfm-radius-lg);
  padding: var(--cfm-spacing-lg);
  margin: var(--cfm-spacing-lg) 0;
  display: flex;
  flex-direction: column;
  gap: var(--cfm-spacing-md);
  font-family: var(--cfm-font-family);
}

.cfm-stat-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--cfm-spacing-md);
  background: var(--cfm-background-light);
  border-radius: var(--cfm-radius-md);
}

.cfm-stat-label {
  font-weight: 600;
  color: var(--cfm-text);
}

.cfm-stat-value {
  font-weight: 700;
  color: var(--cfm-primary);
  display: flex;
  align-items: center;
  gap: var(--cfm-spacing-sm);
}

.cfm-stars-small .cfm-star svg {
  width: 12px;
  height: 12px;
}

.cfm-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: var(--cfm-spacing-sm);
  width: 100%;
}

.cfm-breakdown-item {
  display: grid;
  grid-template-columns: 80px 1fr 40px;
  align-items: center;
  gap: var(--cfm-spacing-md);
}

.cfm-breakdown-bar {
  height: 8px;
  background: var(--cfm-border-light);
  border-radius: var(--cfm-radius-sm);
  overflow: hidden;
}

.cfm-breakdown-fill {
  height: 100%;
  background: var(--cfm-primary);
  transition: var(--cfm-transition);
}

/* Language Switcher Styles */
.cfm-language-switcher {
  margin: var(--cfm-spacing-md) 0;
  font-family: var(--cfm-font-family);
}

.cfm-language-select {
  padding: var(--cfm-spacing-xs) var(--cfm-spacing-sm);
  border: 1px solid var(--cfm-border-color);
  border-radius: var(--cfm-border-radius);
  background-color: var(--cfm-background-color);
  color: var(--cfm-text-color);
  font-size: var(--cfm-font-size-sm);
  cursor: pointer;
  transition: border-color 0.3s ease;
}

.cfm-language-select:hover,
.cfm-language-select:focus {
  border-color: var(--cfm-primary);
  outline: none;
}

.cfm-language-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: var(--cfm-spacing-sm);
  flex-wrap: wrap;
}

.cfm-language-list.cfm-language-flags {
  gap: var(--cfm-spacing-xs);
}

.cfm-language-item {
  margin: 0;
}

.cfm-language-item a {
  display: inline-flex;
  align-items: center;
  gap: var(--cfm-spacing-xs);
  padding: var(--cfm-spacing-xs) var(--cfm-spacing-sm);
  text-decoration: none;
  color: var(--cfm-text-color);
  border: 1px solid var(--cfm-border-color);
  border-radius: var(--cfm-border-radius);
  background-color: var(--cfm-background-color);
  font-size: var(--cfm-font-size-sm);
  transition: all 0.3s ease;
}

.cfm-language-item a:hover {
  background-color: var(--cfm-primary);
  color: white;
  border-color: var(--cfm-primary);
}

.cfm-language-item.current a {
  background-color: var(--cfm-primary);
  color: white;
  border-color: var(--cfm-primary);
}

.cfm-language-flags .cfm-language-item a {
  padding: var(--cfm-spacing-xs);
  min-width: 40px;
  justify-content: center;
}

.cfm-flag {
  font-size: 1.2em;
  line-height: 1;
}

.cfm-lang-name {
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .cfm-form-container {
    padding: var(--cfm-spacing-md);
    margin: var(--cfm-spacing-md);
  }

  .cfm-feedback-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .cfm-stat-item {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--cfm-spacing-sm);
  }

  .cfm-breakdown-item {
    grid-template-columns: 1fr;
    gap: var(--cfm-spacing-xs);
  }

  .cfm-language-list {
    justify-content: center;
  }

  .cfm-language-select {
    width: 100%;
    max-width: 200px;
  }
}
