/* ============================================================
   HANSIS THEME — Core CSS v2.1.0
   Ultra lightweight | Mobile First | Elementor Ready
   Plugin-isolated selectors | Scoped focus styles
   © 2025 Hansis. All Rights Reserved.
   ============================================================ */

/* ── TOKENS (overridden by Customizer) ─────────────────────── */
:root {
  --hansis-primary:     #2563EB;
  --hansis-primary-dk:  #1D4ED8;
  --hansis-secondary:   #EEF4FF;
  --hansis-mid:         #DBEAFE;
  --hansis-text:        #111827;
  --hansis-muted:       #4B5563;
  --hansis-light:       #9CA3AF;
  --hansis-border:      #E5E9F2;
  --hansis-bg:          #F8FAFF;
  --hansis-white:       #FFFFFF;
  --hansis-font:        "Poppins", sans-serif;
  --hansis-base-size:   15px;
  --hansis-radius:      18px;
  --hansis-radius-sm:   10px;
  --hansis-radius-xs:   6px;
  --hansis-shadow:      0 2px 16px rgba(37,99,235,.07);
  --hansis-shadow-md:   0 6px 28px rgba(37,99,235,.13);
  --hansis-shadow-lg:   0 12px 48px rgba(37,99,235,.16);
  --hansis-container:   1320px;
  --hansis-header-bg:   #ffffff;
  --hansis-footer-bg:   #111827;
  --hansis-footer-txt:  #9CA3AF;
  --hansis-transition:  0.2s ease;

  /* ── SPACING SCALE (v2.0) ──────────────────────────────── */
  --h-space-xs:   4px;
  --h-space-sm:   8px;
  --h-space-md:   16px;
  --h-space-lg:   32px;
  --h-space-xl:   64px;

  /* ── TYPOGRAPHY SCALE (v2.0) ──────────────────────────── */
  --h-font-heading: "Sora", "Plus Jakarta Sans", "Poppins", sans-serif;
  --h-font-body:    "Inter", "Poppins", sans-serif;
  --h-text-xs:    11px;
  --h-text-sm:    13px;
  --h-text-base:  15px;
  --h-text-md:    17px;
  --h-text-lg:    20px;
  --h-text-xl:    24px;
  --h-text-2xl:   32px;
  --h-text-3xl:   42px;
  --h-text-4xl:   56px;
}

/* ── RESET ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: var(--hansis-base-size);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--hansis-font);
  color: var(--hansis-text);
  background: var(--hansis-white);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/*
 * SCOPED RESETS — v2.1.0
 * ─────────────────────────────────────────────────────────────
 * REMOVED: global img, svg, button, a, ul, ol resets.
 * These were causing conflicts with:
 *   - Mega Menu plugins (button reset removed their backgrounds)
 *   - AJAX Search plugins (focus-visible added blue border to their inputs)
 *   - Custom Elementor widgets (svg display:block broke inline icon layouts)
 *   - Wishlist / Compare plugins (a color:inherit overrode their link styles)
 *
 * All resets are now scoped to .hansis-* containers only.
 * Plugins retain full visual isolation.
 * ─────────────────────────────────────────────────────────────
 */

/* Scope img/svg resets to theme containers only */
.hansis-header img,
.hansis-header svg,
.hansis-main img,
.hansis-main svg,
.hansis-footer img,
.hansis-footer svg,
.hansis-mobile-bar img,
.hansis-mobile-bar svg,
.hansis-mobile-menu img,
.hansis-mobile-menu svg,
.hansis-search-overlay img,
.hansis-search-overlay svg {
  display: block;
  max-width: 100%;
}

/* Scope anchor resets to theme containers only */
.hansis-header a,
.hansis-main a,
.hansis-footer a,
.hansis-mobile-menu a,
.hansis-mobile-bar a {
  color: inherit;
  text-decoration: none;
}

/* Scope button resets to theme buttons only */
.hansis-header button,
.hansis-main button,
.hansis-footer button,
.hansis-mobile-menu button,
.hansis-mobile-bar button,
.hansis-search-overlay button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
}

/* Scope list resets to theme list components only */
.hansis-menu,
.hansis-mobile-menu-list,
.hansis-footer-menu,
.hansis-pagination ul {
  list-style: none;
}

/* ── ACCESSIBILITY ──────────────────────────────────────────── */
.screen-reader-text {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}
.hansis-skip-link:focus {
  position: fixed; top: 8px; left: 8px; z-index: 99999;
  padding: 8px 20px;
  background: var(--hansis-primary);
  color: #fff; border-radius: 6px;
  width: auto; height: auto; clip: auto;
}

