/**
 * Fix-My-Door™ Diagnostic Feature Styles
 * Scoped with kh-fix-* prefix to avoid conflicts
 */

/* ===== CTA SECTION (Homepage Insert) ===== */
#kh-fix-root {
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  padding: 4rem 0;
  position: relative;
  overflow: hidden;
}

#kh-fix-root::before {
  content: "";
  position: absolute;
  top: -50%;
  right: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
  pointer-events: none;
}

.kh-fix-cta-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.kh-fix-cta-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 50px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  text-align: center;
}

.kh-fix-cta-title {
  font-size: 2.5rem;
  font-weight: 800;
  color: white;
  margin-bottom: 1rem;
  text-align: center;
  line-height: 1.2;
}

.kh-fix-cta-subtitle {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 3rem;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.kh-fix-cta-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  max-width: 900px;
  margin: 0 auto;
}

.kh-fix-cta-btn {
  background: white;
  color: #6366f1;
  padding: 1.25rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  text-align: center;
  font-family: 'Inter', sans-serif;
}

.kh-fix-cta-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
  background: #f0f0ff;
}

.kh-fix-cta-btn:focus {
  outline: 3px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.kh-fix-cta-btn:active {
  transform: translateY(-1px);
}

.kh-fix-cta-btn-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

/* ===== MODAL ===== */
.kh-fix-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.kh-fix-modal-open {
  display: flex;
}

.kh-fix-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  animation: kh-fix-fade-in 0.3s ease;
}

.kh-fix-modal-container {
  position: relative;
  background: white;
  border-radius: 20px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
  animation: kh-fix-slide-up 0.4s ease;
  z-index: 1;
}

.kh-fix-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  background: rgba(0, 0, 0, 0.05);
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #64748b;
  z-index: 10;
}

.kh-fix-modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
  color: #0f172a;
}

.kh-fix-modal-close:focus {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}

.kh-fix-modal-content {
  padding: 3rem 2.5rem;
}

/* ===== PROGRESS ===== */
.kh-fix-progress {
  margin-bottom: 2rem;
}

.kh-fix-progress-bar {
  height: 6px;
  background: #e2e8f0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.75rem;
}

.kh-fix-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  transition: width 0.4s ease;
  border-radius: 3px;
}

.kh-fix-progress-text {
  text-align: center;
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
}

/* ===== STEP CONTENT ===== */
.kh-fix-step-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.75rem;
  text-align: center;
}

.kh-fix-step-subtitle {
  font-size: 1rem;
  color: #64748b;
  text-align: center;
  margin-bottom: 2rem;
}

/* ===== CONFIRM STEP ===== */
.kh-fix-confirm {
  text-align: center;
  padding: 2rem 0;
}

.kh-fix-confirm-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #10b981, #059669);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
  color: white;
  animation: kh-fix-pulse 2s infinite;
}

