/* ===================================================
   ShopOnline — Main Stylesheet (RTL Hebrew)
   =================================================== */

:root {
  --primary:    #6366f1;
  --primary-d:  #4f46e5;
  --secondary:  #8b5cf6;
  --success:    #22c55e;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --bg:         #f9fafb;
  --card:       #ffffff;
  --border:     #e5e7eb;
  --text:       #111827;
  --muted:      #6b7280;
  --radius:     12px;
  --shadow:     0 4px 20px rgba(0,0,0,.08);
  --shadow-lg:  0 8px 40px rgba(0,0,0,.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; overflow-x: hidden; }
body { font-family: 'Heebo', Arial, sans-serif; background: var(--bg); color: var(--text); direction: rtl; overflow-x: hidden; }
img { max-width: 100%; display: block; }

/* ── Layout ─────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.page-wrap  { min-height: calc(100vh - 64px - 200px); padding: 40px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }

/* ── Navbar ─────────────────────────────────────── */
.navbar {
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e5e7eb;
  position: sticky; top: 0; z-index: 99998;
  box-shadow: 0 2px 16px rgba(0,0,0,.06);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 900; font-size: 1.15rem; flex-shrink:0; letter-spacing:-.3px; }
.logo:hover { text-decoration: none; opacity:.85; }
.logo-icon { font-size: 1.4rem; }
.nav-links { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; flex-shrink:1; }
.nav-links a {
  padding: 7px 14px; border-radius: 999px;
  color: #4b5563; font-size: .84rem; font-weight: 600;
  transition: all .18s; white-space: nowrap; text-decoration: none;
  border: 1.5px solid #e5e7eb; background: #f9fafb;
}
.nav-links a:hover { color: #fff; background: var(--primary); border-color: var(--primary); text-decoration: none; transform: translateY(-1px); box-shadow: 0 3px 10px rgba(99,102,241,.3); }
.nav-links a.active { color: var(--primary); background: #ede9fe; border-color: #c4b5fd; }
.nav-links .admin-link { color: #dc2626; background: #fef2f2; border-color: #fecaca; }
.nav-links .admin-link:hover { color: #fff; background: #dc2626; border-color: #dc2626; box-shadow: 0 3px 10px rgba(220,38,38,.3); }
.nav-links .seller-link { color: var(--secondary); background: #faf5ff; border-color: #e9d5ff; }
.nav-links .seller-link:hover { color: #fff; background: var(--secondary); border-color: var(--secondary); box-shadow: 0 3px 10px rgba(139,92,246,.3); }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.cart-btn { display:inline-flex; align-items:center; gap:6px; font-size: .88rem; padding: 8px 14px; border-radius: 999px; background: #f3f4f6; color: var(--text); font-weight: 700; transition: all .18s; border: 1.5px solid #e5e7eb; }
.cart-btn:hover { background: #ea580c; color: #fff; border-color: #ea580c; text-decoration: none; box-shadow: 0 3px 10px rgba(234,88,12,.3); }
.cart-btn:hover .cart-count { background: rgba(255,255,255,.25); color: #fff; }
.cart-count { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 999px; background: #e5e7eb; font-size: .72rem; font-weight: 800; padding: 0 5px; transition: all .18s; }
.cart-count.has-items { background: var(--primary); color: #fff; }
.user-menu { position: relative; }
.user-btn { background: linear-gradient(135deg,var(--primary),var(--secondary)); border: none; border-radius: 999px; padding: 8px 16px; cursor: pointer; font-family: inherit; font-size: .84rem; color: #fff; font-weight: 700; transition: all .18s; box-shadow: 0 2px 8px rgba(99,102,241,.3); }
.user-btn:hover { opacity:.9; transform:translateY(-1px); }
.user-dropdown { display: none; position: absolute; top: calc(100% + 8px); left: 0; background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; box-shadow: 0 8px 32px rgba(0,0,0,.12); min-width: 190px; z-index: 100; padding: 8px; }
.user-dropdown a { display: block; padding: 9px 14px; border-radius: 8px; color: var(--text); font-size: .88rem; font-weight: 500; }
.user-dropdown a:hover { background: #f3f4f6; text-decoration: none; }
.user-dropdown hr { border: none; border-top: 1px solid #f3f4f6; margin: 5px 0; }
.user-menu.open .user-dropdown { display: block; }
.hamburger { display: none; background: none; border: 1.5px solid #e5e7eb; border-radius: 8px; font-size: 1.2rem; cursor: pointer; padding: 7px 10px; color: #374151; }

/* ── Buttons ─────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 22px; border-radius: 8px; border: none; cursor: pointer; font-family: inherit; font-size: .9rem; font-weight: 600; transition: all .2s; text-decoration: none; }
.btn:hover { text-decoration: none; opacity: .92; transform: translateY(-1px); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-d); }
.btn-secondary { background: var(--secondary); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-sm { padding: 6px 14px; font-size: .82rem; }
.btn-lg { padding: 14px 32px; font-size: 1rem; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ── Cards ──────────────────────────────────────── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-body { padding: 24px; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.card-header h2, .card-header h3 { margin: 0; font-size: 1.1rem; }

/* ── Product Card ────────────────────────────────── */
.product-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: all .25s; cursor: pointer; display:flex; flex-direction:column; height: 100%; }
.product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.product-card-img { width:100%; height:180px; overflow: hidden; background: #fff; position: relative; flex-shrink:0; }
.product-card-img img { width: 100%; height: 100%; object-fit: contain; transition: transform .3s; }
.product-card:hover .product-card-img img { transform: scale(1.05); }
.product-card-body { padding: 12px; flex:1; display:flex; flex-direction:column; }
.product-title { font-weight: 700; font-size: .95rem; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height:1.4; min-height:2.8em; }
.product-desc { font-size:.82rem; color:var(--muted); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; line-height:1.5; min-height:3em; margin-bottom:6px; }
.product-price { color: var(--primary); font-weight: 800; font-size: 1.1rem; }
.product-compare { color: var(--muted); font-size: .85rem; text-decoration: line-through; margin-right: 8px; }
.product-seller { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 700; }
.badge-primary { background: #ede9fe; color: var(--primary); }
.badge-success { background: #dcfce7; color: #16a34a; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger  { background: #fee2e2; color: #dc2626; }

/* ── Stars ───────────────────────────────────────── */
.stars { color: #f59e0b; font-size: .9rem; }
.stars span { color: var(--muted); font-size: .8rem; }

/* ── Forms ───────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 10px 14px; border: 2px solid var(--border); border-radius: 8px;
  font-family: inherit; font-size: .95rem; transition: border-color .2s; background: #fff; color: var(--text);
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary);
}
.form-group textarea { resize: vertical; min-height: 100px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── Alerts ──────────────────────────────────────── */
.alert { padding: 14px 18px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; }
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.alert-error   { background: #fee2e2; color: #dc2626; border: 1px solid #fca5a5; }
.alert-info    { background: #dbeafe; color: #1d4ed8; border: 1px solid #93c5fd; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ── Hero ────────────────────────────────────────── */
.hero { background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%); color: #fff; padding: 80px 0; text-align: center; position: relative; overflow: hidden; }
.hero h1 { font-size: 3rem; font-weight: 800; margin-bottom: 16px; line-height: 1.2; }
.hero p { font-size: 1.2rem; opacity: .9; margin-bottom: 32px; }
.hero-search { display: flex; max-width: 500px; margin: 0 auto; gap: 0; border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-lg); }
.hero-search input { flex: 1; padding: 14px 20px; border: none; font-size: 1rem; font-family: inherit; }
.hero-search button { padding: 14px 24px; background: #fff; color: var(--primary); border: none; font-weight: 700; cursor: pointer; font-family: inherit; }

/* ── Section ─────────────────────────────────────── */
.section { padding: 60px 0; }
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 32px; }
.section-title { font-size: 1.6rem; font-weight: 800; }
.section-title::before { content: ''; display: inline-block; width: 4px; height: 24px; background: var(--primary); border-radius: 2px; margin-left: 12px; vertical-align: middle; }

/* ── Table ───────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; text-align: right; border-bottom: 1px solid var(--border); }
.table th { background: #f9fafb; font-weight: 700; font-size: .85rem; color: var(--muted); }
.table tbody tr:hover { background: #f9fafb; }

/* ── Modal ───────────────────────────────────────── */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-box { background: #fff; border-radius: 16px; padding: 32px; width: 100%; max-width: 440px; position: relative; max-height: 90vh; overflow-y: auto; }
.modal-close { position: absolute; top: 16px; left: 16px; background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--muted); }
.modal h2 { margin-bottom: 24px; font-size: 1.4rem; }

/* ── Tabs ────────────────────────────────────────── */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn { padding: 10px 20px; background: none; border: none; cursor: pointer; font-family: inherit; font-size: .9rem; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Breadcrumb ──────────────────────────────────── */
.breadcrumb { padding: 14px 0; font-size: .85rem; color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb span { margin: 0 8px; }

/* ── Sidebar Layout ──────────────────────────────── */
.sidebar-layout { display: grid; grid-template-columns: 240px 1fr; gap: 32px; align-items: start; }
.sidebar { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: sticky; top: 80px; }
.sidebar-title { font-weight: 700; font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--text); font-size: .9rem; font-weight: 500; transition: all .2s; }
.sidebar-nav a:hover, .sidebar-nav a.active { background: #ede9fe; color: var(--primary); text-decoration: none; }

/* ── Footer ──────────────────────────────────────── */
.footer { background: var(--text); color: #d1d5db; padding: 48px 0 24px; margin-top: 80px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; margin-bottom: 32px; }
.footer h3 { color: #fff; margin-bottom: 12px; font-size: 1.1rem; }
.footer h4 { color: #fff; margin-bottom: 12px; font-size: .9rem; }
.footer ul { list-style: none; }
.footer ul li { margin-bottom: 8px; }
.footer ul a { color: #9ca3af; font-size: .9rem; }
.footer ul a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #374151; padding-top: 20px; display: flex; justify-content: space-between; align-items: center; font-size: .85rem; }

/* ── Loading / Empty states ──────────────────────── */
.spinner { display: inline-block; width: 36px; height: 36px; border: 3px solid #e5e7eb; border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty-state { text-align: center; padding: 80px 20px; color: var(--muted); }
.empty-state .icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }

/* ── Toast ───────────────────────────────────────── */
#toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast { background: #1f2937; color: #fff; padding: 14px 20px; border-radius: 10px; font-size: .9rem; font-weight: 500; box-shadow: var(--shadow-lg); animation: slideIn .3s ease; max-width: 320px; }
.toast.success { background: #16a34a; }
.toast.error   { background: #dc2626; }
@keyframes slideIn { from { opacity:0; transform: translateY(20px); } to { opacity:1; transform: translateY(0); } }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .sidebar-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; }
}
@media (max-width: 768px) {
  .nav-links {
    display: block !important;
    position: fixed;
    top: 0; right: -100%; bottom: 0;
    width: 280px;
    background: #ffffff;
    flex-direction: column;
    padding: 80px 20px 20px;
    z-index: 999999;
    border-left: 1px solid var(--border);
    overflow-y: auto;
    transition: right 0.3s ease;
    box-shadow: -4px 0 24px rgba(0,0,0,.15);
  }
  .nav-links.open { right: 0; }
  .nav-links a {
    display: block;
    font-size: 1.05rem;
    padding: 14px 16px;
    border-radius: 8px;
    color: var(--text);
    font-weight: 600;
    border-bottom: 1px solid #f3f4f6;
    text-decoration: none;
  }
  .nav-links a:hover { background: #f0f4ff; color: var(--primary); }
  .hamburger { display: block; }
  .nav-search-wrap { display: none !important; }
  .featured-slide-item { flex: 0 0 calc(50% - 8px) !important; min-width: calc(50% - 8px) !important; }
  .hero h1 { font-size: 2rem; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  /* עמודים עם 2 עמודות שצריכות להפוך לאחת במובייל */
  .grid-2.stack-mobile { grid-template-columns: 1fr !important; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .form-row { grid-template-columns: 1fr; }
  .container { padding: 0 12px; }
  .product-card-img { height: 140px; }
  .product-title { font-size: .82rem; }
  .product-price { font-size: .9rem; }
  .product-seller { font-size: .72rem; }
  .product-card-body { padding: 8px; }
  .btn-sm { font-size: .74rem; padding: 6px 8px; }
  /* Cart fix */
  .cart-grid { grid-template-columns: 1fr !important; }
  /* Dashboard fix */
  .sidebar-layout { grid-template-columns: 1fr !important; gap: 16px; }
  .sidebar { position: static; max-height: none; }
  .sidebar-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
  .sidebar-nav a { padding: 8px 10px; font-size: .8rem; border-radius: 8px; }
  /* Table fix */
  .table { font-size: .8rem; }
  .table td, .table th { padding: 8px 6px; }
  /* Checkout fix */
  .checkout-grid { grid-template-columns: 1fr !important; }
  /* Overflow fix */
  .page-wrap, .container { overflow-x: hidden; max-width: 100vw; }
}

@media (max-width: 480px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; gap: 10px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .hero h1 { font-size: 1.6rem; }
  .product-card-img { height: 120px; }
}

/* ── Mobile Fixed Navbar ─────────────────────────────── */
@media (max-width: 768px) {
  .navbar {
    position: fixed !important;
    top: 0; left: 0; right: 0;
    z-index: 999997 !important;
    background: #ffffff !important;
  }
  body { padding-top: 64px; }
  .nav-links { top: 64px !important; }
}

/* ── Mobile Global Fixes ─────────────────────────────── */
@media (max-width: 768px) {
  /* עמודי נחיתה — טופס מתחת לטקסט */
  .lp-grid { grid-template-columns: 1fr !important; gap: 28px !important; }

  /* Hero גובה */
  section[style*="min-height:90vh"] { min-height: auto !important; padding: 48px 0 !important; }
  section[style*="min-height:85vh"] { min-height: auto !important; padding: 48px 0 !important; }

  /* כרטיסי מחירון */
  .pricing-cards { grid-template-columns: 1fr !important; }

  /* careers grid */
  .grid-2.stack-mobile, .grid-3.stack-mobile { grid-template-columns: 1fr !important; }

  /* עוגיות — כפתורים תחת טקסט */
  #cookieBanner > div { flex-direction: column; gap: 10px; }
  #cookieBanner > div > div:last-child { width: 100%; display: flex; }
  #cookieBanner button { flex: 1; }

  /* seller dashboard טבלאות */
  .seller-table { font-size: .78rem; }

  /* product page */
  .grid-2.stack-mobile[style*="gap:48px"] { gap: 24px !important; }

  /* הודעת מערכת */
  #sysBannerEl { font-size: .8rem; padding: 8px 12px; }

  /* דפי LP — כרטיסי יתרונות */
  .grid-3 { grid-template-columns: 1fr !important; }

  /* pricing page */
  details > div { padding: 12px !important; }
}

@media (max-width: 480px) {
  /* ניווט קטן */
  .logo span { font-size: .9rem; }
  .cart-btn { font-size: .85rem; }

  /* כרטיסי מוצר */
  .product-card-img { height: 110px; }

  /* כפתורים */
  .btn-lg { padding: 12px 20px !important; font-size: .9rem !important; }

  /* עמוד מוצר */
  h1[style*="font-size:1.8rem"] { font-size: 1.4rem !important; }
  .product-price[style*="font-size:2rem"] { font-size: 1.6rem !important; }
}

/* ── Nav Categories Dropdown ─────────────────────────── */
.nav-dropdown-wrap { position:relative; display:inline-flex; align-items:center; height:100%; }
.nav-dropdown-trigger {
  cursor:pointer; font-weight:600; color:var(--text); text-decoration:none;
  display:inline-flex; align-items:center; gap:4px; padding:0;
  background:none; border:none; font-family:inherit; font-size:inherit;
}
.nav-dropdown-trigger:hover { color:var(--primary); }
.nav-dropdown-menu {
  display:none; position:absolute; top:calc(100% + 8px); right:0;
  background:#fff; border-radius:12px; box-shadow:0 8px 32px rgba(0,0,0,.15);
  border:1px solid #e5e7eb; min-width:220px; z-index:99999; padding:6px;
}
.nav-dropdown-wrap:hover .nav-dropdown-menu { display:block; }
.nav-dd-link {
  display:block; padding:9px 14px; font-size:.88rem; color:var(--text);
  text-decoration:none; border-radius:8px; font-weight:500;
}
.nav-dd-link:hover { background:#f0f4ff; color:var(--primary); font-weight:700; }
.nav-dd-item { position:relative; }
.nav-dd-sub {
  display:none; position:absolute; right:calc(100% + 4px); top:0;
  background:#fff; border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,.12);
  border:1px solid #e5e7eb; min-width:200px; padding:6px; z-index:99999;
}
.nav-dd-item.has-sub:hover .nav-dd-sub { display:block; }

/* מובייל — accordion בתוך hamburger menu */
@media(max-width:768px) {
  .nav-dropdown-wrap { display:block; width:100%; height:auto; }
  .nav-dropdown-trigger {
    width:100%; justify-content:space-between; padding:14px 16px;
    display:flex; border-bottom:1px solid #f3f4f6;
  }
  .nav-dropdown-menu {
    display:none !important; position:static; box-shadow:none; border:none;
    border-radius:0; padding:0; background:#f9fafb;
  }
  .nav-dropdown-wrap.mob-open .nav-dropdown-menu { display:block !important; }
  .nav-dd-link { padding:11px 28px; border-bottom:1px solid #f3f4f6; border-radius:0; font-size:.9rem; }
  .nav-dd-sub { display:block; position:static; box-shadow:none; border:none; padding:0; border-radius:0; background:#eff6ff; }
  .nav-dd-sub .nav-dd-link { padding-right:40px; font-size:.85rem; color:#6366f1; }
}