/**
 * =============================================================================
 * NERDS TECHNOLOGY - FEEDBACK POPUP STYLES v2.0.0
 * =============================================================================
 * 
 * Centered popup notification styles with animated icons.
 * 
 * =============================================================================
 */

/* =============================================================================
   CSS CUSTOM PROPERTIES
   ============================================================================= */

:root {
  /* Popup Dimensions */
  --feedback-popup-width: min(400px, calc(100vw - 48px));
  --feedback-popup-padding: 32px;
  --feedback-popup-border-radius: 16px;
  
  /* Icon Size */
  --feedback-icon-size: 80px;
  --feedback-icon-stroke-width: 3;
  
  /* Animation */
  --feedback-animation-duration: 300ms;
  --feedback-animation-easing: cubic-bezier(0.4, 0, 0.2, 1);
  
  /* Colors - Success */
  --feedback-success-color: hsl(145, 63%, 42%);
  --feedback-success-bg: hsl(145, 63%, 97%);
  --feedback-success-ring: hsla(145, 63%, 42%, 0.2);
  
  /* Colors - Error */
  --feedback-error-color: hsl(0, 72%, 51%);
  --feedback-error-bg: hsl(0, 72%, 97%);
  --feedback-error-ring: hsla(0, 72%, 51%, 0.2);
  
  /* Colors - Warning */
  --feedback-warning-color: hsl(40, 96%, 48%);
  --feedback-warning-bg: hsl(40, 96%, 97%);
  --feedback-warning-ring: hsla(40, 96%, 48%, 0.2);
  
  /* Colors - Info */
  --feedback-info-color: hsl(210, 79%, 46%);
  --feedback-info-bg: hsl(210, 79%, 97%);
  --feedback-info-ring: hsla(210, 79%, 46%, 0.2);
  
  /* Shadow */
  --feedback-popup-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* Dark mode */
[data-theme="dark"] {
  --feedback-success-bg: hsl(145, 30%, 12%);
  --feedback-error-bg: hsl(0, 30%, 12%);
  --feedback-warning-bg: hsl(40, 30%, 12%);
  --feedback-info-bg: hsl(210, 30%, 12%);
  
  --feedback-popup-shadow: 
    0 20px 25px -5px rgba(0, 0, 0, 0.4),
    0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .feedback-popup {
  background: #1e1e2e !important;
  color: #e2e8f0;
  box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.5),
    0 10px 10px -5px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .feedback-popup__title {
  color: #e2e8f0;
}

[data-theme="dark"] .feedback-popup__message {
  color: #94a3b8;
}

[data-theme="dark"] .feedback-popup__close {
  color: #94a3b8;
}

[data-theme="dark"] .feedback-popup__close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
}

/* =============================================================================
   WRAPPER & BACKDROP
   ============================================================================= */

.feedback-popup-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.feedback-popup-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity var(--feedback-animation-duration) var(--feedback-animation-easing);
}

.feedback-popup-wrapper.feedback-popup--visible .feedback-popup-backdrop {
  opacity: 1;
}

.feedback-popup-wrapper.feedback-popup--leaving .feedback-popup-backdrop {
  opacity: 0;
}

/* =============================================================================
   POPUP BOX
   ============================================================================= */

.feedback-popup {
  position: relative;
  width: var(--feedback-popup-width);
  padding: var(--feedback-popup-padding);
  background: var(--surface-primary, #ffffff);
  border-radius: var(--feedback-popup-border-radius);
  box-shadow: var(--feedback-popup-shadow);
  text-align: center;
  
  /* Animation */
  opacity: 0;
  transform: scale(0.8) translateY(20px);
  transition: 
    opacity var(--feedback-animation-duration) var(--feedback-animation-easing),
    transform var(--feedback-animation-duration) var(--feedback-animation-easing);
}

.feedback-popup-wrapper.feedback-popup--visible .feedback-popup {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.feedback-popup-wrapper.feedback-popup--leaving .feedback-popup {
  opacity: 0;
  transform: scale(0.9) translateY(-10px);
}

/* =============================================================================
   CLOSE BUTTON (X)
   ============================================================================= */

.feedback-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted, #6b7280);
  transition: background 150ms ease, color 150ms ease;
}

.feedback-popup__close:hover {
  background: var(--hover-bg, rgba(0, 0, 0, 0.05));
  color: var(--text-color, #1f2937);
}

.feedback-popup__close:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210, 79%, 46%));
  outline-offset: 2px;
}

/* =============================================================================
   ANIMATED ICON
   ============================================================================= */

.feedback-popup__icon {
  width: var(--feedback-icon-size);
  height: var(--feedback-icon-size);
  margin: 0 auto 20px;
  position: relative;
}

.feedback-popup__icon-svg {
  width: 100%;
  height: 100%;
}

/* Circle animation */
.feedback-popup__icon-circle {
  stroke-width: var(--feedback-icon-stroke-width);
  stroke-dasharray: 166;
  stroke-dashoffset: 166;
  stroke-linecap: round;
}

