/* Google Fonts & Modern Review Styles */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800;900&display=swap');

:root { 
  --font-en: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-ar: 'Cairo', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --amazon-amber: #f59e0b;
  --amazon-amber-hover: #fbbf24;
  --amazon-dark: #78350f;
  --brand-indigo: #4f46e5;
  --bg-subtle: #fafaf9;
}

html {
  font-family: var(--font-en);
  scroll-behavior: smooth;
}

/* Font utility classes */
.font-cairo {
  font-family: var(--font-ar) !important;
}

.font-sans,
.font-jakarta {
  font-family: var(--font-en) !important;
}

/* RTL Typography & Layout Settings */
html[dir="rtl"],
html[lang="ar"],
body.font-cairo,
body.rtl-mode {
  font-family: var(--font-ar) !important;
  letter-spacing: normal !important;
  line-height: 1.6 !important;
}

html[dir="rtl"] h1,
html[dir="rtl"] h2,
html[dir="rtl"] h3,
html[dir="rtl"] h4,
html[dir="rtl"] h5,
html[dir="rtl"] h6,
html[dir="rtl"] p,
html[dir="rtl"] span,
html[dir="rtl"] a,
html[dir="rtl"] button,
html[dir="rtl"] th,
html[dir="rtl"] td,
html[dir="rtl"] input {
  font-family: var(--font-ar) !important;
  line-height: 1.6 !important;
}

body { 
  font-family: inherit; 
  background-color: #fafaf9; 
  color: #1c1917;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6; 
  transition: background-color 0.2s ease;
}

/* Card hover & Bento Grid animations */
.product-card {
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.product-card:hover {
  transform: translateY(-5px);
}

/* Bento Cards Styling */
.bento-card {
  position: relative;
  overflow: hidden;
  border-radius: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-card:hover {
  transform: translateY(-4px);
}

.bento-card .bento-image-container img {
  transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.bento-card:hover .bento-image-container img {
  transform: scale(1.05);
}

/* Glassmorphism utility */
.glass-overlay {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.glass-dark-overlay {
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

/* Language Switcher Pill */
.lang-switcher-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  background-color: #f5f5f4;
  border: 1px solid #e7e5e4;
  color: #292524;
  font-weight: 700;
  font-size: 0.75rem;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  white-space: nowrap;
}

.lang-switcher-btn:hover {
  background-color: #e7e5e4;
  color: #0c0a09;
  border-color: #d6d3d1;
  transform: scale(1.03);
}

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

/* Comparison Matrix & Table Scroll Container */
.table-scroll-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  width: 100%;
}

.table-scroll-container::-webkit-scrollbar {
  height: 6px;
}
.table-scroll-container::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 9999px;
}
.table-scroll-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
.table-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

.comparison-table {
  min-width: 760px;
  width: 100%;
  border-collapse: collapse;
}

.comparison-table th,
.comparison-table td {
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  vertical-align: middle;
  line-height: 1.6 !important;
}

/* Amazon Action Yellow Button Inside Table */
.table-amazon-btn {
  white-space: nowrap !important;
  padding: 0.45rem 0.85rem !important;
  font-size: 0.75rem !important;
  font-weight: 800 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
  flex-shrink: 0 !important;
  border-radius: 0.5rem !important;
  background-color: #fbbf24 !important;
  color: #451a03 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
  transition: all 0.2s ease !important;
  text-decoration: none !important;
}
.table-amazon-btn:hover {
  background-color: #f59e0b !important;
  transform: scale(1.03) !important;
}

/* Hamburger Icon Animated Bars */
.hamburger-btn {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0.45rem;
  border-radius: 0.5rem;
  cursor: pointer;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  transition: all 0.2s ease;
}
.hamburger-btn:hover {
  background: #e7e5e4;
}
.hamburger-line {
  width: 1.15rem;
  height: 2px;
  background-color: #1c1917;
  border-radius: 2px;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
}
.hamburger-line:nth-child(1) {
  margin-bottom: 4px;
}
.hamburger-line:nth-child(3) {
  margin-top: 4px;
}
.hamburger-btn.is-active .hamburger-line:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.hamburger-btn.is-active .hamburger-line:nth-child(2) {
  opacity: 0;
}
.hamburger-btn.is-active .hamburger-line:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Mobile Drawer Menu */
#mobile-menu-drawer {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.25s ease;
}
#mobile-menu-drawer.menu-closed {
  transform: translateY(-8px);
  opacity: 0;
  pointer-events: none;
  display: none;
}
#mobile-menu-drawer.menu-open {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
  display: block;
}

/* RTL Arrow & Search Icon Adjustments */
html[dir="rtl"] .arrow-icon {
  transform: scaleX(-1);
}

html[dir="rtl"] #live-search-icon {
  left: auto !important;
  right: 0.75rem !important;
}

html[dir="rtl"] #live-search-input {
  padding-left: 1rem !important;
  padding-right: 2rem !important;
}

html[dir="rtl"] .comparison-table th,
html[dir="rtl"] .comparison-table td {
  text-align: right;
}

html[dir="rtl"] .comparison-table .cell-center {
  text-align: center !important;
}

html[dir="rtl"] .comparison-table .cell-action {
  text-align: left !important;
}

/* Star rating utility */
.star-rating {
  color: #f59e0b;
}

/* Smooth transitions */
.transition-all-smooth {
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Pulse badge glow */
@keyframes subtle-glow {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.04); }
}

.glow-pill {
  animation: subtle-glow 3s infinite ease-in-out;
}

/* Bilingual Language Block Switching (Zero-FOUT) */
html[lang="ar"] [data-lang-block="en"],
html[dir="rtl"] [data-lang-block="en"] {
  display: none !important;
}

html[lang="en"] [data-lang-block="ar"],
html[dir="ltr"] [data-lang-block="ar"] {
  display: none !important;
}

/* Additional RTL specific styling */
html[dir="rtl"] .border-l-4 {
  border-left-width: 0 !important;
  border-right-width: 4px !important;
}

html[dir="rtl"] .rounded-r-2xl {
  border-top-right-radius: 0 !important;
  border-bottom-right-radius: 0 !important;
  border-top-left-radius: 1rem !important;
  border-bottom-left-radius: 1rem !important;
}