/*
Theme Name: iHome Store Optimized
Theme URI: https://ihome-store.com/
Author: iHome Store
Author URI: https://ihome-store.com/
Description: An optimized Arabic WooCommerce theme for iHome Store, with improved purchasing, accessibility, performance, and SEO.
Version: 2.0.2
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: ihome-store-optimized
*/

/* Global Variables from React App */
:root {
  --primary: #263cda;
  --secondary: #e11d48;
  --accent: #0d9488;
  --bg-main: #fcfdfe;
}

body {
  font-family: 'Cairo', sans-serif;
  background-color: var(--bg-main);
  color: #334155;
  overflow-x: hidden;
  font-size: 0.95rem;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.screen-reader-text:focus {
  position: fixed !important;
  top: 1rem;
  right: 1rem;
  z-index: 100000;
  width: auto;
  height: auto;
  padding: 0.75rem 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  border-radius: 0.75rem;
  background: #fff;
  color: #111827;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
}

:where(a, button, input, select, textarea):focus-visible {
  outline: 3px solid rgba(38, 60, 218, 0.45);
  outline-offset: 3px;
}

.glass {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.8);
}

.rtl-flip {
  transform: scaleX(-1);
}

/* Footer social links */

.ihome-social-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ihome-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 9999px;
  background: #1e293b;
  color: #cbd5e1;
  box-shadow: 0 10px 20px rgba(2, 6, 23, 0.18);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.ihome-social-link svg {
  width: 1.25rem;
  height: 1.25rem;
}

.ihome-social-link:hover,
.ihome-social-link:focus-visible {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 14px 28px rgba(2, 6, 23, 0.28);
}

.ihome-social-link-facebook:hover,
.ihome-social-link-facebook:focus-visible {
  background: #1877f2;
}

.ihome-social-link-instagram:hover,
.ihome-social-link-instagram:focus-visible {
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 42%, #d6249f 60%, #285aeb 90%);
}

/* ---------------------------------------------------------
   Header layout
--------------------------------------------------------- */

.ihome-header-inner {
  gap: 1rem;
}

.ihome-desktop-nav {
  display: none;
  min-width: 0;
  flex: 1 1 auto;
  justify-content: center;
  padding-inline: 1rem;
}

.ihome-primary-menu {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem clamp(0.8rem, 1.6vw, 2rem);
  line-height: 1.6;
}

.ihome-primary-menu > li > a {
  display: block;
  padding-block: 0.75rem;
  white-space: nowrap;
}

.ihome-brand-tagline,
.ihome-header-whatsapp,
.ihome-header-separator,
.ihome-header-account {
  display: none;
}

.ihome-mobile-menu-toggle {
  display: inline-flex;
}

@media (min-width: 640px) {
  .ihome-brand-tagline {
    display: inline;
  }

  .ihome-header-whatsapp {
    display: flex;
  }

  .ihome-header-separator {
    display: block;
  }
}

@media (min-width: 1024px) {
  .ihome-desktop-nav {
    display: flex;
  }

  .ihome-mobile-menu-toggle {
    display: none;
  }

  .ihome-header-account {
    display: block;
  }

  .ihome-mobile-menu {
    display: none !important;
  }
}

/* ---------------------------------------------------------
   Homepage commerce layout
--------------------------------------------------------- */

.ihome-commerce-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 2.5rem;
  direction: ltr;
}

.ihome-home-sidebar {
  display: none;
  direction: rtl;
}

.ihome-home-products {
  min-width: 0;
  direction: rtl;
}

.ihome-section-header {
  gap: 1rem;
}

.ihome-section-header > div {
  min-width: 0;
}

.ihome-section-view-all {
  flex: 0 0 auto;
  white-space: nowrap;
}

@media (min-width: 1200px) {
  .ihome-commerce-grid {
    grid-template-columns: minmax(0, 9fr) minmax(17rem, 3fr);
    grid-template-areas: "products sidebar";
    align-items: start;
  }

  .ihome-home-sidebar {
    display: block;
    grid-area: sidebar;
  }

  .ihome-home-products {
    grid-area: products;
  }
}

/* Product cards */

.ihome-product-card-link {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-width: 0;
}

.ihome-product-title {
  display: -webkit-box;
  min-height: 2.75rem;
  overflow: hidden;
  line-height: 1.45;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.ihome-product-price {
  min-width: 0;
  overflow-wrap: anywhere;
}

.ihome-product-price .price {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.35rem;
}

@media (max-width: 639px) {
  .ihome-product-title {
    min-height: 2.5rem;
    font-size: 0.78rem;
  }

  .ihome-product-price {
    font-size: 0.8rem;
  }
}

/* Animations */
@keyframes marquee {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(100%);
  }
}

