/**
 * PD Meter PRO for LensAdvisor - CSS
 * Version: 3.2.0 - Enhanced Visual Guides & Directional Feedback
 */

/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  --pdm-primary: #6366f1;
  --pdm-primary-hover: #4f46e5;
  --pdm-primary-light: #e0e7ff;
  --pdm-secondary: #f1f5f9;
  --pdm-success: #10b981;
  --pdm-success-light: #d1fae5;
  --pdm-warning: #f59e0b;
  --pdm-warning-light: #fef3c7;
  --pdm-error: #ef4444;
  --pdm-error-light: #fee2e2;
  --pdm-text: #1e293b;
  --pdm-text-muted: #64748b;
  --pdm-text-light: #94a3b8;
  --pdm-border: #e2e8f0;
  --pdm-bg: #ffffff;
  --pdm-overlay: rgba(15, 23, 42, 0.85);
  --pdm-radius: 16px;
  --pdm-radius-sm: 8px;
  --pdm-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --pdm-transition: 0.2s ease;
}

/* ============================================
   TRIGGER BUTTON
   ============================================ */
.pdm-trigger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: linear-gradient(135deg, var(--pdm-primary) 0%, var(--pdm-primary-hover) 100%);
  color: white;
  border: none;
  border-radius: var(--pdm-radius-sm);
  cursor: pointer;
  transition: all var(--pdm-transition);
  margin-left: 12px;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.pdm-trigger-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.pdm-trigger-btn:active {
  transform: translateY(0);
}

.pdm-trigger-btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* Success Badge */
.pdm-success-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--pdm-success-light);
  border: 1px solid var(--pdm-success);
  border-radius: var(--pdm-radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #065f46;
  margin-left: 12px;
  animation: pdm-badge-in 0.3s ease;
}

.pdm-success-badge svg {
  width: 16px;
  height: 16px;
}

@keyframes pdm-badge-in {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}

/* ============================================
   MODAL BASE
   ============================================ */
#pd-meter-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 999999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

#pd-meter-modal.pdm-visible {
  opacity: 1;
  visibility: visible;
}

#pd-meter-modal * {
  box-sizing: border-box;
}

.pdm-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--pdm-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(4px);
}

.pdm-modal {
  background: var(--pdm-bg);
  border-radius: var(--pdm-radius);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  transform: translateY(20px) scale(0.98);
  transition: transform 0.3s ease;
  box-shadow: var(--pdm-shadow);
}

.pdm-visible .pdm-modal {
  transform: translateY(0) scale(1);
}

/* Close Button */
.pdm-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--pdm-secondary);
  font-size: 24px;
  line-height: 1;
  color: var(--pdm-text-muted);
  cursor: pointer;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--pdm-transition);
  z-index: 10;
}

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

/* Header */
.pdm-header {
  padding: 32px 24px 0;
  text-align: center;
}

.pdm-header h2 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--pdm-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pdm-header p {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--pdm-text-muted);
}

/* Body */
.pdm-body {
  padding: 24px;
}

/* States */
.pdm-state {
  display: none;
}

.pdm-state.active {
  display: block;
}

/* ============================================
   LOADING STATE
   ============================================ */
.pdm-loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 20px;
}

.pdm-loading.active {
  display: flex;
}

.pdm-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--pdm-border);
  border-top-color: var(--pdm-primary);
  border-radius: 50%;
  animation: pdm-spin 0.8s linear infinite;
}

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

.pdm-loading .pdm-status {
  font-size: 15px;
  color: var(--pdm-text-muted);
  margin: 0;
}

/* ============================================
   INSTRUCTIONS STATE - Hero
   ============================================ */
.pdm-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 24px 32px;
}

.pdm-eye-scan {
  position: relative;
  width: 120px;
  height: 60px;
  margin-bottom: 28px;
  color: var(--pdm-primary);
  animation: pdm-glow-pulse 3s ease-in-out infinite;
}

.pdm-eye-icon {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.5));
}

.pdm-eye-pupil {
  animation: pdm-pupil-glow 3s ease-in-out infinite;
}

