:root {
  --feedback-primary: #6366f1;
  --feedback-primary-dark: #4f46e5;
  --feedback-success: #10b981;
  --feedback-warning: #f59e0b;
  --feedback-error: #ef4444;
  --feedback-text: #1f2937;
  --feedback-text-light: #6b7280;
  --feedback-bg: #ffffff;
  --feedback-bg-secondary: #f9fafb;
  --feedback-border: #e5e7eb;
  --feedback-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --feedback-radius: 16px;
  --feedback-radius-sm: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --feedback-text: #f9fafb;
    --feedback-text-light: #d1d5db;
    --feedback-bg: #1f2937;
    --feedback-bg-secondary: #374151;
    --feedback-border: #4b5563;
  }
}

/* Main Popup Container */
.ad-feedback-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif;
  width: 420px;
  max-width: calc(100vw - 48px);
  background: var(--feedback-bg);
  border-radius: var(--feedback-radius);
  box-shadow: var(--feedback-shadow);
  border: 1px solid var(--feedback-border);
  overflow: hidden;
  opacity: 0;
  transform: translateY(100px) scale(0.95);
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ad-feedback-popup.ad-feedback-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Close Button - Top Right */
.ad-feedback-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 32px;
  height: 32px;
  background: #fff; /* add Pure White after code pest for improment*/
  border: none;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.ad-feedback-close:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: rotate(90deg);
}

.ad-feedback-close-icon {
  width: 18px;
  height: 18px;
  stroke: var(--feedback-text-light);
  stroke-width: 2;
  transition: stroke 0.3s ease;
}

.ad-feedback-close:hover .ad-feedback-close-icon {
  stroke: var(--feedback-error);
}

/* Content Container */
.ad-feedback-content {
  padding: 0;
  position: relative;
}

/* Thumbnail Section - 16:9 YouTube Style */
.ad-feedback-thumbnail {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 aspect ratio */
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  overflow: hidden;
}

.ad-feedback-thumbnail-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: thumbnailZoom 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ad-feedback-thumbnail-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
  pointer-events: none;
}

/* Header Section */
.ad-feedback-header {
  padding: 20px 20px 16px;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s both;
}

.ad-feedback-headline {
  font-size: 18px;
  font-weight: 700;
  color: var(--feedback-text);
  margin: 0 0 6px 0;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.ad-feedback-subtitle {
  font-size: 14px;
  color: var(--feedback-text-light);
  margin: 0;
  line-height: 1.5;
}

/* Rating Buttons */
.ad-feedback-buttons {
  padding: 0 20px 20px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.3s both;
}

.ad-feedback-btn {
  padding: 16px 12px;
  background: var(--feedback-bg-secondary);
  border: 2px solid var(--feedback-border);
  border-radius: var(--feedback-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: var(--feedback-text);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.ad-feedback-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--feedback-primary);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ad-feedback-btn:hover::before {
  opacity: 0.08;
}

.ad-feedback-btn:hover {
  transform: translateY(-4px);
  border-color: var(--feedback-primary);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.2);
}

.ad-feedback-btn:active {
  transform: translateY(-2px);
}

.ad-feedback-btn[data-rating="1"]:hover {
  border-color: var(--feedback-error);
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2);
}

.ad-feedback-btn[data-rating="2"]:hover {
  border-color: var(--feedback-warning);
  box-shadow: 0 8px 20px rgba(245, 158, 11, 0.2);
}

.ad-feedback-btn[data-rating="3"]:hover {
  border-color: var(--feedback-success);
  box-shadow: 0 8px 20px rgba(16, 185, 129, 0.2);
}

.ad-feedback-btn-emoji {
  font-size: 24px;
  transition: transform 0.3s ease;
  position: relative;
  z-index: 1;
}

.ad-feedback-btn:hover .ad-feedback-btn-emoji {
  transform: scale(1.2);
}

.ad-feedback-btn span:last-child {
  position: relative;
  z-index: 1;
}

/* Footer */
.ad-feedback-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--feedback-border);
  background: var(--feedback-bg-secondary);
  display: flex;
  justify-content: center;
  animation: slideUp 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s both;
}

