/* ==========================================================================
   WooBaba Theme - Global Core Stylesheet
   Path: assets/css/global.css
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. ESSENTIAL LOCAL FONTS
   -------------------------------------------------------------------------- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/inter-400.woff2') format('woff2');
}

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/inter-600.woff2') format('woff2');
}

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/fraunces-600.woff2') format('woff2');
}

@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/ibm-plex-mono-400.woff2') format('woff2');
}

/* --------------------------------------------------------------------------
   2. DESIGN TOKENS & HIGH-CONTRAST THEMES
   -------------------------------------------------------------------------- */

/* ۱. تم پیش‌فرض: تاریک */
:root,
[data-theme="dark"] {
  --charcoal: #17141D;
  --charcoal-2: #120F17;
  --panel: #221D2B;
  --panel-bg: #221D2B;
  --panel-border: #35304A;
  
  --gold: #D9A653;
  --gold-bright: #E8BE73;
  --violet: #8D82E8;
  --btn-text: #17141D;
  
  --ivory: #F3EFE7;
  --mist: #B8B3CB;
  --mist-dim: #948EA8;
  --success: #22C55E;
  --error: #EF4444;

  --nav-bg: rgba(29, 25, 38, 0.85);
  --nav-bg-top: rgba(23, 20, 29, 0.95);

  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;

  --max: 1180px;
  --edge: clamp(1.5rem, 5vw, 4rem);
  --radius: 12px;
  --radius-sm: 6px;

  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 36px rgba(0, 0, 0, 0.5);
}

/* ۲. تم روشن با کنتراست عمیق */
[data-theme="light"] {
  --charcoal: #F1F5F9;
  --charcoal-2: #E2E8F0;
  --panel: #FFFFFF;
  --panel-bg: #FFFFFF;
  --panel-border: #CBD5E1;
  
  --gold: #2563EB;
  --gold-bright: #1D4ED8;
  --violet: #4F46E5;
  --btn-text: #FFFFFF;
  
  --ivory: #0F172A;
  --mist: #334155;
  --mist-dim: #64748B;
  --success: #16A34A;
  --error: #DC2626;

  --nav-bg: rgba(255, 255, 255, 0.9);
  --nav-bg-top: rgba(241, 245, 249, 0.95);

  --shadow-sm: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 12px -2px rgba(15, 23, 42, 0.08), 0 2px 6px -1px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 28px -4px rgba(15, 23, 42, 0.12), 0 4px 10px -2px rgba(15, 23, 42, 0.06);
}

/* استایل دکمه تاگل */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--panel-border);
  color: var(--mist);
  background: transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.theme-toggle:hover {
  color: var(--gold);
  border-color: var(--gold);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

/* --------------------------------------------------------------------------
   3. RESET & BASE ELEMENTS
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  background-color: var(--charcoal);
}

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

body {
  background-color: var(--charcoal);
  color: var(--ivory);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-top: 86px;
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main,
#primary,
.site-main,
.page-content,
.hero,
.section {
  position: relative;
  z-index: 2;
  background-color: var(--charcoal);
}

main::after,
.section:last-of-type::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 20px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.06);
  pointer-events: none;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

ul {
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

/* --------------------------------------------------------------------------
   4. LAYOUT & TYPOGRAPHY HELPERS
   -------------------------------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--edge);
  padding-right: var(--edge);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  margin-bottom: 1.1rem;
}

.eyebrow::before {
  content: "";
  width: 1.4em;
  height: 1px;
  background: var(--gold);
  display: inline-block;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-family: var(--font-mono);
}

.badge--success {
  background: rgba(34, 197, 94, 0.1);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.badge--gold {
  background: rgba(217, 166, 83, 0.1);
  color: var(--gold);
  border: 1px solid rgba(217, 166, 83, 0.3);
}

/* --------------------------------------------------------------------------
   5. GLOBAL BUTTONS
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85em 1.7em;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  border-radius: var(--radius);
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  white-space: nowrap;
  border: none;
  cursor: pointer;
}

.btn--primary {
  background: var(--gold) !important;
  color: var(--btn-text) !important;
}

.btn--primary:hover {
  background: var(--gold-bright) !important;
  transform: translateY(-2px);
  color: var(--btn-text) !important;
}

.btn--ghost {
  border: 1px solid var(--mist-dim);
  color: var(--ivory);
  background: transparent;
}

.btn--ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-2px);
}

.btn--small {
  padding: 0.6em 1.3em;
  font-size: 0.85rem;
}

/* --------------------------------------------------------------------------
   6. HEADER & NAVIGATION
   -------------------------------------------------------------------------- */
.nav {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 32px);
  max-width: 1140px;
  z-index: 1000;
  background: var(--nav-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--panel-border);
  border-radius: 9999px;
  box-shadow: var(--shadow-md);
  transition: top 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              max-width 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-radius 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              background 0.3s ease,
              box-shadow 0.3s ease,
              border-color 0.3s ease;
}

.nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 1.5rem;
  transition: height 0.3s cubic-bezier(0.4, 0, 0.2, 1), padding 0.3s ease;
}

.nav.is-top {
  top: 0;
  width: 100%;
  max-width: 100%;
  border-radius: 0;
  border-color: transparent;
  border-bottom: 1px solid var(--panel-border);
  background: var(--nav-bg-top);
  box-shadow: none;
}

.nav.is-top .wrap {
  height: 80px;
  padding-left: var(--edge);
  padding-right: var(--edge);
}

.brand {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ivory);
}

.logo__icon {
  height: 38px;
  width: auto;
  display: block;
  transition: transform 0.3s ease;
}

.nav.is-top .logo__icon {
  transform: scale(1.15);
}

.logo__text .accent {
  color: var(--gold);
}

.account-link {
  font-size: 0.85rem;
  font-family: var(--font-mono);
  color: var(--mist);
  border: 1px solid var(--panel-border);
  padding: 0.45em 0.95em;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.account-link:hover {
  color: var(--gold);
  border-color: var(--gold);
  background: rgba(217, 166, 83, 0.1);
}

.nav-account {
  display: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: clamp(1.1rem, 2.4vw, 2.2rem);
  font-size: 0.92rem;
  color: var(--mist);
}

.nav-links a:hover {
  color: var(--ivory);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--ivory);
}

.nav-item--dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-item__trigger {
  display: inline-flex;
  align-items: center;
}

.nav-item__trigger::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  margin-left: 0.45em;
  opacity: 0.55;
  position: relative;
  top: -2px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-item--dropdown:hover .nav-item__trigger,
.nav-item--dropdown:focus-within .nav-item__trigger {
  color: var(--mist-dim);
}

.nav-item--dropdown:hover .nav-item__trigger::after,
.nav-item--dropdown:focus-within .nav-item__trigger::after {
  transform: rotate(225deg);
  opacity: 0.8;
  top: 0;
}

.nav-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 0.9rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  min-width: 190px;
  padding: 0.4rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}

.nav-item--dropdown:hover .nav-dropdown,
.nav-item--dropdown:focus-within .nav-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown a {
  display: block;
  padding: 0.65rem 0.9rem;
  font-size: 0.86rem;
  border-radius: var(--radius-sm);
  color: var(--mist);
}

.nav-dropdown a:hover {
  background: var(--charcoal-2);
  color: var(--ivory);
}

@media (max-width: 860px) {
  .nav {
    top: 8px;
    width: calc(100% - 16px);
    border-radius: 16px;
  }
  .nav.is-top {
    border-radius: 0;
  }
  .nav .wrap {
    height: 60px;
    padding: 0 1rem;
  }
  .nav.is-top .wrap {
    height: 68px;
  }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 8px;
    background: var(--panel);
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    max-height: 0;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    transition: max-height 0.3s ease;
  }
  .nav-links.open {
    max-height: 560px;
  }
  .nav-links > a,
  .nav-item__trigger {
    display: block;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--panel-border);
  }
  .nav-links > a:first-child {
    border-top: none;
  }
  .nav-item--dropdown {
    flex-direction: column;
    align-items: stretch;
  }
  .nav-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    margin-top: 0;
    background: none;
    border: none;
    box-shadow: none;
    padding: 0;
  }
  .nav-links .nav-dropdown a {
    padding: 0.85rem 1.25rem 0.85rem 2rem;
    border-top: 1px solid var(--panel-border);
    font-size: 0.85rem;
  }
  .nav-item__trigger::after {
    display: none;
  }
  .account-link {
    display: none;
  }
  .nav-account {
    display: block;
  }
  .nav-toggle {
    display: flex;
  }
}

/* --------------------------------------------------------------------------
   7. SECTION BASE TEMPLATES & COMPONENT ELEVATION
   -------------------------------------------------------------------------- */
.section {
  padding: clamp(4.5rem, 8vw, 6.5rem) 0;
  position: relative;
  border-bottom: 1px solid var(--panel-border);
}

.section:nth-of-type(even),
.section--deep {
  background-color: var(--charcoal-2);
}