@keyframes pdm-glow-pulse {
  0%, 100% { filter: drop-shadow(0 0 6px rgba(99, 102, 241, 0.3)); }
  50% { filter: drop-shadow(0 0 18px rgba(99, 102, 241, 0.6)) drop-shadow(0 0 40px rgba(99, 102, 241, 0.2)); }
}

@keyframes pdm-pupil-glow {
  0%, 100% { opacity: 0.9; }
  50% { opacity: 1; }
}

.pdm-scan-line {
  position: absolute;
  top: 0;
  left: 10%;
  width: 80%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--pdm-primary), transparent);
  box-shadow: 0 0 12px var(--pdm-primary), 0 0 24px rgba(99, 102, 241, 0.3);
  animation: pdm-scan 2.5s ease-in-out infinite;
  border-radius: 1px;
}

@keyframes pdm-scan {
  0%, 100% { top: 0; opacity: 0.4; }
  50% { top: 100%; opacity: 1; }
}

.pdm-hero-title {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  color: var(--pdm-text);
  letter-spacing: -0.5px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pdm-hero-subtitle {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--pdm-text-muted);
  font-weight: 500;
  letter-spacing: 0.3px;
}

.pdm-privacy {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.2);
  border-radius: var(--pdm-radius-sm);
  margin-bottom: 24px;
  font-size: 12px;
  color: #065f46;
}

.pdm-privacy svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  color: var(--pdm-success);
}

/* ============================================
   CAMERA STATE
   ============================================ */
.pdm-camera.active {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.pdm-video-container {
  position: relative;
  width: 100%;
  aspect-ratio: 4/3;
  background: #0f172a;
  border-radius: var(--pdm-radius-sm);
  overflow: hidden;
}

.pdm-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.pdm-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
}

.pdm-overlay-guides {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform: scaleX(-1);
}

/* Flash effect on capture */
.pdm-flash {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}

.pdm-flash.active {
  opacity: 0.8;
}

/* Card highlight */
.pdm-card-highlight {
  position: absolute;
  border: 3px solid var(--pdm-warning);
  border-radius: 6px;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.5);
  transition: border-color 0.2s ease;
}

/* Face oval */
.pdm-face-oval {
  position: absolute;
  border: 2px dashed var(--pdm-warning);
  border-radius: 50%;
  transition: border-color 0.2s ease;
}

/* Iris points */
.pdm-iris-point {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--pdm-success);
  border: 2px solid white;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

.pdm-iris-line {
  position: absolute;
  height: 2px;
  background: var(--pdm-success);
  transform: translateY(-50%);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
}

/* Placeholder guides */
.pdm-guide-card-placeholder {
  position: absolute;
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
  width: 45%;
  aspect-ratio: 1.586;
  border: 3px dashed rgba(255, 255, 255, 0.5);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
}

.pdm-guide-card-placeholder span {
  color: white;
  font-size: 12px;
  font-weight: 500;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
  text-align: center;
  padding: 8px;
}

.pdm-guide-face-placeholder {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  width: 50%;
  height: 55%;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 50% 50% 45% 45%;
}

/* Validation Panel */
.pdm-validation-panel {
  background: var(--pdm-secondary);
  border-radius: var(--pdm-radius-sm);
  padding: 16px;
}

/* Checklist */
.pdm-checklist {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.pdm-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: white;
  border-radius: 6px;
  font-size: 12px;
  color: var(--pdm-text-muted);
  transition: all var(--pdm-transition);
}

.pdm-check-icon {
  width: 18px;
  height: 18px;
  border: 2px solid var(--pdm-border);
  border-radius: 50%;
  flex-shrink: 0;
  position: relative;
  transition: all var(--pdm-transition);
}

.pdm-check-icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 8px;
  height: 8px;
  background: var(--pdm-success);
  border-radius: 50%;
  transition: transform var(--pdm-transition);
}

.pdm-check-passed {
  color: var(--pdm-success);
  font-weight: 500;
}