/*
 * SCOPED :focus-visible — replaces the previous global rule.
 * The previous `:focus-visible { outline: 3px solid blue }` was hitting
 * every third-party plugin input, select, and button on the page.
 * Now scoped only to Hansis theme interactive elements.
 */
.hansis-header *:focus-visible,
.hansis-mobile-menu *:focus-visible,
.hansis-mobile-bar *:focus-visible,
.hansis-search-overlay *:focus-visible,
.hansis-footer *:focus-visible,
.hansis-btn:focus-visible,
.hansis-pagination a:focus-visible {
  outline: 3px solid var(--hansis-primary);
  outline-offset: 2px;
}

/* ── CONTAINER ──────────────────────────────────────────────── */
.hansis-container {
  width: 100%;
  max-width: var(--hansis-container);
  margin: 0 auto;
  padding: 0 40px;
}
@media (max-width: 1024px) { .hansis-container { padding: 0 24px; } }
@media (max-width: 767px)  { .hansis-container { padding: 0 16px; } }

/* ── HEADER ─────────────────────────────────────────────────── */
.hansis-header {
  position: relative;
  background: var(--hansis-header-bg);
  z-index: 1000;
  transition: box-shadow var(--hansis-transition), background var(--hansis-transition);
}
.hansis-header.hansis-sticky {
  position: sticky;
  top: 0;
}
.hansis-header.hansis-header-shadow,
.hansis-header.hansis-scrolled {
  box-shadow: 0 2px 20px rgba(37,99,235,.08);
}
.hansis-header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 68px;
}
.hansis-logo { flex-shrink: 0; }
.hansis-logo img { max-height: 48px; width: auto; }
.hansis-site-name {
  font-weight: 700;
  font-size: 1.3rem;
  color: var(--hansis-text);
  letter-spacing: -0.5px;
}

/* Desktop nav */
.hansis-nav { flex: 1; }
.hansis-menu {
  display: flex;
  gap: 4px;
  align-items: center;
}
.hansis-menu li { position: relative; }
.hansis-menu > li > a {
  display: block;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--hansis-text);
  border-radius: 8px;
  transition: background var(--hansis-transition), color var(--hansis-transition);
}
.hansis-menu > li > a:hover,
.hansis-menu > li.current-menu-item > a {
  color: var(--hansis-primary);
  background: var(--hansis-secondary);
}
/* Dropdown */
.hansis-menu .sub-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--hansis-white);
  border-radius: 12px;
  box-shadow: var(--hansis-shadow-md);
  border: 1px solid var(--hansis-border);
  min-width: 200px;
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: all var(--hansis-transition);
  z-index: 100;
}
.hansis-menu li:hover > .sub-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.hansis-menu .sub-menu a {
  display: block;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--hansis-muted);
  border-radius: 8px;
  transition: all var(--hansis-transition);
}
.hansis-menu .sub-menu a:hover {
  background: var(--hansis-secondary);
  color: var(--hansis-primary);
}

/* Header action buttons */
.hansis-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.hansis-header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  color: var(--hansis-text);
  transition: background var(--hansis-transition), color var(--hansis-transition);
  position: relative;
  /* Explicit resets */
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
}
.hansis-header-btn:hover {
  background: var(--hansis-secondary);
  color: var(--hansis-primary);
}
.hansis-cart-count {
  position: absolute;
  top: 2px; right: 2px;
  background: var(--hansis-primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Mobile search bar below header row */
.hansis-mobile-search-bar {
  display: none;
  padding: 0 0 10px;
}
.hansis-mobile-search-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--hansis-bg);
  border: 1.5px solid var(--hansis-border);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--hansis-light);
  font-family: var(--hansis-font);
  text-align: left;
}