.animate-marquee {
  display: flex;
  width: fit-content;
  animation: marquee 60s linear infinite;
}

.animate-marquee:hover {
  animation-play-state: paused;
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }

  50% {
    background-position: 100% 50%;
  }

  100% {
    background-position: 0% 50%;
  }
}

.bg-animated {
  background: linear-gradient(-45deg, #263cda, #f43f5e, #0ea5e9, #8b5cf6);
  background-size: 400% 400%;
  animation: gradient-shift 15s ease infinite;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0px);
  }

  50% {
    transform: translateY(-10px);
  }
}

.animate-float {
  animation: float 5s ease-in-out infinite;
}

.reveal {
  opacity: 0;
  transform: translateY(15px);
  animation: fadeInUp 0.5s ease-out forwards;
}

@keyframes fadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}

.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.card-glow:hover {
  box-shadow: 0 15px 30px -5px rgba(38, 60, 218, 0.15);
  border-color: rgba(38, 60, 218, 0.3);
}

/* Global brand overrides */
.text-indigo-600 {
  color: #263cda !important;
}

.bg-indigo-600 {
  background-color: #263cda !important;
}

.border-indigo-600 {
  border-color: #263cda !important;
}

.hover\:bg-indigo-700:hover {
  background-color: #1e31b3 !important;
}

.from-indigo-600 {
  --tw-gradient-from: #263cda !important;
}

/* WordPress Alignment Classes */
.aligncenter {
  display: block;
  margin: 0 auto;
}

.alignleft {
  float: left;
  margin-right: 1.5em;
}

.alignright {
  float: right;
  margin-left: 1.5em;
}

/* ---------------------------------------------------------
   WooCommerce Component Overrides
--------------------------------------------------------- */

/* Buttons (Add to Cart, Checkout, Etc) */
.woocommerce button.button,
.woocommerce .button,
.woocommerce a.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce button.button.alt,
.woocommerce a.button.alt,
.woocommerce input.button.alt {
  background-color: var(--primary) !important;
  color: white !important;
  border-radius: 0.75rem !important;
  /* rounded-xl */
  padding: 0.875rem 2rem !important;
  font-weight: 900 !important;
  font-size: 0.875rem !important;
  transition: all 0.3s ease !important;
  border: none !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-shadow: 0 10px 15px -3px rgba(38, 60, 218, 0.2) !important;
}

.woocommerce button.button:hover,
.woocommerce .button:hover,
.woocommerce a.button:hover,
.woocommerce input.button:hover,
.woocommerce button.button.alt:hover,
.woocommerce a.button.alt:hover,
.woocommerce input.button.alt:hover {
  background-color: #1e31b3 !important;
  /* darker indigo */
  transform: translateY(-2px) !important;
}

.woocommerce button.button.disabled,
.woocommerce button.button:disabled {
  background-color: #cbd5e1 !important;
  cursor: not-allowed !important;
  transform: none !important;
}

/* Quantity Input */
.woocommerce .quantity .qty {
  border-radius: 0.75rem !important;
  border: 1px solid #e2e8f0 !important;
  padding: 0.5rem !important;
  text-align: center !important;
  font-weight: bold !important;
  width: 4rem !important;
  height: 3rem !important;
  margin: 0 0.5rem !important;
}

/* Forms & Inputs */
.woocommerce-form-row input.input-text,
.woocommerce-form-row textarea {
  padding: 0.875rem 1.25rem !important;
  background-color: #f8fafc !important;
  /* bg-slate-50 */
  border: 1px solid #f1f5f9 !important;
  /* border-slate-100 */
  border-radius: 0.75rem !important;
  /* rounded-xl */
  width: 100% !important;
  box-sizing: border-box !important;
  font-size: 0.875rem !important;
  outline: none !important;
  transition: all 0.2s !important;
}

.woocommerce-form-row input.input-text:focus,
.woocommerce-form-row textarea:focus {
  background-color: #ffffff !important;
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px rgba(38, 60, 218, 0.1) !important;
}

/* Notices / Alerts */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border-top: none !important;
  border-radius: 1rem !important;
  padding: 1rem 1.5rem !important;
  margin-bottom: 2rem !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05) !important;
  font-weight: bold !important;
  font-size: 0.875rem !important;
}

.woocommerce-message {
  background-color: #ecfdf5 !important;
  color: #047857 !important;
  border-right: 4px solid #10b981 !important;
}

.woocommerce-info {
  background-color: #eff6ff !important;
  color: #1d4ed8 !important;
  border-right: 4px solid #3b82f6 !important;
}

.woocommerce-error {
  background-color: #fff1f2 !important;
  color: #be123c !important;
  border-right: 4px solid #f43f5e !important;
}

