/* Modern CSS Reset for Widget */
.feedbacks-widget *,
.feedbacks-widget *::before,
.feedbacks-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Floating Action Button - Mobile First */
.feedbacks-button {
  position: fixed;
  bottom: 16px;
  right: 16px;
  min-height: 48px;
  min-width: 56px;
  padding: 0 24px;
  border-radius: 9999px;
  background: var(--feedbacks-primary, #2563eb);
  border: none;
  cursor: pointer;
  z-index: 999999;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #ffffff;
  font-size: clamp(12px, 2.2vw, 14px);
  line-height: 1;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  max-width: min(320px, calc(100vw - 32px));
  overflow: hidden;
  backdrop-filter: blur(8px);
  outline: none;
}

.feedbacks-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(37, 99, 235, 0.4);
  background: var(--feedbacks-primary-hover, #1d4ed8);
}

.feedbacks-button:active {
  transform: translateY(0);
}

.feedbacks-button-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.feedbacks-button-icon svg {
  width: 20px;
  height: 20px;
}

.feedbacks-button-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  line-height: 1;
}

.feedbacks-button-text {
  display: block;
}

.feedbacks-button-icon-only {
  padding: 0;
  width: 56px;
  min-width: 56px;
  height: 56px;
  border-radius: 50%;
}

.feedbacks-button-icon-only .feedbacks-button-text {
  display: none;
}

/* Position variants */
.feedbacks-button.position-bottom-left {
  left: 16px;
  right: auto;
}

.feedbacks-button.position-top-right {
  top: 16px;
  bottom: auto;
}

.feedbacks-button.position-top-left {
  top: 16px;
  left: 16px;
  bottom: auto;
  right: auto;
}

/* Tablet and larger screens */
@media (min-width: 768px) {
  .feedbacks-button {
    bottom: 24px;
    right: 24px;
    min-height: 52px;
    padding: 0 28px;
    gap: 10px;
    font-size: 16px;
    max-width: 360px;
  }

  .feedbacks-button-icon-only {
    width: 60px;
    min-width: 60px;
    height: 60px;
  }
  
  .feedbacks-button.position-bottom-left {
    left: 24px;
  }
  
  .feedbacks-button.position-top-right {
    top: 24px;
  }
  
  .feedbacks-button.position-top-left {
    top: 24px;
    left: 24px;
  }
}

/* Modal Overlay */
.feedbacks-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000000;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 0;
  backdrop-filter: blur(4px);
}

@media (min-width: 768px) {
  .feedbacks-overlay {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 24px;
  }
}

/* Modal Content - Mobile First */
.feedbacks-modal {
  background: white;
  border-radius: var(--feedbacks-radius, 24px) var(--feedbacks-radius, 24px) 0 0;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.15);
  animation: feedbacks-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}


@media (min-width: 768px) {
  .feedbacks-modal {
    border-radius: var(--feedbacks-radius, 16px);
    width: 100%;
    max-width: var(--feedbacks-modal-width, 480px);
    max-height: 85vh;
    animation: feedbacks-scale-up 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }

}

@keyframes feedbacks-slide-up {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes feedbacks-scale-up {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Modal Header */
.feedbacks-header {
  padding: var(--feedbacks-spacing, 24px) var(--feedbacks-spacing, 24px) 0 var(--feedbacks-spacing, 24px);
  border-bottom: 1px solid #f3f4f6;
  margin-bottom: 24px;
  position: relative;
}


.feedbacks-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  color: #6b7280;
}


.feedbacks-close:hover {
  background: #e5e7eb;
  color: #374151;
}

/* Form Content */
.feedbacks-content {
  padding: 0 var(--feedbacks-spacing, 24px) var(--feedbacks-spacing, 24px) var(--feedbacks-spacing, 24px);
}

.feedbacks-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.feedbacks-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--feedbacks-text-strong, #111827);
    margin: 0 0 8px 0;
  line-height: 1.3;
}

.feedbacks-subtitle {
  color: var(--feedbacks-text-muted, #6b7280);
  margin: 0 0 16px 0;
  font-size: 14px;
  line-height: 1.4;
}

/* Form Controls */
.feedbacks-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feedbacks-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--feedbacks-text-strong, #111827);
}

.feedbacks-textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  resize: vertical;
  transition: all 0.2s ease;
  line-height: 1.5;
}