.section:nth-of-type(odd),
.section--panel {
  background-color: var(--charcoal);
}

.section-head {
  max-width: 640px;
  margin-bottom: 3rem;
}

.section-head h2,
.section-head h1 {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  margin-bottom: 1rem;
}

.section-head p {
  color: var(--mist);
  font-size: 1.05rem;
  max-width: 56ch;
}

.section-head.center {
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.card,
.feature-card,
.pricing-card,
.demo-wrap,
.step-card,
.doc-card,
.box,
.code-block,
pre {
  background-color: var(--panel) !important;
  border: 1px solid var(--panel-border) !important;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.25s ease;
}

.card:hover,
.feature-card:hover,
.pricing-card:hover,
.step-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--gold) !important;
}

input, select, textarea {
  background-color: var(--panel) !important;
  border: 1px solid var(--panel-border) !important;
  color: var(--ivory) !important;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

/* --------------------------------------------------------------------------
   8. FOOTER
   -------------------------------------------------------------------------- */
.footer {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  background: var(--charcoal-2);
  padding: 4.5rem 0 2rem;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 2.5rem;
  margin-bottom: 3.5rem;
}

.footer__brand p {
  color: var(--mist-dim);
  font-size: 0.88rem;
  margin-top: 1rem;
  max-width: 32ch;
}

.footer__col h4,
.footer__col-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--mist-dim);
  text-transform: uppercase;
  margin-bottom: 1.1rem;
}

.footer__col li {
  margin-bottom: 0.7rem;
  font-size: 0.9rem;
  color: var(--mist);
}

.footer__col a:hover {
  color: var(--gold);
}

.footer__bottom {
  border-top: 1px solid var(--panel-border);
  padding-top: 1.8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--mist-dim);
}

@media (max-width: 760px) {
  .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .footer__grid { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------------------------
   9. LEGAL & DOCUMENTATION PAGES
   -------------------------------------------------------------------------- */
.site-legal-page {
  padding: clamp(3.5rem, 6vw, 5rem) 1.25rem;
  background-color: var(--charcoal);
  color: var(--mist);
  font-family: var(--font-body);
  transition: background-color 0.3s ease, color 0.3s ease;
}

.legal-container {
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: var(--radius);
  padding: clamp(2rem, 5vw, 3.5rem);
  box-shadow: var(--shadow-md);
}

.legal-header {
  margin-bottom: 2.5rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 1.5rem;
}

.legal-title {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
  color: var(--ivory);
  margin-bottom: 0.75rem;
  line-height: 1.2;
}

.legal-meta {
  color: var(--mist-dim);
  font-size: 0.9rem;
  font-family: var(--font-mono);
}

.legal-content h2 {
  font-size: 1.35rem;
  color: var(--ivory);
  margin-top: 2.2rem;
  margin-bottom: 1rem;
  font-family: var(--font-display);
}

.legal-content p, 
.legal-content li {
  font-size: 0.98rem;
  line-height: 1.8;
  color: var(--mist);
}

.legal-content ul {
  padding-left: 1.5rem;
  margin-bottom: 1.5rem;
  list-style-type: disc;
}

.legal-content li {
  margin-bottom: 0.6rem;
}

.legal-content strong {
  color: var(--ivory);
}

.legal-content code {
  background-color: var(--charcoal-2);
  color: var(--gold);
  border: 1px solid var(--panel-border);
  padding: 0.2em 0.45em;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.legal-content a {
  color: var(--gold);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease;
}

.legal-content a:hover {
  color: var(--gold-bright);
}

/* ایزولاسیون کامل دکمه هدر در تمامی برگه‌ها و صفحات ووکامرس */
.nav .nav-actions .btn.btn--primary.btn--small,
body.woocommerce .nav .nav-actions .btn--primary,
body.woocommerce-page .nav .nav-actions .btn--primary {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 0.6em 1.3em !important;
  font-size: 0.85rem !important;
  font-weight: 600 !important;
  background: var(--gold) !important;
  color: var(--btn-text) !important;
  border-radius: var(--radius) !important;
  border: none !important;
  text-decoration: none !important;
  box-shadow: none !important;
  width: auto !important;
  max-width: max-content !important;
  white-space: nowrap !important;
}

.nav .nav-actions .btn.btn--primary.btn--small:hover,
body.woocommerce .nav .nav-actions .btn--primary:hover,
body.woocommerce-page .nav .nav-actions .btn--primary:hover {
  background: var(--gold-bright) !important;
  color: var(--btn-text) !important;
  transform: translateY(-2px) !important;
}