/* Single Product Specifics */
.single-product div.product form.cart {
  display: flex !important;
  align-items: center !important;
  gap: 1rem !important;
  margin-bottom: 2rem !important;
  flex-wrap: wrap !important;
}

.single-product div.product form.cart .button {
  flex-grow: 1 !important;
  height: 3rem !important;
}

/* Tabs */
.woocommerce-tabs ul.tabs {
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 0 !important;
  margin: 0 0 2rem 0 !important;
  list-style: none !important;
  display: flex !important;
  gap: 2rem !important;
  overflow-x: auto !important;
}

.woocommerce-tabs ul.tabs li {
  border: none !important;
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
}

.woocommerce-tabs ul.tabs li a {
  padding: 0 0 0.75rem 0 !important;
  color: #94a3b8 !important;
  font-weight: 900 !important;
  font-size: 0.75rem !important;
  /* text-xs */
  text-transform: uppercase !important;
  letter-spacing: 0.1em !important;
  display: block !important;
  position: relative !important;
}

.woocommerce-tabs ul.tabs li.active a {
  color: var(--primary) !important;
}

.woocommerce-tabs ul.tabs li.active a::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
  border-radius: 9999px;
}

/* Custom Cart/Checkout Layout Fixes */
.woocommerce-cart-form__contents {
  width: 100%;
}

/* Remove default WC borders if conflicting */
.woocommerce table.shop_table {
  border: none !important;
  border-collapse: separate !important;
  border-spacing: 0 1rem !important;
}


/* ---------------------------------------------------------
   Navigation Sub-Menus (Dropdowns)
--------------------------------------------------------- */
.menu-item {
  position: relative;
}

.sub-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  width: 260px;
  background: white;
  border-radius: 1rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  padding: 1rem;
  z-index: 50;
  list-style: none;
  margin: 0.5rem 0 0 0;
  border: 1px solid #f1f5f9;
}

.sub-menu li {
  margin-bottom: 0.5rem;
}

.sub-menu li:last-child {
  margin-bottom: 0;
}

.sub-menu a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  color: #334155;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.sub-menu a:hover {
  background-color: #f8fafc;
  color: var(--primary);
  transform: translateX(-5px);
  /* Move left on hover for RTL feel */
}

/* Visibility State (toggled by JS) */
.sub-menu.is-active {
  display: block;
  animation: fadeInUp 0.2s ease-out forwards;
}

@media (min-width: 768px) {
  .menu-item-has-children:hover > .sub-menu,
  .menu-item-has-children:focus-within > .sub-menu {
    display: block;
  }
}

.mobile-primary-menu .sub-menu {
  position: static;
  width: 100%;
  margin: 0.25rem 0;
  padding: 0.5rem;
  border-radius: 0.75rem;
  box-shadow: none;
  background: #f8fafc;
}

.mobile-primary-menu > li > a,
.mobile-primary-menu .sub-menu a {
  display: block;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
}

.mobile-primary-menu a:hover {
  background: #f1f5f9;
  color: var(--primary);
}

/* Indicator for parents */
.menu-item-has-children>a::after {
  content: '▾';
  display: inline-block;
  margin-right: 0.5rem;
  transition: transform 0.2s;
}

.menu-item-has-children.menu-active>a::after {
  transform: rotate(180deg);
}

/* For nested sub-menus if any (optional) */
.sub-menu .sub-menu {
  top: 0;
  right: 100%;
  margin-top: 0;
}

/* WooCommerce Cart and Checkout blocks */
.wp-block-woocommerce-cart,
.wp-block-woocommerce-checkout {
  max-width: 1200px;
  margin-inline: auto;
}

.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
  min-height: 52px;
  border-radius: 0.875rem !important;
  background: var(--primary) !important;
  color: #fff !important;
  font-weight: 800 !important;
  text-decoration: none !important;
}

.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
  background: #1e31b3 !important;
}

.wc-block-components-text-input input,
.wc-block-components-combobox .wc-block-components-combobox-control input {
  min-height: 48px;
  border-radius: 0.75rem !important;
}

.wc-block-cart-item__image img {
  border-radius: 0.75rem;
}

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

.single-product .single_add_to_cart_button.loading {
  position: relative;
  pointer-events: none;
}

.single-product .single_add_to_cart_button.loading::after {
  content: '';
  width: 1.25rem;
  height: 1.25rem;
  margin-inline-start: 0.5rem;
  border: 3px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 9999px;
  animation: ihome-spin 0.8s linear infinite;
}

.animate-fade-in {
  animation: fadeInUp 0.25s ease-out both;
}

@media (max-width: 781px) {
  .wp-block-woocommerce-cart,
  .wp-block-woocommerce-checkout {
    padding-inline: 0.25rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