/* Hamburger */
.hansis-hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background var(--hansis-transition);
  /* Explicit resets */
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}
.hansis-hamburger span {
  display: block;
  width: 22px; height: 2px;
  background: var(--hansis-text);
  border-radius: 2px;
  transition: transform var(--hansis-transition), opacity var(--hansis-transition);
}
.hansis-hamburger:hover { background: var(--hansis-secondary); }
.hansis-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hansis-hamburger.open span:nth-child(2) { opacity: 0; }
.hansis-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile slide menu */
.hansis-mobile-menu {
  position: fixed;
  top: 0; left: 0;
  width: min(320px, 85vw);
  height: 100vh;
  background: var(--hansis-white);
  z-index: 10001;
  /* Use transform instead of left to prevent scroll-width contribution */
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
  box-shadow: var(--hansis-shadow-lg);
}
.hansis-mobile-menu.open { transform: translateX(0); }
.hansis-mobile-menu-inner { padding: 20px; }
.hansis-mobile-menu-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--hansis-text);
  margin-bottom: 20px;
  margin-left: auto;
  /* Explicit resets — no longer relying on global button reset */
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  /* Ensure SVG icon inherits color correctly */
  line-height: 0;
}
/* Ensure SVG inside close button renders inline and inherits color */
.hansis-mobile-menu-close svg {
  display: inline-block;
  flex-shrink: 0;
  color: inherit;
  stroke: currentColor;
}
.hansis-mobile-menu-list li a {
  display: block;
  padding: 12px 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--hansis-text);
  border-radius: 10px;
  transition: all var(--hansis-transition);
  border-bottom: 1px solid var(--hansis-border);
}
.hansis-mobile-menu-list li a:hover,
.hansis-mobile-menu-list li.current-menu-item a {
  background: var(--hansis-secondary);
  color: var(--hansis-primary);
}
.hansis-mobile-menu-list .sub-menu a {
  padding-left: 32px;
  font-size: 14px;
  color: var(--hansis-muted);
}
.hansis-mobile-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.5);
  z-index: 10000;
  display: none;
  backdrop-filter: blur(2px);
}
.hansis-mobile-overlay.visible { display: block; }

/* ── SEARCH OVERLAY ─────────────────────────────────────────── */
/* Full implementation in assets/css/mobile-nav.css              */

/* ── CONTENT AREA ───────────────────────────────────────────── */
.hansis-main { min-height: 60vh; }
.hansis-content-wrap {
  display: grid;
  gap: 32px;
  padding: 40px 0;
}
.hansis-content-wrap.has-sidebar {
  grid-template-columns: 1fr 300px;
}
.hansis-content-wrap.no-sidebar {
  grid-template-columns: 1fr;
}

/* ── BLOG POST CARD ─────────────────────────────────────────── */
.hansis-post-card {
  background: var(--hansis-white);
  border: 1px solid var(--hansis-border);
  border-radius: var(--hansis-radius);
  overflow: hidden;
  box-shadow: var(--hansis-shadow);
  transition: box-shadow var(--hansis-transition), transform var(--hansis-transition);
  margin-bottom: 24px;
}
.hansis-post-card:hover {
  box-shadow: var(--hansis-shadow-md);
  transform: translateY(-2px);
}
.hansis-post-card img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.hansis-post-card-body { padding: 20px 24px; }
.hansis-post-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 8px; }
.hansis-post-title a:hover { color: var(--hansis-primary); }
.hansis-post-meta { font-size: 12px; color: var(--hansis-light); margin-bottom: 10px; }
.hansis-post-excerpt { font-size: 14px; color: var(--hansis-muted); line-height: 1.7; }

/* ── SIDEBAR ────────────────────────────────────────────────── */
.hansis-sidebar .widget {
  background: var(--hansis-bg);
  border: 1px solid var(--hansis-border);
  border-radius: var(--hansis-radius-sm);
  padding: 20px;
  margin-bottom: 20px;
}
.hansis-sidebar .widget-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--hansis-text);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--hansis-primary);
  margin-bottom: 14px;
}

/* ── PAGINATION ─────────────────────────────────────────────── */
.hansis-pagination { margin: 32px 0; }
.hansis-pagination ul {
  display: flex; gap: 6px; flex-wrap: wrap; list-style: none;
}
.hansis-pagination a,
.hansis-pagination span {
  display: flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px;
  border-radius: 8px; padding: 0 10px;
  font-size: 13px; font-weight: 500;
  border: 1.5px solid var(--hansis-border);
  color: var(--hansis-muted);
  transition: all var(--hansis-transition);
}
.hansis-pagination a:hover { border-color: var(--hansis-primary); color: var(--hansis-primary); }
.hansis-pagination .current {
  background: var(--hansis-primary);
  border-color: var(--hansis-primary);
  color: #fff;
}

