/* Product Compare Feature Styles */

/* Compare Button in Product Detail - Modern Chip Style */
.pd-compare-section {
    margin: 0.5rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
  }
  
  .pd-compare-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 0.85rem;
    border: 1px solid #cbd5e1;
    border-radius: 20px;
    background: #fff;
    color: #64748b;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
  }
  
  .pd-compare-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
    background: #f0f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(59, 130, 246, 0.15);
  }
  
  .pd-compare-btn.added {
    border-color: #16a34a;
    color: #16a34a;
    background: #f0fdf4;
  }
  
  .pd-compare-btn .compare-remove {
    display: none;
  }
  
  .pd-compare-btn.added .compare-text {
    display: none;
  }
  
  .pd-compare-btn.added .compare-remove {
    display: flex !important;
    align-items: center;
    gap: 0.25rem;
    font-weight: 600;
    font-size: 0.9rem;
    color: #dc2626 !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 1;
    position: relative;
  }
  
  .pd-compare-btn.added .compare-remove[hidden] {
    display: flex !important;
  }
  
  /* Force visibility for added state */
  .pd-compare-btn.added .compare-remove {
    display: flex !important;
  }
  
  [hidden].compare-remove {
    display: none !important;
  }
  
  .pd-compare-btn.added [hidden].compare-remove {
    display: flex !important;
  }
  
  /* Ensure the added state text is always visible */
  .pd-compare-btn.added {
    border-color: #dc2626 !important;
    color: #dc2626 !important;
    background: #fef2f2 !important;
  }
  
  .pd-compare-btn.added .compare-remove svg {
    color: #dc2626 !important;
  }
  
  .pd-compare-btn.added:hover {
    border-color: #15803d;
    color: #15803d;
    background: #dcfce7;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(22, 163, 74, 0.2);
  }
  
  .pd-compare-btn .compare-icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
  }
  
  .pd-compare-info {
    display: inline-flex;
    align-items: center;
  }
  
  .compare-note {
    color: #94a3b8;
    font-size: 0.7rem;
    font-weight: 500;
    transition: color 0.2s ease;
  }
  
  .pd-compare-btn.added + .pd-compare-info .compare-note {
    color: #16a34a;
    font-weight: 600;
  }
  
  /* Compare Badge in Navigation */
  .compare-indicator {
    position: relative;
  }
  
  .compare-indicator .badge {
    position: absolute;
    top: -8px;
    right: -8px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: #ef4444;
    color: white;
    border-radius: 9px;
    font-size: 11px;
   
  
  /* Floating Compare Badge (Sticky) */
  .compare-floating-badge {
    position: fixed;
    right: 16px;
    bottom: calc(20px + 60px); /* Above scroll-to-top button */
    width: auto;
    min-width: 56px;
    height: 56px;
    padding: 0 16px;
    border-radius: 28px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(59, 130, 246, 0.5);
    cursor: pointer;
    z-index: 1104;
    opacity: 0;
    transform: translateY(8px) scale(0.9);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    pointer-events: none;
  }
  
  .compare-floating-badge.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
  }
  
  .compare-floating-badge:hover {
    box-shadow: 0 12px 32px -10px rgba(59, 130, 246, 0.6);
    transform: translateY(-2px) scale(1.02);
  }
  
  .compare-floating-badge:active {
    transform: translateY(0) scale(0.98);
  }
  
  .compare-floating-badge .cfb-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
  }
  
  .compare-floating-badge .cfb-count {
    font-size: 0.9rem;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
    background: rgba(255, 255, 255, 0.25);
    padding: 2px 8px;
    border-radius: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
  }
  
  .compare-floating-badge .cfb-text {
    display: none;
  }
  
  @media (min-width: 641px) {
    .compare-floating-badge .cfb-text {
      display: block;
      white-space: nowrap;
    }
  }
  
  @media (max-width: 640px) {
    .compare-floating-badge {
      right: 14px;
      bottom: calc(var(--scroll-top-bottom, calc(68px + 18px + env(safe-area-inset-bottom))) + 60px);
      min-width: 48px;
      height: 48px;
      padding: 0 12px;
      border-radius: 24px;
    }
    
    .compare-floating-badge .cfb-icon {
      width: 18px;
      height: 18px;
    }
    
    .compare-floating-badge .cfb-count {
      font-size: 0.8rem;
      padding: 2px 6px;
      height: 20px;
    }
  } font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0);
    transition: transform 0.2s ease;
  }
  
  .compare-indicator .badge.active {
    transform: scale(1);
  }
  
  /* Compare Sidebar */
  .compare-sidebar {
    position: fixed;
    top: 0;
    right: -400px;
    width: 400px;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
  }
  
  .compare-sidebar.open {
    right: 0;
  }
  
  .compare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }
  
  .compare-overlay.active {
    opacity: 1;
    visibility: visible;
  }
  
  .compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
  }
  
  .compare-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
  }
  
  .compare-count {
    color: #64748b;
    font-weight: 400;
  }
  
  .compare-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .compare-close:hover {
    background: #e2e8f0;
    color: #374151;
  }
  
  .compare-content {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
  }
  
  .compare-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    text-align: center;
    padding: 2rem 1rem;
  }
  
  .compare-empty h5 {
    margin: 1rem 0 0.5rem;
    color: #374151;
  }
  
  .compare-empty p {
    color: #64748b;
    font-size: 0.875rem;
    line-height: 1.5;
  }
  
  .compare-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .compare-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    transition: all 0.2s ease;
  }
  
  .compare-item:hover {
    border-color: #cbd5e1;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  }
  
  .compare-item-image {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
  }
  
  .compare-item-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  
  .compare-item-info {
    flex: 1;
    min-width: 0;
  }
  
  .compare-item-name {
    font-weight: 500;
    font-size: 0.875rem;
    color: #1e293b;
    margin-bottom: 0.25rem;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  
  .compare-item-price {
    font-weight: 600;
    font-size: 0.8rem;
    color: #059669;
  }
  
  .compare-item-remove {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 4px;
    background: transparent;
    color: #dc2626;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .compare-item-remove:hover {
    background: #fef2f2;
    color: #991b1b;
  }
  
  .compare-actions {
    padding: 1rem;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 0.75rem;
  }
  
  .compare-actions .btn {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .btn-outline-danger {
    border: 1px solid #dc2626;
    background: transparent;
    color: #dc2626;
  }
  
  .btn-outline-danger:hover {
    background: #dc2626;
    color: white;
  }
  
  .btn-primary {
    border: 1px solid #3b82f6;
    background: #3b82f6;
    color: white;
  }
  
  .btn-primary:hover {
    background: #2563eb;
    border-color: #2563eb;
  }
  
  .btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }
  
  .btn-primary:disabled:hover {
    background: #3b82f6;
    border-color: #3b82f6;
  }
  
  /* AI Comparison Modal */
  .ai-compare-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
  }
  
  .ai-compare-modal.open {
    display: flex;
  }
  
  .ai-compare-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
  }
  
  .modal-container {
    position: relative;
    width: 90%;
    max-width: 1000px;
    max-height: 90vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  
  .modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
  }
  
  .modal-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: #1e293b;
    margin: 0;
  }
  
  .modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .modal-close:hover {
    background: #e2e8f0;
    color: #374151;
  }
  
  .modal-content {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
  }
  
  /* AI Loading State */
  .ai-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
  }
  
  .loading-animation {
    margin-bottom: 1rem;
  }
  
  .typing-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-bottom: 1rem;
  }
  
  .typing-indicator span {
    width: 8px;
    height: 8px;
    background: #3b82f6;
    border-radius: 50%;
    animation: typing 1.4s infinite ease-in-out;
  }
  
  .typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
  }
  
  .typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
  }
  
  @keyframes typing {
    0%, 80%, 100% {
      opacity: 0.3;
      transform: scale(0.8);
    }
    40% {
      opacity: 1;
      transform: scale(1);
    }
  }
  
  .ai-loading p {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.5rem;
  }
  
  .ai-loading small {
    color: #64748b;
  }
  
  /* AI Error State */
  .ai-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 2rem;
    text-align: center;
  }
  
  .ai-error h4 {
    margin: 1rem 0 0.5rem;
    color: #dc2626;
  }
  
  .ai-error p {
    color: #64748b;
    margin-bottom: 1.5rem;
  }
  
  /* AI Results */
  .ai-results > div {
    margin-bottom: 2rem;
  }
  
  .ai-summary-card,
  .ai-comparison-table,
  .ai-detailed-analysis,
  .ai-recommendations,
  .ai-tips {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
  }
  
  .ai-results h4 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
  }
  
  .summary-text {
    font-size: 1rem;
    line-height: 1.6;
    color: #374151;
    margin-bottom: 1rem;
  }
  
  .winner-badge {
    padding: 1rem;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-radius: 8px;
  }
  
  .winner-badge strong {
    display: block;
    margin-bottom: 0.25rem;
  }
  
  .winner-badge small {
    opacity: 0.9;
    font-size: 0.875rem;
  }
  
  /* Comparison Table */
  .comparison-grid {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .comparison-category {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    overflow: hidden;
  }
  
  .category-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
  }
  
  .category-products {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1px;
    background: #e2e8f0;
  }
  
  .product-score {
    background: white;
    padding: 1rem;
    text-align: center;
  }
  
  .score-value {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
  }
  
  .score-stars {
    color: #fbbf24;
  }
  
  .score-note {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.3;
  }
  
  /* Product name header in comparison table */
  .product-name-header {
    margin-bottom: 0.5rem;
  }
  
  .product-name-header strong {
    font-size: .8rem; /* h5 size (18px) */
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    display: block;
    word-break: break-word;
  }
  
  .product-price {
    font-size: 0.8rem;
    font-weight: 600;
    color: #059669;
  }
  
  /* Detailed Analysis */
  .products-analysis {
    display: grid;
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .product-analysis {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
  }
  
  .product-analysis h5 {
    color: #1e293b;
    margin-bottom: 0.75rem;
    font-weight: 600;
  }
  
  .analysis-section {
    margin-bottom: 0.75rem;
  }
  
  .analysis-section:last-child {
    margin-bottom: 0;
  }
  
  .analysis-section h6 {
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
  }
  
  .analysis-section h6.strengths {
    color: #059669;
  }
  
  .analysis-section h6.weaknesses {
    color: #dc2626;
  }
  
  .analysis-section h6.best-for {
    color: #7c3aed;
  }
  
  .analysis-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
  }
  
  .analysis-section li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
    line-height: 1.4;
  }
  
  .analysis-section li:before {
    content: "•";
    color: #64748b;
    font-weight: bold;
    margin-top: 0.1rem;
  }
  
  .best-for-text {
    font-size: 0.875rem;
    color: #374151;
    font-style: italic;
  }
  
  /* Recommendations */
  .recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
  }
  
  .recommendation-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
  }
  
  .recommendation-card h5 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: #1e293b;
  }
  
  .recommendation-card p {
    font-size: 0.875rem;
    color: #374151;
    line-height: 1.5;
  }
  
  /* Tips */
  .tips-list {
    list-style: none;
    padding: 0;
    margin: 1rem 0 0 0;
  }
  
  .tips-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #374151;
  }
  
  .tips-list li:before {
    content: "💡";
    font-size: 1rem;
    margin-top: 0.1rem;
  }
  
  /* Modal Footer */
  .modal-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
  }
  
  .btn-outline-secondary {
    border: 1px solid #64748b;
    background: transparent;
    color: #64748b;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  
  .btn-outline-secondary:hover {
    background: #64748b;
    color: white;
  }
  
  /* Responsive for chip button */
  @media (max-width: 880px) {
    .pd-compare-section {
      margin: 1rem 0;
      display: block;
    }
  
    .pd-compare-btn {
      width: 100%;
      font-size: 0.85rem;
      padding: 0.65rem 1rem;
      border-radius: 10px;
      justify-content: center;
      min-height: 44px;
    }
    
    .pd-compare-btn .compare-icon {
      width: 16px;
      height: 16px;
    }
  
    .pd-compare-info {
      margin-top: 0.5rem;
      display: block;
      text-align: center;
    }
  
    .compare-note {
      font-size: 0.7rem;
      display: block;
    }
  }
  
  /* Responsive Design */
  @media (max-width: 768px) {
    .compare-sidebar {
      width: 100%;
      right: -100%;
      /* Fix for mobile viewport height changes */
      height: 100vh;
      height: 100dvh; /* Dynamic viewport height for modern browsers */
    }
    
    .compare-actions {
      /* Ensure actions are always visible */
      position: sticky;
      bottom: 0;
      background: white;
      border-top: 2px solid #e2e8f0;
      box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
      z-index: 10;
    }
    
    .compare-actions .btn {
      /* Larger touch targets for mobile */
      min-height: 48px;
      font-size: 0.9rem;
      font-weight: 700;
    }
    
    .modal-container {
      width: 95%;
      max-height: 95vh;
      max-height: 95dvh; /* Dynamic viewport height */
    }
    
    .modal-header,
    .modal-content,
    .modal-footer {
      padding: 1rem;
    }
    
    .recommendations-grid {
      grid-template-columns: 1fr;
    }
    
    .category-products {
      grid-template-columns: 1fr;
    }
    
    .modal-footer {
      flex-direction: column;
      gap: 0.75rem;
    }
    
    .modal-footer .btn {
      width: 100%;
    }
    
    /* Ensure compare button is visible on mobile */
    .pd-compare-section {
      display: block !important;
      visibility: visible !important;
      opacity: 1 !important;
      margin: 1rem 0;
      padding: 0;
      position: relative !important;
      z-index: 1 !important;
      max-width: 100%;
      overflow: hidden;
    }
    
    .pd-compare-btn {
      display: flex !important;
      visibility: visible !important;
      opacity: 1 !important;
      width: 100%;
      padding: 0.75rem 1rem;
      font-size: 0.9rem;
      min-height: 48px; /* Minimum touch target for mobile */
      border: 2px solid #e2e8f0 !important;
      background: #fff !important;
      position: relative !important;
      z-index: 2 !important;
      box-sizing: border-box;
      white-space: normal !important; /* Allow text wrapping on mobile */
      flex-wrap: wrap;
      gap: 0.5rem;
    }
    
    .pd-compare-btn .compare-text {
      display: inline !important;
      visibility: visible !important;
      font-weight: 600;
      color: #475569 !important;
    }
    
    .pd-compare-btn .compare-remove {
      display: none !important; /* Hidden by default */
    }
    
    .pd-compare-btn.added .compare-remove {
      display: flex !important; /* Only show when added */
      flex-wrap: wrap;
      align-items: center;
      gap: 0.4rem;
      white-space: normal !important;
      word-break: break-word;
    }
    
    .pd-compare-btn .compare-icon {
      display: inline-block !important;
      width: 18px;
      height: 18px;
      flex-shrink: 0;
    }
    
    .pd-compare-info {
      margin-top: 0.5rem;
    }
    
    .compare-note {
      font-size: 0.85rem !important;
      display: block !important;
      visibility: visible !important;
      color: #64748b !important;
    }
  }
  
  /* iOS Safari specific fixes */
  @media (max-width: 480px) {
    #compareBtn { 
      width:46px;
      height:46px;
    }
    
    .pd-compare-section {
      -webkit-transform: translateZ(0);
      transform: translateZ(0);
    }
    
    .pd-compare-btn {
      -webkit-appearance: none !important;
      appearance: none !important;
      -webkit-tap-highlight-color: transparent;
      touch-action: manipulation;
    }
    
    /* Fix sidebar height for iOS address bar */
    .compare-sidebar {
      /* Use fixed positioning that accounts for iOS address bar */
      height: 100vh;
      height: -webkit-fill-available; /* iOS Safari compatibility */
      min-height: 100vh;
      min-height: -webkit-fill-available;
    }
    
    /* Ensure compare actions stay at bottom */
    .compare-actions {
      position: sticky;
      bottom: 0;
      background: white;
      border-top: 2px solid #e2e8f0;
      box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
      padding: 1.25rem 1rem;
      z-index: 20;
    }
    
    .compare-actions .btn {
      min-height: 52px; /* Larger for easier tapping */
      font-size: 1rem;
      font-weight: 700;
      border-radius: 8px;
    }
    
    /* Adjust content padding to account for sticky actions */
    .compare-content {
      padding-bottom: 6rem; /* Extra space for sticky actions */
    }
  }
  
  /* High-resolution mobile devices (iPhone 12 Pro, etc.) */
  @media (-webkit-min-device-pixel-ratio: 2) and (max-width: 430px) {
    .pd-compare-section {
      display: block !important;
    }
    
    .pd-compare-btn {
      display: flex !important;
      min-height: 44px;
      font-size: 16px; /* Prevent zoom on iOS */
    }
    
    /* Enhanced fixes for iPhone 12 Pro and similar devices */
    .compare-sidebar {
      /* Ensure full height coverage */
      height: 100vh;
      height: 100dvh; /* Dynamic viewport height */
      height: -webkit-fill-available; /* iOS fallback */
      max-height: 100vh;
      max-height: 100dvh;
      max-height: -webkit-fill-available;
      overflow: hidden; /* Prevent scroll issues */
    }
    
    .compare-content {
      /* Flexible content area */
      flex: 1;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      padding: 1rem 1rem 8rem 1rem; /* Extra bottom padding */
    }
    
    .compare-actions {
      /* Force actions to stay visible */
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      width: 100%;
      background: white;
      border-top: 2px solid #e2e8f0;
      box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.2);
      padding: 1rem;
      z-index: 9999;
      display: flex !important;
      gap: 0.75rem;
    }
    
    .compare-actions .btn {
      flex: 1;
      min-height: 30px; /* Extra large for high-DPI screens */
      font-size: .8rem;
      font-weight: 600;
      border-radius: 12px;
      display: flex !important;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
    }
    
    /* Ensure AI analyze button is always visible and prominent */
    #compareAnalyze {
      background: #3b82f6 !important;
      border-color: #3b82f6 !important;
      color: white !important;
      box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    }
    
    #compareAnalyze:not(:disabled) {
      background: #2563eb !important;
      border-color: #2563eb !important;
      transform: scale(1.02);
    }
    
    #compareAnalyze:disabled {
      opacity: 0.6 !important;
      background: #9ca3af !important;
      border-color: #9ca3af !important;
    }
  }
  
  /* AI Disclaimer Styles */
  .ai-disclaimer {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 1rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 8px;
    margin: 0;
  }
  
  .disclaimer-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
    margin-top: 0.125rem;
  }
  
  .disclaimer-text {
    font-size: 0.85rem;
    line-height: 1.4;
    color: #92400e;
  }
  
  .disclaimer-text strong {
    color: #78350f;
    font-weight: 600;
  }
  
  /* Compare Disclaimer in Sidebar */
  .compare-disclaimer {
    margin-top: 1rem;
    padding: 1rem;
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
  }
  
  .compare-disclaimer h6 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0c4a6e;
    margin-bottom: 0.5rem;
  }
  
  .compare-disclaimer p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #075985;
    margin-bottom: 0.5rem;
  }
  
  .compare-disclaimer p:last-child {
    margin-bottom: 0;
  }
  
  .compare-disclaimer ul {
    list-style: none;
    padding: 0;
    margin: 0.5rem 0 0 0;
  }
  
  .compare-disclaimer li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.75rem;
    line-height: 1.3;
    color: #075985;
  }
  
  .compare-disclaimer li:before {
    content: "•";
    color: #0ea5e9;
    font-weight: bold;
    margin-top: 0.1rem;
    flex-shrink: 0;
  }
  
  /* Mobile Browser Address Bar Fixes */
  @supports (height: 100dvh) {
    /* Modern browsers with dynamic viewport support */
    @media (max-width: 768px) {
      .compare-sidebar {
        height: 100dvh !important;
        max-height: 100dvh !important;
      }
      
      .modal-container {
        max-height: 95dvh !important;
      }
    }
  }
  
  @supports (height: -webkit-fill-available) {
    /* iOS Safari specific support */
    @media (max-width: 768px) {
      .compare-sidebar {
        height: -webkit-fill-available !important;
        max-height: -webkit-fill-available !important;
      }
    }
  }
  
  /* Fallback for older browsers */
  @media (max-width: 768px) and (orientation: portrait) {
    .compare-sidebar {
      /* Fixed height that works across different mobile browsers */
      min-height: 600px;
      height: calc(100vh - env(keyboard-inset-height, 0px));
      height: calc(100vh - env(safe-area-inset-bottom, 0px));
    }
    
    /* Ensure actions are always accessible */
    .compare-actions {
      position: sticky !important;
      bottom: env(safe-area-inset-bottom, 0px) !important;
      margin-bottom: 0 !important;
      padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0px)) !important;
    }
  }
  
  /* PWA and fullscreen app support */
  @media (display-mode: standalone) {
    .compare-sidebar {
      height: 100vh !important;
      height: 100dvh !important;
    }
  }
  
  /* Utilities */
  .btn-sm {
    padding: 0.5rem 0.75rem;
    font-size: 0.8rem;
  }
  
  [hidden] {
    display: none !important;
  }
  
  /* ===== UX ENHANCEMENTS ===== */
  
  /* Compare Button Highlight Animation */
  .pulse-highlight {
    animation: pulse-glow 2s ease-in-out 3;
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  
  @keyframes pulse-glow {
    0% {
      box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
    }
    50% {
      box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
  }
  
  /* Flying Product Animation */
  .flying-product {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
  }
  
  .flying-product img {
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  }
  
  /* Sticky Compare Bar - REMOVED (using only fly-to-navbar animation) */
  
  /* Inline Compare Preview - REMOVED (keeping it simple and clean) */