.feedbacks-textarea:focus {
  outline: none;
  border-color: var(--feedbacks-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.feedbacks-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  transition: all 0.2s ease;
}

.feedbacks-input:focus {
  outline: none;
  border-color: var(--feedbacks-primary, #2563eb);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.feedbacks-char-count {
  font-size: 12px;
  color: var(--feedbacks-text-muted, #9ca3af);
  text-align: right;
  margin-top: 4px;
}

/* Action Buttons */
.feedbacks-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  flex-direction: column;
}


@media (min-width: 640px) {
  .feedbacks-actions {
    flex-direction: row;
    justify-content: flex-end;
  }
}

.feedbacks-btn {
  padding: 14px 24px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  text-align: center;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.feedbacks-btn-primary {
  background: var(--feedbacks-primary, #2563eb);
  color: white;
  border-color: var(--feedbacks-primary, #2563eb);
}

.feedbacks-btn-primary:hover:not(:disabled) {
  background: var(--feedbacks-primary-hover, #1d4ed8);
  border-color: var(--feedbacks-primary-hover, #1d4ed8);
  transform: translateY(-1px);
}

.feedbacks-btn-primary:disabled {
  background: #9ca3af;
  border-color: #9ca3af;
  cursor: not-allowed;
  transform: none;
}

.feedbacks-btn-secondary {
  background: white;
  color: #374151;
  border-color: #d1d5db;
}

.feedbacks-btn-secondary:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

/* Loading Spinner */
.feedbacks-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: feedbacks-spin 1s linear infinite;
}

@keyframes feedbacks-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Success State */
.feedbacks-success {
  text-align: center;
  padding: 32px 24px;
}

.feedbacks-success-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #10b981;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 24px;
}

.feedbacks-success h3 {
  color: #059669;
  margin-bottom: 8px;
  font-size: 20px;
  font-weight: 600;
}

.feedbacks-success p {
  color: #6b7280;
  margin-bottom: 20px;
  line-height: 1.5;
}

.feedbacks-success .feedbacks-btn {
  margin: 0 auto;
  display: block;
}

/* Error States */
.feedbacks-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 12px 16px;
  color: #dc2626;
  font-size: 14px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

/* Safe Area Adjustments for iOS */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .feedbacks-modal {
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
  }
  
  .feedbacks-button.position-bottom-right {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  
  .feedbacks-button.position-bottom-left {
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .feedbacks-button {
    border: 2px solid white;
  }
  
  .feedbacks-textarea:focus,
  .feedbacks-input:focus {
    border-width: 3px;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .feedbacks-button,
  .feedbacks-btn,
  .feedbacks-textarea,
  .feedbacks-input {
    transition: none;
  }
  
  .feedbacks-modal {
    animation: none;
  }
  
  .feedbacks-spinner {
    animation: none;
  }
}

/* Inline Container Styles */
.feedbacks-inline-container {
  background: var(--feedbacks-bg, #ffffff);
  border-radius: var(--feedbacks-radius, 12px);
  padding: var(--feedbacks-spacing, 24px);
  border: var(--feedbacks-border, 1px solid #e5e7eb);
  box-shadow: var(--feedbacks-shadow, 0 8px 24px rgba(0, 0, 0, 0.06));
  overflow: hidden; /* ensure content respects pill radius */
}

/* Header icon styles */
.feedbacks-header-icon { color: var(--feedbacks-primary, #2563eb); margin-bottom: 6px; }
.feedbacks-header-row { display: flex; align-items: center; gap: 10px; }
.feedbacks-header-text { display: flex; flex-direction: column; }

/* Ensure long text wraps inside modal */
.feedbacks-widget {
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--feedbacks-text-strong, #111827);
}

/* Dark Mode Support - Apply to all widget containers */
@media (prefers-color-scheme: dark) {
  .feedbacks-modal,
  .feedbacks-inline-container {
    background: var(--feedbacks-bg, #1f2937);
    border-color: #374151;
  }

  .feedbacks-widget {
    --feedbacks-text-strong: #f9fafb;
    --feedbacks-text-muted: #d1d5db;
  }
  
  .feedbacks-textarea,
  .feedbacks-input {
    background: #374151;
    border-color: #4b5563;
    color: #f9fafb;
  }
  
  .feedbacks-textarea::placeholder,
  .feedbacks-input::placeholder {
    color: #9ca3af;
    opacity: 1;
  }
  
  .feedbacks-textarea:focus,
  .feedbacks-input:focus {
    border-color: #3b82f6;
    background: #374151;
  }
  
  .feedbacks-btn-secondary {
    background: #374151;
    color: #d1d5db;
    border-color: #4b5563;
  }
  
  .feedbacks-btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
  }
  
  .feedbacks-close {
    background: #374151;
    color: #d1d5db;
  }
  
  .feedbacks-close:hover {
    background: #4b5563;
  }
  
  .feedbacks-char-count {
    color: #9ca3af;
  }
}

