/* Custom styles for VPS Comparison site */

/* Smooth theme transition */
html {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
  background: #1e293b;
}

::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 4px;
}

.dark ::-webkit-scrollbar-thumb {
  background: #475569;
}

::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

.dark ::-webkit-scrollbar-thumb:hover {
  background: #64748b;
}

/* Table responsive wrapper */
.table-wrapper {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-wrapper table {
  min-width: 1600px;
}

/* Provider card hover effect */
.provider-card {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.provider-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

.dark .provider-card:hover {
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
}

/* Comparison checkbox styling */
.compare-checkbox {
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid #d1d5db;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.compare-checkbox:checked {
  background-color: #14b8a6;
  border-color: #14b8a6;
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='m12.207 4.793a1 1 0 0 1 0 1.414l-5 5a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L6.5 9.086l4.293-4.293a1 1 0 0 1 1.414 0z'/%3e%3c/svg%3e");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.dark .compare-checkbox {
  border-color: #4b5563;
}

.dark .compare-checkbox:checked {
  background-color: #14b8a6;
  border-color: #14b8a6;
}

/* Price highlight */
.best-price {
  background-color: #dcfce7;
  color: #166534;
}

.dark .best-price {
  background-color: #14532d;
  color: #86efac;
}

/* Filter dropdown */
.filter-dropdown {
  position: relative;
}

.filter-dropdown-content {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
}

/* Mobile menu */
.mobile-menu {
  transform: translateX(-100%);
  transition: transform 0.3s ease;
}

.mobile-menu.open {
  transform: translateX(0);
}

/* Sticky header */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background-color: rgba(255, 255, 255, 0.9);
}

.dark .sticky-header {
  background-color: rgba(15, 23, 42, 0.9);
}

/* Category badge */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
}

/* Tier badges */
.tier-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.tier-starter {
  background: #d4edda;
  color: #155724;
}

.dark .tier-starter {
  background: #1e4620;
  color: #86efac;
}

.tier-midTier {
  background: #d1ecf1;
  color: #0c5460;
}

.dark .tier-midTier {
  background: #0c3d47;
  color: #67e8f9;
}

.tier-highTier {
  background: #e2d9f3;
  color: #5a2a82;
}

.dark .tier-highTier {
  background: #3d2255;
  color: #d8b4fe;
}

/* Hero gradient - Mint Green */
.hero-gradient {
  background: linear-gradient(135deg, #0f766e 0%, #14b8a6 50%, #2dd4bf 100%);
}

.dark .hero-gradient {
  background: linear-gradient(135deg, #115e59 0%, #0d9488 50%, #14b8a6 100%);
}

/* Logo placeholder */
.logo-placeholder {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.25rem;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: white;
}

/* Provider logo wrapper */
.provider-logo-wrapper {
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Provider logo in table */
.provider-logo-table {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* Provider logo on provider page (larger) */
.provider-logo-page {
  width: 128px;
  height: 128px;
  object-fit: contain;
  border-radius: 0.75rem;
  background: white;
  padding: 0.5rem;
}

.dark .provider-logo-page {
  background: #1e293b;
}

/* Provider logo in comparison (medium) */
.provider-logo-compare {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 0.5rem;
  background: white;
  padding: 0.5rem;
}

.dark .provider-logo-compare {
  background: #1e293b;
}

/* Comparison table */
.comparison-row:nth-child(odd) {
  background-color: #f9fafb;
}

.dark .comparison-row:nth-child(odd) {
  background-color: #1e293b;
}

/* Loading spinner */
.spinner {
  border: 3px solid #f3f3f3;
  border-top: 3px solid #14b8a6;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Range slider custom styling */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e5e7eb;
}

.dark input[type="range"] {
  background: #374151;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #14b8a6;
  cursor: pointer;
  transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  background: #0d9488;
}

/* Tooltip */
.tooltip {
  position: relative;
  cursor: help;
}

.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background-color: #1f2937;
  color: white;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
  margin-bottom: 4px;
}

.tooltip:hover::after {
  opacity: 1;
  visibility: visible;
}

/* Price tooltip - wider for longer text */
.price-tooltip {
  position: relative;
  cursor: help;
  border-bottom: 1px dotted currentColor;
}

.price-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0.5rem 0.75rem;
  background-color: #1f2937;
  color: white;
  font-size: 0.75rem;
  line-height: 1.4;
  border-radius: 0.375rem;
  white-space: normal;
  width: max-content;
  max-width: 220px;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
  pointer-events: none;
}

.price-tooltip::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s, visibility 0.2s;
  z-index: 50;
}

.price-tooltip:hover::after,
.price-tooltip:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Toast notification */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  background-color: #1f2937;
  color: white;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.3s, opacity 0.3s;
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  /* Touch-friendly buttons */
  button, a {
    min-height: 44px;
    min-width: 44px;
  }

  /* Better table scrolling on mobile */
  .table-wrapper {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  /* Ensure text is readable on mobile */
  body {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Stack buttons vertically on very small screens */
  @media (max-width: 480px) {
    .flex-col.sm\:flex-row {
      flex-direction: column !important;
    }
  }

  /* Improve comparison table on mobile */
  .comparison-row td,
  .comparison-row th {
    white-space: nowrap;
    min-width: 120px;
  }

  /* Better mobile menu transitions */
  .mobile-menu {
    -webkit-transform: translateX(-100%);
    -webkit-transition: -webkit-transform 0.3s ease;
  }

  /* Ensure share menu is accessible on mobile */
  .share-menu {
    position: fixed !important;
    bottom: auto !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    max-width: 90vw;
  }

  /* Tier badges on mobile */
  .tier-badge {
    font-size: 0.65rem;
    padding: 3px 6px;
  }

  /* Table minimum width for horizontal scrolling */
  .table-wrapper table {
    min-width: 1600px;
  }
}

/* Landscape orientation optimizations */
@media (max-width: 768px) and (orientation: landscape) {
  .hero-gradient {
    padding-top: 2rem;
    padding-bottom: 2rem;
  }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure crisp rendering on retina displays */
  .logo-placeholder,
  svg {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }

  .print-break {
    page-break-before: always;
  }
}