.pdm-check-passed .pdm-check-icon {
  border-color: var(--pdm-success);
  background: var(--pdm-success-light);
}

.pdm-check-passed .pdm-check-icon::after {
  transform: translate(-50%, -50%) scale(1);
}

.pdm-check-failed {
  color: var(--pdm-text-light);
}

.pdm-check-optional {
  color: var(--pdm-text-light);
  opacity: 0.6;
}

.pdm-check-optional .pdm-check-icon {
  border-style: dashed;
}

/* Status Area */
.pdm-status-area {
  text-align: center;
  margin-bottom: 12px;
}

.pdm-status {
  font-size: 16px;
  font-weight: 600;
  color: var(--pdm-text);
  margin: 0;
  min-height: 32px;
  padding: 8px 16px;
  border-radius: 8px;
  transition: all 0.3s ease;
  display: inline-block;
}

/* Status with warning (movement instructions) */
.pdm-status.pdm-status-warning {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  color: #92400e;
  font-size: 18px;
  animation: pdm-status-pulse 1s ease-in-out infinite;
  border: 2px solid #f59e0b;
}

/* Status with success */
.pdm-status.pdm-status-success {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  font-size: 18px;
  border: 2px solid #10b981;
}

/* Status with info */
.pdm-status.pdm-status-info {
  background: var(--pdm-secondary);
  color: var(--pdm-text-muted);
}

@keyframes pdm-status-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Progress Area */
.pdm-progress-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pdm-progress-bar {
  flex: 1;
  height: 8px;
  background: white;
  border-radius: 4px;
  overflow: hidden;
}

.pdm-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pdm-primary) 0%, var(--pdm-success) 100%);
  border-radius: 4px;
  width: 0%;
  transition: width 0.3s ease;
}

.pdm-progress-text {
  font-size: 13px;
  font-weight: 600;
  color: var(--pdm-text);
  min-width: 50px;
  text-align: right;
}

/* ============================================
   CLEAN CAMERA BAR (v5)
   ============================================ */
.pdm-camera-bar {
  padding: 12px 16px 16px;
}

.pdm-progress-bar-clean {
  width: 100%;
  height: 4px;
  background: var(--pdm-border);
  border-radius: 2px;
  overflow: hidden;
}

.pdm-progress-fill-clean {
  height: 100%;
  background: linear-gradient(90deg, var(--pdm-primary) 0%, #10b981 100%);
  border-radius: 2px;
  width: 0%;
  transition: width 0.4s ease;
}

/* ============================================
   RESULT STATE
   ============================================ */
.pdm-result {
  text-align: center;
}

.pdm-result-card {
  padding: 32px 24px;
  background: linear-gradient(135deg, var(--pdm-primary-light) 0%, #c7d2fe 100%);
  border-radius: var(--pdm-radius);
  margin-bottom: 24px;
}

.pdm-result-icon {
  width: 72px;
  height: 72px;
  background: var(--pdm-success);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 24px rgba(16, 185, 129, 0.4);
}

.pdm-result-icon svg {
  width: 36px;
  height: 36px;
}

.pdm-result-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
  margin-bottom: 8px;
}

.pdm-pd-number {
  font-size: 64px;
  font-weight: 800;
  color: var(--pdm-text);
  line-height: 1;
}

.pdm-pd-unit {
  font-size: 28px;
  font-weight: 500;
  color: var(--pdm-text-muted);
}

.pdm-result-label {
  font-size: 15px;
  color: var(--pdm-text-muted);
  margin: 0 0 20px;
}

.pdm-result-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
}

.pdm-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.pdm-stat-label {
  font-size: 12px;
  color: var(--pdm-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pdm-stat-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--pdm-success);
}

.pdm-result-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ============================================
   ERROR STATE
   ============================================ */
.pdm-error {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 250px;
  gap: 20px;
  text-align: center;
  padding: 20px;
}

.pdm-error.active {
  display: flex;
}