.feedback-popup--visible .feedback-popup__icon-circle {
  animation: feedback-circle 600ms cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Check mark animation */
.feedback-popup__icon-check {
  stroke-width: var(--feedback-icon-stroke-width);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 48;
  stroke-dashoffset: 48;
}

.feedback-popup--visible .feedback-popup__icon-check {
  animation: feedback-check 400ms 400ms cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* X mark animation */
.feedback-popup__icon-x {
  stroke-width: var(--feedback-icon-stroke-width);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 56;
  stroke-dashoffset: 56;
}

.feedback-popup--visible .feedback-popup__icon-x {
  animation: feedback-x 400ms 400ms cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Exclamation animation */
.feedback-popup__icon-exclaim {
  stroke-width: var(--feedback-icon-stroke-width);
  stroke-linecap: round;
  stroke-dasharray: 15;
  stroke-dashoffset: 15;
}

.feedback-popup--visible .feedback-popup__icon-exclaim {
  animation: feedback-exclaim 300ms 400ms cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Info line animation */
.feedback-popup__icon-info {
  stroke-width: var(--feedback-icon-stroke-width);
  stroke-linecap: round;
  stroke-dasharray: 15;
  stroke-dashoffset: 15;
}

.feedback-popup--visible .feedback-popup__icon-info {
  animation: feedback-exclaim 300ms 400ms cubic-bezier(0.65, 0, 0.45, 1) forwards;
}

/* Dot animation */
.feedback-popup__icon-dot {
  opacity: 0;
}

.feedback-popup--visible .feedback-popup__icon-dot {
  animation: feedback-dot 200ms 600ms ease forwards;
}

/* Type-specific colors */
.feedback-popup--success .feedback-popup__icon-circle,
.feedback-popup--success .feedback-popup__icon-check {
  stroke: var(--feedback-success-color);
}

.feedback-popup--error .feedback-popup__icon-circle,
.feedback-popup--error .feedback-popup__icon-x {
  stroke: var(--feedback-error-color);
}

.feedback-popup--warning .feedback-popup__icon-circle,
.feedback-popup--warning .feedback-popup__icon-exclaim {
  stroke: var(--feedback-warning-color);
}

.feedback-popup--warning .feedback-popup__icon-dot {
  fill: var(--feedback-warning-color);
}

.feedback-popup--info .feedback-popup__icon-circle,
.feedback-popup--info .feedback-popup__icon-info {
  stroke: var(--feedback-info-color);
}

.feedback-popup--info .feedback-popup__icon-dot {
  fill: var(--feedback-info-color);
}

/* =============================================================================
   TITLE & MESSAGE
   ============================================================================= */

.feedback-popup__title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--text-color, #1f2937);
}

.feedback-popup__message {
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-muted, #6b7280);
  margin: 0 0 24px;
}

/* =============================================================================
   OK BUTTON
   ============================================================================= */

.feedback-popup__ok {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 120px;
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: 
    background 150ms ease,
    transform 150ms ease,
    box-shadow 150ms ease;
}

.feedback-popup__ok:focus-visible {
  outline: 2px solid var(--focus-ring, hsl(210, 79%, 46%));
  outline-offset: 2px;
}

.feedback-popup__ok:active {
  transform: scale(0.98);
}

/* Type-specific button colors */
.feedback-popup--success .feedback-popup__ok {
  background: var(--feedback-success-color);
  color: white;
}

.feedback-popup--success .feedback-popup__ok:hover {
  background: hsl(145, 63%, 36%);
  box-shadow: 0 4px 12px var(--feedback-success-ring);
}

.feedback-popup--error .feedback-popup__ok {
  background: var(--feedback-error-color);
  color: white;
}

.feedback-popup--error .feedback-popup__ok:hover {
  background: hsl(0, 72%, 45%);
  box-shadow: 0 4px 12px var(--feedback-error-ring);
}

.feedback-popup--warning .feedback-popup__ok {
  background: var(--feedback-warning-color);
  color: hsl(40, 60%, 15%);
}

.feedback-popup--warning .feedback-popup__ok:hover {
  background: hsl(40, 96%, 42%);
  box-shadow: 0 4px 12px var(--feedback-warning-ring);
}

.feedback-popup--info .feedback-popup__ok {
  background: var(--feedback-info-color);
  color: white;
}

.feedback-popup--info .feedback-popup__ok:hover {
  background: hsl(210, 79%, 40%);
  box-shadow: 0 4px 12px var(--feedback-info-ring);
}

/* =============================================================================
   KEYFRAME ANIMATIONS
   ============================================================================= */

@keyframes feedback-circle {
  0% {
    stroke-dashoffset: 166;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes feedback-check {
  0% {
    stroke-dashoffset: 48;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes feedback-x {
  0% {
    stroke-dashoffset: 56;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes feedback-exclaim {
  0% {
    stroke-dashoffset: 15;
  }
  100% {
    stroke-dashoffset: 0;
  }
}

@keyframes feedback-dot {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* =============================================================================
   REDUCED MOTION
   ============================================================================= */

@media (prefers-reduced-motion: reduce) {
  .feedback-popup,
  .feedback-popup-backdrop {
    transition: none;
  }
  
  .feedback-popup--visible .feedback-popup__icon-circle,
  .feedback-popup--visible .feedback-popup__icon-check,
  .feedback-popup--visible .feedback-popup__icon-x,
  .feedback-popup--visible .feedback-popup__icon-exclaim,
  .feedback-popup--visible .feedback-popup__icon-info,
  .feedback-popup--visible .feedback-popup__icon-dot {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

/* =============================================================================
   SCREEN READER ONLY (Utility)
   ============================================================================= */

.feedback-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