.ad-feedback-info {
  background: none;
  border: none;
  color: var(--feedback-text-light);
  font-size: 13px;
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ad-feedback-info:hover {
  color: var(--feedback-primary);
  background: rgba(99, 102, 241, 0.08);
}

.ad-feedback-info-icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Info Modal */
.ad-feedback-info-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 10001;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

.ad-feedback-info-modal.active {
  display: flex;
}

.ad-feedback-info-modal-content {
  background: var(--feedback-bg);
  border-radius: var(--feedback-radius);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: var(--feedback-shadow);
  border: 1px solid var(--feedback-border);
  animation: scaleIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ad-feedback-info-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ad-feedback-info-modal-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--feedback-text);
  margin: 0;
}

.ad-feedback-info-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-feedback-info-modal-close:hover {
  background: rgba(239, 68, 68, 0.1);
  transform: rotate(90deg);
}

.ad-feedback-info-modal-close-icon {
  width: 20px;
  height: 20px;
  stroke: var(--feedback-text-light);
  stroke-width: 2;
  transition: stroke 0.3s ease;
}

.ad-feedback-info-modal-close:hover .ad-feedback-info-modal-close-icon {
  stroke: var(--feedback-error);
}

.ad-feedback-info-modal-body p {
  font-size: 14px;
  color: var(--feedback-text);
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.ad-feedback-info-modal-body ul {
  font-size: 14px;
  color: var(--feedback-text-light);
  line-height: 1.6;
  padding-left: 20px;
  margin: 0;
}

.ad-feedback-info-modal-body li {
  margin-bottom: 8px;
}

/* Thank You State */
.ad-feedback-thankyou {
  padding: 40px 24px;
  text-align: center;
  animation: scaleIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.ad-feedback-thankyou-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, var(--feedback-success), #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  animation: successBounce 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.3);
}

.ad-feedback-thankyou-text {
  font-size: 20px;
  font-weight: 700;
  color: var(--feedback-text);
  margin: 0 0 8px 0;
  animation: slideUp 0.6s ease 0.2s both;
}

.ad-feedback-thankyou-subtext {
  font-size: 14px;
  color: var(--feedback-text-light);
  margin: 0 0 20px 0;
  animation: slideUp 0.6s ease 0.3s both;
}

.ad-feedback-undo {
  animation: slideUp 0.6s ease 0.4s both;
}

.ad-feedback-undo-btn {
  background: var(--feedback-bg-secondary);
  border: 2px solid var(--feedback-border);
  color: var(--feedback-text);
  padding: 10px 20px;
  border-radius: var(--feedback-radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ad-feedback-undo-btn:hover {
  border-color: var(--feedback-primary);
  color: var(--feedback-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

/* Error State */
.ad-feedback-error {
  padding: 40px 24px;
  text-align: center;
  animation: shake 0.5s ease;
}

.ad-feedback-error-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: errorPulse 0.6s ease;
}

.ad-feedback-error-text {
  font-size: 16px;
  color: var(--feedback-text);
  margin: 0 0 20px 0;
}

.ad-feedback-retry {
  background: var(--feedback-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--feedback-radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.ad-feedback-retry:hover {
  background: var(--feedback-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Loading Spinner */
.ad-feedback-loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid rgba(99, 102, 241, 0.2);
  border-top-color: var(--feedback-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

/* Confetti */
.ad-feedback-confetti {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--feedback-primary);
  border-radius: 2px;
  animation: confettiFall 1.2s ease-out forwards;
  pointer-events: none;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  0% {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes slideUp {
  0% {
    opacity: 0;
    transform: translateY(20px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes thumbnailZoom {
  0% {
    transform: scale(1.1);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes successBounce {
  0% {
    transform: scale(0) rotate(-180deg);
  }
  70% {
    transform: scale(1.1) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
  20%, 40%, 60%, 80% { transform: translateX(4px); }
}

@keyframes errorPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

@keyframes confettiFall {
  0% {
    opacity: 1;
    transform: translateY(-50px) rotate(0deg);
  }
  100% {
    opacity: 0;
    transform: translateY(400px) rotate(720deg);
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .ad-feedback-popup {
    bottom: 16px;
    right: 16px;
    left: 16px;
    width: auto;
    max-width: none;
  }
  
  .ad-feedback-buttons {
    gap: 8px;
  }
  
  .ad-feedback-btn {
    padding: 14px 10px;
    font-size: 12px;
  }
  
  .ad-feedback-btn-emoji {
    font-size: 20px;
  }
}

/* Accessibility */
.ad-feedback-btn:focus,
.ad-feedback-close:focus,
.ad-feedback-info:focus {
  outline: 2px solid var(--feedback-primary);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}