.pdm-error-icon {
  width: 64px;
  height: 64px;
  background: var(--pdm-error-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pdm-error-icon svg {
  width: 32px;
  height: 32px;
  color: var(--pdm-error);
}

.pdm-error-message {
  font-size: 15px;
  color: var(--pdm-text);
  margin: 0;
  max-width: 300px;
  line-height: 1.5;
}

/* ============================================
   BUTTONS
   ============================================ */
.pdm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--pdm-radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--pdm-transition);
  width: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.pdm-btn:active {
  transform: scale(0.98);
}

.pdm-btn-primary {
  background: linear-gradient(135deg, var(--pdm-primary) 0%, var(--pdm-primary-hover) 100%);
  color: white;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.pdm-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
  transform: translateY(-1px);
}

.pdm-btn-secondary {
  background: var(--pdm-secondary);
  color: var(--pdm-text);
}

.pdm-btn-secondary:hover {
  background: var(--pdm-border);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 520px) {
  .pdm-modal {
    max-height: 100vh;
    border-radius: 0;
    max-width: 100%;
  }

  .pdm-overlay {
    padding: 0;
  }

  .pdm-header h2 {
    font-size: 20px;
  }

  .pdm-pd-number {
    font-size: 52px;
  }

  .pdm-checklist {
    grid-template-columns: 1fr;
  }

  .pdm-trigger-btn {
    margin-left: 0;
    margin-top: 12px;
    width: 100%;
  }

  .pdm-diagram-head {
    width: 100px;
    height: 125px;
  }

  .pdm-diagram-card {
    width: 65px;
    height: 40px;
  }

  .pdm-diagram-eyes {
    gap: 24px;
    margin-top: 16px;
  }

  .pdm-diagram-eye {
    width: 14px;
    height: 14px;
  }
}

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes pdm-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes pdm-check-in {
  from { transform: scale(0); }
  to { transform: scale(1); }
}

/* Container flex adjustment for LensAdvisor */
.la-pd-container,
.la-pd-fields-container,
[class*="la-pd"] {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* ============================================
   ML MACHINE LEARNING ELEMENTS
   ============================================ */

/* ML Badge in Header */
.pdm-ml-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);
  color: white;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 12px;
  margin-left: 8px;
  vertical-align: middle;
  box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4);
  animation: pdm-ml-glow 2s ease-in-out infinite;
}

.pdm-ml-badge::before {
  content: '🧠';
  font-size: 12px;
}

@keyframes pdm-ml-glow {
  0%, 100% { box-shadow: 0 2px 8px rgba(139, 92, 246, 0.4); }
  50% { box-shadow: 0 4px 16px rgba(139, 92, 246, 0.6); }
}

/* ML Indicator on Trigger Button */
.pdm-ml-indicator {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.2);
  font-size: 9px;
  font-weight: 700;
  border-radius: 4px;
  margin-left: 4px;
}

/* Quality Indicator on Camera View */
.pdm-quality-indicator {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  border-radius: 8px;
  z-index: 10;
}

.pdm-quality-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.pdm-quality-bar {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
}

.pdm-quality-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.3s ease, background 0.3s ease;
  background: var(--pdm-error);
}

.pdm-quality-fill.low {
  background: var(--pdm-error);
  width: 25%;
}

.pdm-quality-fill.medium {
  background: var(--pdm-warning);
  width: 50%;
}

.pdm-quality-fill.high {
  background: #22c55e;
  width: 75%;
}

.pdm-quality-fill.excellent {
  background: var(--pdm-success);
  width: 100%;
}

.pdm-quality-value {
  font-size: 12px;
  font-weight: 700;
  color: white;
  min-width: 32px;
  text-align: right;
}

/* ============================================
   FEEDBACK SECTION IN RESULTS
   ============================================ */
.pdm-feedback {
  margin-top: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);
  border: 1px solid #e9d5ff;
  border-radius: var(--pdm-radius-sm);
}

.pdm-feedback-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #7c3aed;
  margin-bottom: 12px;
}

.pdm-feedback-title::before {
  content: '🤖';
  font-size: 16px;
}

.pdm-feedback-question {
  font-size: 13px;
  color: var(--pdm-text);
  margin-bottom: 14px;
}

