/*
Theme Name: Pharmate-v2.0
Theme URI: https://wordpress.org/themes/Pharmate/
Author: jbcode
Author URI: jbcode.it
Description: Custom theme for Pharmate Store.
Requires at least: 6.4
Tested up to: 6.6
Requires PHP: 7.0
Version: 2.0.4
Text Domain: Pharmate
Tags: shop, e-commerce, woocommerce
*/

/* ═══════════════════════════════════════════
   PHARMATE v2.0 — Premium Styles
   ═══════════════════════════════════════════ */

/* ─── Global ─── */
body {
  background-color: #fefdfb !important;
  color: #1e1f22;
}

::selection {
  background-color: #c8d9cd;
  color: #15201a;
}

/* ─── Navigation ─── */
nav {
  transition: padding 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

nav.nav-scrolled {
  padding-top: 0.5rem;
  padding-bottom: 0.5rem;
  box-shadow: 0 4px 30px -5px rgba(0, 0, 0, 0.06);
}

.nav-item {
  position: relative;
  display: inline-block;
  padding: 0 16px;
  font-weight: 300;
  letter-spacing: 0.03em;
  font-size: 0.9rem;
}

.activeNav {
  color: #3a5944;
  font-weight: 500;
}

#activeIndicator {
  background: #5a8a69 !important;
}

/* ─── Tab Switcher (New Products / Bestsellers) ─── */
.active {
  padding: 4px 12px;
  border-bottom: 2px solid #5a8a69;
  color: #1e1f22;
}

/* ─── Pill Tab Switcher (Premium) ─── */
.product-tab-switcher {
  backdrop-filter: blur(8px);
}

.product-tab {
  cursor: pointer;
  user-select: none;
}

.product-tab.active {
  color: #3a5944;
  border-bottom: none;
  padding: 8px 24px;
  font-weight: 500;
}

.product-tab:not(.active) {
  color: #9ca3af;
  border-bottom: none;
  padding: 8px 24px;
}

.product-tab:not(.active):hover {
  color: #6b7280;
}

.tab-indicator {
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── Category Card Shine Effect ─── */
.category-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.7s ease;
  z-index: 5;
  pointer-events: none;
}

.category-card:hover::before {
  left: 125%;
}

/* ─── Product Card Home Enhancements ─── */
.product-card-home {
  will-change: transform;
}

.product-card-home .size-woocommerce_thumbnail {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
}

/* ─── Products grid transitions ─── */
#newProducts,
#bestsellers {
  transition: opacity 0.35s ease-in-out;
}

/* ─── Shop Filter Panel ─── */
.filter-option.active-filter {
  background-color: #f4f7f5;
  font-weight: 500;
  color: #3a5944;
  border: 1px solid #c8d9cd;
  border-radius: 0.5rem;
}

/* Custom checkbox visual */
.customCheckbox:checked {
  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 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3E%3C/svg%3E");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

/* Filter scroll custom scrollbar */
#filter::-webkit-scrollbar {
  width: 4px;
}
#filter::-webkit-scrollbar-track {
  background: #f6f6f7;
  border-radius: 4px;
}
#filter::-webkit-scrollbar-thumb {
  background: #c8d9cd;
  border-radius: 4px;
}
#filter::-webkit-scrollbar-thumb:hover {
  background: #a3bfab;
}

/* ─── Breadcrumbs ─── */
.woocommerce-breadcrumb {
  font-size: 0.8125rem;
  letter-spacing: 0.01em;
}
.woocommerce-breadcrumb a {
  color: #5a8a69;
  text-decoration: none;
  transition: color 0.2s ease;
}
.woocommerce-breadcrumb a:hover {
  color: #3a5944;
}

.activeIngredient {
  background-color: #e6ede8;
  color: #3a5944;
  border: solid 1px #5a8a69;
}

/* ─── Parallax ─── */
.parallax {
  background-attachment: fixed;
  background-size: cover;
  background-position: center;
}