/* ── FOOTER ─────────────────────────────────────────────────── */
.hansis-footer { background: var(--hansis-footer-bg); }
.hansis-footer-widgets { padding: 56px 0 40px; }
.hansis-footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
}
.hansis-footer .widget-title { color: #fff; border-color: var(--hansis-primary); }
.hansis-footer p,
.hansis-footer a,
.hansis-footer li { color: var(--hansis-footer-txt); font-size: 13px; }
.hansis-footer a:hover { color: #fff; }
.hansis-footer-bottom {
  background: rgba(0,0,0,.2);
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 16px 0;
}
.hansis-footer-bottom-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.hansis-copyright { color: #6B7280; font-size: 12px; }
.hansis-footer-menu {
  display: flex; gap: 20px; flex-wrap: wrap;
}
.hansis-footer-menu a {
  font-size: 12px; color: #6B7280;
  transition: color var(--hansis-transition);
}
.hansis-footer-menu a:hover { color: #fff; }

/* ── MOBILE BOTTOM NAV BAR ──────────────────────────────────── */
/* Full implementation in assets/css/mobile-nav.css             */
/* Loaded via enqueue.php alongside this file                    */

/* ── UTILITY CLASSES ────────────────────────────────────────── */
.hansis-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--hansis-radius-sm);
  font-family: var(--hansis-font);
  font-weight: 600;
  font-size: 14px;
  transition: all var(--hansis-transition);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
}
.hansis-btn-primary {
  background: var(--hansis-primary);
  color: #fff;
  border: 2px solid var(--hansis-primary);
}
.hansis-btn-primary:hover {
  background: var(--hansis-primary-dk);
  border-color: var(--hansis-primary-dk);
  transform: translateY(-1px);
}
.hansis-btn-outline {
  background: transparent;
  color: var(--hansis-primary);
  border: 2px solid var(--hansis-primary);
}
.hansis-btn-outline:hover {
  background: var(--hansis-primary);
  color: #fff;
}

/* Badges */
.hansis-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.hansis-badge-blue  { background: var(--hansis-secondary); color: var(--hansis-primary); }
.hansis-badge-red   { background: #FEE2E2; color: #EF4444; }
.hansis-badge-green { background: #D1FAE5; color: #10B981; }

/* Breadcrumb */
.hansis-breadcrumb {
  padding: 12px 0;
  font-size: 13px;
  color: var(--hansis-muted);
}
.hansis-breadcrumb a { color: var(--hansis-muted); }
.hansis-breadcrumb a:hover { color: var(--hansis-primary); }
.hansis-sep { margin: 0 4px; color: var(--hansis-light); }

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .hansis-desktop-nav { display: none; }
  .hansis-hamburger { display: flex; }
  .hansis-content-wrap.has-sidebar { grid-template-columns: 1fr; }
  .hansis-footer-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 767px) {
  .hansis-header-inner { height: 56px; gap: 12px; }
  .hansis-mobile-search-bar { display: block; }
  /* Mobile bar display + body padding handled in mobile-nav.css */
  .hansis-footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .hansis-footer-widgets { padding: 36px 0 28px; }
  .hansis-footer-bottom-inner { flex-direction: column; align-items: flex-start; gap: 8px; }
  /* Hide account icon in header on mobile — accessible via bottom bar */
  .hansis-header-btn:not(.hansis-cart-btn):not(.hansis-search-trigger) { display: none; }
}

/* ── ELEMENTOR COMPATIBILITY ─────────────────────────────────── */

/* Canvas pages — hide all theme chrome */
.elementor-template-canvas .hansis-header,
.elementor-template-canvas .hansis-footer,
.elementor-template-canvas .hansis-mobile-bar { display: none !important; }

/* Full width Elementor template */
.elementor-template-full-width .hansis-main { padding: 0; }
.elementor-template-full-width .hansis-container { padding: 0; max-width: none; }

/*
 * ELEMENTOR EDITOR ISOLATION — v2.1.0
 * ─────────────────────────────────────────────────────────────
 * The Elementor editor loads the frontend stylesheet inside an
 * iframe. The previous global resets (button, img, svg, a) were
 * hitting Elementor editor chrome elements and widget controls.
 *
 * These rules ensure the editor panel, toolbar, and widget
 * previews are not affected by Hansis resets.
 *
 * Selectors are prefixed with .elementor-editor-active to only
 * apply inside the Elementor editor context (not the frontend).
 * ─────────────────────────────────────────────────────────────
 */

/* Prevent body padding from the mobile bar affecting Elementor editor */
.elementor-editor-active body {
  padding-bottom: 0 !important;
}

/* Ensure Elementor widget images are not constrained by theme max-width */
.elementor-widget-image img,
.elementor-widget-image-box img,
.elementor-widget img {
  max-width: 100%;
  height: auto;
}

/* Ensure Elementor widget containers are not affected by hansis-main scoped resets */
.elementor-section,
.elementor-container,
.e-container,
.e-con {
  /* No hansis overrides — Elementor manages its own layout */
}

/* ── PAGE BUILDER COMPATIBILITY ─────────────────────────────── */
.hansis-page .entry-content,
.hansis-page .wp-block-group { max-width: none; }

/* ── PRINT ───────────────────────────────────────────────────── */
@media print {
  .hansis-header,
  .hansis-footer,
  .hansis-mobile-bar,
  .hansis-search-overlay { display: none !important; }
}