.pdm-feedback-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pdm-feedback-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--pdm-transition);
  flex: 1;
  min-width: 100px;
  justify-content: center;
}

.pdm-feedback-btn:hover {
  transform: translateY(-2px);
}

.pdm-feedback-btn:active {
  transform: translateY(0);
}

.pdm-feedback-yes {
  background: var(--pdm-success-light);
  color: #065f46;
  border-color: var(--pdm-success);
}

.pdm-feedback-yes:hover {
  background: var(--pdm-success);
  color: white;
}

.pdm-feedback-ok {
  background: var(--pdm-warning-light);
  color: #92400e;
  border-color: var(--pdm-warning);
}

.pdm-feedback-ok:hover {
  background: var(--pdm-warning);
  color: white;
}

.pdm-feedback-no {
  background: var(--pdm-error-light);
  color: #991b1b;
  border-color: var(--pdm-error);
}

.pdm-feedback-no:hover {
  background: var(--pdm-error);
  color: white;
}

.pdm-feedback-thanks {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  background: var(--pdm-success-light);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: #065f46;
  animation: pdm-feedback-in 0.3s ease;
}

.pdm-feedback-thanks.active {
  display: flex;
}

.pdm-feedback-thanks::before {
  content: '✨';
  font-size: 18px;
}

@keyframes pdm-feedback-in {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.pdm-feedback-comment {
  margin-top: 12px;
  display: none;
}

.pdm-feedback-comment.active {
  display: block;
}

.pdm-feedback-input {
  width: 100%;
  padding: 10px 12px;
  font-size: 13px;
  border: 2px solid var(--pdm-border);
  border-radius: 8px;
  resize: none;
  font-family: inherit;
  transition: border-color var(--pdm-transition);
}

.pdm-feedback-input:focus {
  outline: none;
  border-color: var(--pdm-primary);
}

.pdm-feedback-input::placeholder {
  color: var(--pdm-text-light);
}

.pdm-feedback-submit {
  margin-top: 10px;
  padding: 10px 20px;
  background: var(--pdm-primary);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--pdm-transition);
}

.pdm-feedback-submit:hover {
  background: var(--pdm-primary-hover);
}

/* ============================================
   ML LEARNING INDICATOR (LIVE)
   ============================================ */
.pdm-learning-indicator {
  position: absolute;
  bottom: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: rgba(139, 92, 246, 0.9);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-size: 10px;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 10;
}

.pdm-learning-dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pdm-learning-pulse 1.5s ease-in-out infinite;
}

@keyframes pdm-learning-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ============================================
   ML STATS PANEL (OPTIONAL DEBUG)
   ============================================ */
.pdm-ml-stats {
  margin-top: 16px;
  padding: 12px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 8px;
  font-size: 11px;
  color: var(--pdm-text-muted);
}

.pdm-ml-stats-title {
  font-weight: 700;
  color: var(--pdm-primary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pdm-ml-stats-title::before {
  content: '📊';
}

.pdm-ml-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.pdm-ml-stat-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.pdm-ml-stat-item:last-child {
  border-bottom: none;
}

.pdm-ml-stat-label {
  color: var(--pdm-text-light);
}

.pdm-ml-stat-value {
  font-weight: 600;
  color: var(--pdm-text);
}

/* ============================================
   RESPONSIVE ML ELEMENTS
   ============================================ */
@media (max-width: 520px) {
  .pdm-ml-badge {
    font-size: 9px;
    padding: 3px 8px;
  }

  .pdm-quality-indicator {
    top: 8px;
    left: 8px;
    padding: 6px 10px;
  }

  .pdm-quality-bar {
    width: 50px;
  }

  .pdm-feedback-buttons {
    flex-direction: column;
  }

  .pdm-feedback-btn {
    width: 100%;
  }

  .pdm-learning-indicator {
    bottom: 8px;
    right: 8px;
    font-size: 9px;
  }

  .pdm-ml-stats-grid {
    grid-template-columns: 1fr;
  }
}