@media (max-width: 768px) {
  .parallax {
    background-attachment: scroll;
  }
}

/* ─── Star Rating ─── */
.star-rating {
  position: relative;
  display: inline-block;
}

.star-rating::before {
  content: "\2606\2606\2606\2606\2606";
  color: #c4a35a;
}

.star-rating::after {
  content: "\2605\2605\2605\2605\2605";
  color: #c4a35a;
  position: absolute;
  top: 0;
  left: 0;
  width: calc(var(--rating) / 5 * 100%);
  overflow: hidden;
}

/* ─── Loading Spinner ─── */
.loading-spinner {
  border-radius: 50%;
  border-width: 4px;
  border-color: white;
  border-top-color: transparent;
}

/* ─── Thumbnail Gallery ─── */
#prev-thumb,
#next-thumb {
  z-index: 10;
  font-size: 24px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.3s, transform 0.3s;
  color: #3a5944;
  background-color: #fefdfb;
  border: 1px solid #e2e3e5;
}

#prev-thumb:hover,
#next-thumb:hover {
  opacity: 1;
  transform: scale(1.05);
}

#thumbnail-gallery {
  display: flex;
  transition: transform 0.3s ease-in-out;
}

/* ─── Product Toggle (New/Bestsellers) ─── */
#newProducts,
#bestsellers {
  opacity: 1;
  visibility: visible;
  transition: opacity 300ms ease-in-out;
}

/* ─── Product Images ─── */
.productImageContainer .size-woocommerce_thumbnail {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}

/* ─── Front Hero Mobile ─── */
@media (max-width: 768px) {
  .frontHero {
    background-size: 1400px !important;
  }
}

/* ─── Swiper Overrides ─── */
.swiper-button-prev,
.swiper-button-next {
  display: none !important;
}

.topCommentsSlider .swiper-button-prev,
.topCommentsSlider .swiper-button-next {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  box-shadow: none;
  width: 40px;
  height: 40px;
  color: #3a5944;
  border-radius: 50%;
  transition: background-color 0.3s, color 0.3s;
}

.topCommentsSlider .swiper-button-prev:hover,
.topCommentsSlider .swiper-button-next:hover {
  background-color: #e6ede8;
}

.topCommentsSlider .swiper-button-prev {
  left: -32px;
}

.topCommentsSlider .swiper-button-next {
  right: -32px;
}

.topCommentsSlider .swiper-button-prev::after,
.topCommentsSlider .swiper-button-next::after {
  font-size: 20px;
}

@media (max-width: 640px) {
  .topCommentsSlider .swiper-button-prev {
    left: -20px;
  }
  .topCommentsSlider .swiper-button-next {
    right: -20px;
  }
}

@media (min-width: 1024px) {
  .topCommentsSlider .swiper-button-prev {
    left: -48px;
  }
  .topCommentsSlider .swiper-button-next {
    right: -48px;
  }
}

/* ─── WooCommerce Overrides ─── */
#billing_last_name_field {
  margin-top: 0 !important;
}

label:hover .description-container {
  max-height: fit-content;
}

.woocommerce-MyAccount-navigation {
  display: none;
}

.woocommerce-success-message,
.woocommerce-error-message,
.woocommerce-info-message {
  display: none !important;
}