.kh-fix-confirm-text {
  font-size: 1.15rem;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.kh-fix-confirm-text strong {
  color: #6366f1;
}

.kh-fix-confirm-subtext {
  font-size: 0.95rem;
  color: #64748b;
}

/* ===== OPTIONS ===== */
.kh-fix-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.kh-fix-option {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  text-align: left;
}

.kh-fix-option:hover {
  border-color: #6366f1;
  background: #f8f9ff;
  transform: translateX(4px);
}

.kh-fix-option:focus {
  outline: 3px solid #6366f1;
  outline-offset: 2px;
}

.kh-fix-option-selected {
  border-color: #6366f1;
  background: linear-gradient(135deg, #f0f0ff, #f8f9ff);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.kh-fix-option-radio {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #6366f1;
  font-size: 1.5rem;
  line-height: 1;
  transition: all 0.3s ease;
}

.kh-fix-option-selected .kh-fix-option-radio {
  border-color: #6366f1;
  background: #6366f1;
  color: white;
}

.kh-fix-option-label {
  font-weight: 500;
  color: #334155;
}

/* ===== PHOTO UPLOAD ===== */
.kh-fix-photo-upload {
  margin-bottom: 2rem;
}

.kh-fix-photo-label {
  display: block;
  border: 2px dashed #cbd5e1;
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.kh-fix-photo-label:hover {
  border-color: #6366f1;
  background: #f8f9ff;
}

.kh-fix-photo-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.kh-fix-photo-text {
  font-size: 1rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.5rem;
}

.kh-fix-photo-subtext {
  font-size: 0.85rem;
  color: #64748b;
}

.kh-fix-photo-preview {
  margin-top: 1.5rem;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  max-width: 300px;
  margin-left: auto;
  margin-right: auto;
}

.kh-fix-photo-preview img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
}

.kh-fix-photo-remove {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
}

.kh-fix-photo-remove:hover {
  background: #dc2626;
  transform: scale(1.1);
}

/* ===== NAVIGATION BUTTONS ===== */
.kh-fix-nav-buttons {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-top: 2rem;
}

.kh-fix-btn {
  padding: 0.875rem 1.75rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: 'Inter', sans-serif;
  justify-content: center;
}

.kh-fix-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.kh-fix-btn-primary {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  flex: 1;
}

.kh-fix-btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 16px rgba(99, 102, 241, 0.3);
}

.kh-fix-btn-primary:focus {
  outline: 3px solid rgba(99, 102, 241, 0.5);
  outline-offset: 2px;
}

.kh-fix-btn-secondary {
  background: white;
  color: #6366f1;
  border: 2px solid #e2e8f0;
}

.kh-fix-btn-secondary:hover:not(:disabled) {
  background: #f8f9ff;
  border-color: #6366f1;
}

.kh-fix-btn-outline {
  background: transparent;
  color: #64748b;
  border: 2px solid #e2e8f0;
}

.kh-fix-btn-outline:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.kh-fix-btn-sm {
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
}

/* ===== RESULTS ===== */
.kh-fix-results {
  animation: kh-fix-fade-in 0.5s ease;
}

.kh-fix-results-header {
  text-align: center;
  margin-bottom: 2rem;
}

.kh-fix-results-icon {
  width: 80px;
  height: 80px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.5rem;
  font-size: 2.5rem;
}

.kh-fix-results-title {
  font-size: 1.75rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.75rem;
}

.kh-fix-results-desc {
  font-size: 1rem;
  color: #64748b;
  max-width: 500px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ===== CONFIDENCE ===== */
.kh-fix-confidence {
  background: linear-gradient(135deg, #f8f9ff, #f0f0ff);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.kh-fix-confidence-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: #334155;
}

.kh-fix-confidence-value {
  font-size: 1.25rem;
  color: #6366f1;
  font-weight: 700;
}

.kh-fix-confidence-bar {
  height: 12px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.kh-fix-confidence-fill {
  height: 100%;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  border-radius: 6px;
  transition: width 0.6s ease;
}

/* ===== PRODUCTS ===== */
.kh-fix-products {
  margin-bottom: 2rem;
}

.kh-fix-products-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 1rem;
}

.kh-fix-product-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  transition: all 0.3s ease;
}

.kh-fix-product-card:hover {
  border-color: #6366f1;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.1);
}

.kh-fix-product-info {
  flex: 1;
}

.kh-fix-product-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.5rem;
}

.kh-fix-product-reason {
  font-size: 0.9rem;
  color: #10b981;
  margin-bottom: 0.25rem;
  font-weight: 500;
}

.kh-fix-product-life {
  font-size: 0.85rem;
  color: #64748b;
}

/* ===== COLLAPSIBLE ===== */
.kh-fix-collapsible {
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  margin-bottom: 1rem;
  overflow: hidden;
}

.kh-fix-collapsible-header {
  background: #f8fafc;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: #334155;
  transition: all 0.3s ease;
  list-style: none;
}

.kh-fix-collapsible-header::-webkit-details-marker {
  display: none;
}

.kh-fix-collapsible-header:hover {
  background: #f1f5f9;
}

.kh-fix-collapsible[open] .kh-fix-collapsible-header {
  border-bottom: 2px solid #e2e8f0;
}

.kh-fix-collapsible[open] .kh-fix-collapsible-header svg {
  transform: rotate(180deg);
}

.kh-fix-collapsible-header svg {
  transition: transform 0.3s ease;
}

.kh-fix-collapsible-content {
  padding: 1.5rem;
}

.kh-fix-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.kh-fix-list li {
  padding: 0.5rem 0;
  padding-left: 1.75rem;
  position: relative;
  color: #334155;
  line-height: 1.6;
}

.kh-fix-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: #10b981;
  font-weight: 700;
}

/* ===== RESULTS FOOTER ===== */
.kh-fix-results-footer {
  display: flex;
  gap: 1rem;
  margin-top: 2rem;
  justify-content: center;
}

/* ===== ANIMATIONS ===== */
@keyframes kh-fix-fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes kh-fix-slide-up {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes kh-fix-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .kh-fix-cta-title {
    font-size: 1.75rem;
  }
  
  .kh-fix-cta-subtitle {
    font-size: 1rem;
  }
  
  .kh-fix-cta-buttons {
    grid-template-columns: 1fr;
  }
  
  .kh-fix-cta-btn {
    padding: 1rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .kh-fix-modal-content {
    padding: 2rem 1.5rem;
  }
  
  .kh-fix-step-title {
    font-size: 1.5rem;
  }
  
  .kh-fix-product-card {
    flex-direction: column;
    align-items: stretch;
  }
  
  .kh-fix-btn {
    width: 100%;
  }
  
  .kh-fix-nav-buttons {
    flex-direction: column-reverse;
  }
  
  .kh-fix-results-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  #kh-fix-root {
    padding: 3rem 0;
  }
  
  .kh-fix-cta-title {
    font-size: 1.5rem;
  }
  
  .kh-fix-option {
    padding: 1rem;
  }
  
  .kh-fix-photo-label {
    padding: 2rem 1rem;
  }
}