/* ─── Premium Ambient Animations ─── */
@keyframes subtleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

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

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ─── Sale Badge Premium ─── */
.sale-badge {
  background: linear-gradient(135deg, #5a8a69, #476e53) !important;
  font-weight: 500 !important;
  letter-spacing: 0.05em;
  font-size: 0.75rem !important;
  padding: 6px 14px !important;
  border-radius: 8px !important;
  box-shadow: 0 2px 8px rgba(90, 138, 105, 0.3) !important;
}

/* ─── Premium Link Styles ─── */
a.premium-link {
  color: #3a5944;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}

a.premium-link:hover {
  border-bottom-color: #5a8a69;
}

/* ─── Glass Card (for hero overlays) ─── */
.glass-card {
  background: rgba(30, 31, 34, 0.25);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1.5rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
}

/* ─── Scroll Reveal (applied via JS IntersectionObserver) ─── */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.7s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ─── Premium Form Inputs ─── */
input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
textarea,
select {
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
textarea:focus,
select:focus {
  border-color: #5a8a69 !important;
  box-shadow: 0 0 0 3px rgba(90, 138, 105, 0.1) !important;
  outline: none;
}

/* ─── Subtle Grain Texture (optional page overlay) ─── */
.grain-overlay::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0.025;
  pointer-events: none;
  z-index: 9999;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* ─── Mobile Menu Slide Animation ─── */
#mobileMenu {
  transform: translateX(100%);
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
              opacity 0.3s ease;
  opacity: 0;
}

#mobileMenu:not(.hidden) {
  transform: translateX(0);
  opacity: 1;
}

/* ─── Product Card Hover Enhancement ─── */
.productImageContainer img {
  transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.productImageContainer:hover img {
  transform: scale(1.04);
}

/* ─── Quantity Input Styling ─── */
input[type="number"]#quantity {
  width: 72px;
  text-align: center;
  border-radius: 0.75rem;
  border: 1px solid #e2e3e5;
  padding: 0.5rem 0.75rem;
  font-family: "Jost", sans-serif;
  transition: border-color 0.3s ease;
}

input[type="number"]#quantity:focus {
  border-color: #5a8a69;
  box-shadow: 0 0 0 3px rgba(90, 138, 105, 0.1);
}

/* ─── Thumbnail Gallery Premium ─── */
.thumbnail {
  border: 2px solid transparent;
  transition: border-color 0.3s, opacity 0.3s;
  opacity: 0.7;
}

.thumbnail:hover {
  border-color: #5a8a69;
  opacity: 1;
}

/* ─── WooCommerce Product Card Links ─── */
.productImageContainer + h2,
.productImageContainer ~ .px-2 {
  font-family: "Jost", sans-serif;
}

/* ─── Single Product Info Cards ─── */
.border-\\[1px\\].solid {
  border-color: #e2e3e5;
  border-radius: 1rem;
  transition: box-shadow 0.3s ease;
}

.border-\\[1px\\].solid:hover {
  box-shadow: 0 4px 25px -5px rgba(0,0,0,0.06);
}

/* ─── Popup / Modal Premium ─── */
#nutrition-popup > div {
  border-radius: 1.5rem;
  border: 1px solid #e2e3e5;
  box-shadow: 0 20px 60px -15px rgba(0,0,0,0.15);
}

#nutrition-popup #close-popup {
  color: #7c7e86;
  font-size: 0.875rem;
  font-family: "Jost", sans-serif;
  top: 1rem;
  right: 1rem;
  transition: color 0.3s;
}

#nutrition-popup #close-popup:hover {
  color: #1e1f22;
}

/* ─── Science Section Items ─── */
.hover\\:bg-gray-100 {
  border-radius: 1rem !important;
  border: 1px solid #e2e3e5 !important;
}

.hover\\:bg-gray-100:hover {
  background-color: #f4f7f5 !important;
}

/* ─── Suggested Product Cards ─── */
.border-\\[1px\\].rounded-xl {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.border-\\[1px\\].rounded-xl:hover {
  transform: translateY(-4px);
  box-shadow: 0 10px 40px -10px rgba(0,0,0,0.08);
}

/* ─── Toast Notification Premium ─── */
#toast {
  border-radius: 1rem !important;
  font-family: "Jost", sans-serif !important;
  backdrop-filter: blur(8px);
  box-shadow: 0 10px 40px rgba(0,0,0,0.2) !important;
}

/* ─── Staggered reveal delays for children ─── */
.reveal:nth-child(1) { transition-delay: 0ms; }
.reveal:nth-child(2) { transition-delay: 80ms; }
.reveal:nth-child(3) { transition-delay: 160ms; }
.reveal:nth-child(4) { transition-delay: 240ms; }
