@import url('https://fonts.googleapis.com/css2?family=Heebo:wght@300;400;500;600;700;800&family=Inter:wght@300;400;500;600;700&display=swap');

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

:root {
  --bg:           #0d1117;
  --bg2:          #161b22;
  --bg3:          #1c2333;
  --card-bg:      #161b22;
  --border:       rgba(255,255,255,0.08);
  --text:         #e6edf3;
  --text-muted:   #8b949e;
  --accent:       #f0a500;
  --accent2:      #e8844a;
  --primary:      #238636;
  --primary-h:    #2ea043;
  --gold:         #d4a017;
  --radius:       14px;
  --shadow:       0 4px 20px rgba(0,0,0,0.4);
  --shadow-h:     0 12px 40px rgba(0,0,0,0.6);
}

html[dir="rtl"] body { font-family: 'Heebo', sans-serif; }
html[dir="ltr"] body { font-family: 'Inter', sans-serif; }
body { background: var(--bg); color: var(--text); min-height: 100vh; line-height: 1.6; }

/* ===== HEADER ===== */
header {
  background: rgba(13,17,23,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
}
.header-inner {
  max-width: 1280px; margin: 0 auto;
  padding: 10px 24px;
  display: flex; align-items: center; gap: 14px;
}
.header-left   { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.header-center { flex: 1; }
.header-right  { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Phone */
.phone-link {
  color: var(--text-muted); font-size: 0.82rem; text-decoration: none;
  display: flex; align-items: center; gap: 5px; white-space: nowrap;
  transition: color 0.2s;
}
.phone-link:hover { color: var(--text); }

/* Lang button */
.lang-btn {
  background: var(--accent); color: #000;
  border: none; padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 0.82rem; font-weight: 700;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
}
.lang-btn:hover { background: #ffc62d; transform: translateY(-1px); }

/* Cart */
.cart-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 6px 14px; border-radius: 6px;
  cursor: pointer; font-size: 0.82rem; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: background 0.2s; white-space: nowrap;
}
.cart-btn:hover { background: var(--bg2); }

/* Currency toggle */
.currency-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
}
.cur-btn {
  background: transparent; color: var(--text-muted);
  border: none; padding: 6px 10px; cursor: pointer;
  font-size: 0.8rem; font-weight: 600; transition: all 0.2s;
}
.cur-btn.active { background: var(--accent); color: #000; }

/* Search */
.search-wrap { position: relative; }
.search-input {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); padding: 8px 16px 8px 40px;
  border-radius: 8px; font-size: 0.9rem; outline: none;
  transition: border-color 0.2s;
}
html[dir="rtl"] .search-input { padding: 8px 40px 8px 16px; }
.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { border-color: var(--accent); }
.search-icon {
  position: absolute; top: 50%; transform: translateY(-50%);
  right: 12px; color: var(--text-muted); font-size: 0.9rem; pointer-events: none;
}
html[dir="rtl"] .search-icon { right: auto; left: 12px; }

/* Brand in header */
.header-brand {
  display: flex; align-items: center; gap: 8px;
}
.brand-icon { font-size: 1.5rem; flex-shrink: 0; }
.brand-text {
  display: flex; flex-direction: column; line-height: 1.25;
}
.brand-title {
  font-size: 1.05rem; font-weight: 800; color: var(--text);
  white-space: nowrap;
}
.brand-accent { color: var(--accent); }
.brand-author {
  font-size: 0.72rem; color: var(--text-muted);
}
.brand-contact {
  color: var(--text-muted); text-decoration: none;
  transition: color 0.2s;
}
.brand-contact:hover { color: var(--accent); }

/* ===== HERO ===== */
.hero {
  background: #0d1117;
  text-align: center; padding: 10px 24px;
  border-bottom: 1px solid var(--border);
}
.hero-meta { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.hero-meta strong { color: var(--accent); }
#cart-min-notice {
  margin: 10px 16px 0;
  padding: 9px 14px;
  background: rgba(240,165,0,0.1);
  border: 1px solid rgba(240,165,0,0.4);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--accent);
  text-align: center;
}
.ai-notice {
  margin-top: 14px;
  display: inline-block;
  background: rgba(240,165,0,0.1);
  border: 1px solid rgba(240,165,0,0.35);
  border-radius: 20px;
  padding: 7px 18px;
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.02em;
}

/* ===== BANNERS ROW ===== */
.banners-row {
  display: flex;
  padding: 0 18px 4px;
}
.banners-row > div { flex: 1; }
@media (max-width: 700px) {
  .banners-row { flex-direction: column; }
}

/* ===== SERVICE BANNERS ===== */
.svc-banner {
  border-radius: 10px;
  margin: 6px;
  padding: 10px 16px;
}
.svc-banner--book {
  background: linear-gradient(135deg, #1a2540 0%, #0f1b2d 50%, #1a2235 100%);
  border: 1px solid rgba(240,165,0,0.35);
}
.svc-banner--ai {
  background: linear-gradient(135deg, #1a2035 0%, #0f1d1a 50%, #1a2035 100%);
  border: 1px solid rgba(37,211,102,0.35);
}
.svc-inner {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; text-align: center;
}
.svc-row1 {
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.svc-icon { font-size: 1.1rem; }
.svc-title {
  font-size: 0.9rem; font-weight: 800; color: var(--accent);
  white-space: nowrap;
}
.svc-features {
  list-style: none; padding: 0;
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.svc-features li { font-size: 0.82rem; color: var(--text); white-space: nowrap; }
.svc-cta {
  display: flex; align-items: center; justify-content: center; gap: 10px;
}
.svc-price-label {
  font-size: 0.82rem; color: var(--text-muted); white-space: nowrap;
}
.svc-price-label strong { color: var(--accent); }
.svc-btn {
  display: inline-flex; align-items: center; gap: 4px;
  color: #fff; padding: 3px 10px; border-radius: 5px;
  text-decoration: none; font-size: 0.75rem; font-weight: 700;
  transition: opacity 0.2s, transform 0.15s; white-space: nowrap;
}
.svc-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.svc-btn svg { width: 13px; height: 13px; fill: #fff; flex-shrink: 0; }
.svc-btn--book    { background: #1a6e3c; }
.svc-btn--courses { background: #1a6e3c; }
.svc-btn--ai      { background: #1a6e3c; }

.svc-banner--courses {
  background: linear-gradient(135deg, #1e1a40 0%, #130f2d 50%, #1e1a40 100%);
  border: 1px solid rgba(130,100,255,0.35);
}

html[dir="ltr"] .svc-title { font-size: 0.78rem; }
html[dir="ltr"] .svc-features li { font-size: 0.72rem; }

@media (max-width: 700px) {
  .svc-features { display: none; }
}

/* ===== MAIN ===== */
main { max-width: 1280px; margin: 0 auto; padding: 32px 24px 60px; }

/* ===== FILTERS ===== */
.filters {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: center; margin-bottom: 32px;
}
.filter-btn {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text-muted); padding: 7px 16px; border-radius: 50px;
  cursor: pointer; font-size: 0.85rem; font-weight: 500;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.2s; white-space: nowrap;
}
.filter-btn:hover { border-color: var(--accent); color: var(--text); }
.filter-btn.active {
  background: var(--accent); color: #000;
  border-color: var(--accent); font-weight: 700;
}
.filter-btn--tech {
  border-color: rgba(96,165,250,0.4);
  color: #60a5fa;
}
.filter-btn--tech:hover { border-color: #60a5fa; color: #93c5fd; }
.filter-btn--tech.active { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.filter-count {
  background: rgba(0,0,0,0.2); border-radius: 50px;
  padding: 1px 7px; font-size: 0.75rem;
}
.filter-btn.active .filter-count { background: rgba(0,0,0,0.25); }

/* ===== BOOKS GRID ===== */
.books-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
}
@media (max-width: 1100px) { .books-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 860px)  { .books-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 600px)  { .books-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; } }
@media (max-width: 400px)  { .books-grid { grid-template-columns: 1fr; } }

/* ===== BOOK CARD ===== */
.book-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  cursor: pointer;
  position: relative;
}
.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-h);
  border-color: rgba(240,165,0,0.4);
}

/* Cover */
.card-cover {
  position: relative; aspect-ratio: 3/4; overflow: hidden;
  background: var(--bg3);
}
.card-cover img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.4s ease;
}
.book-card:hover .card-cover img { transform: scale(1.05); }

/* Badge */
.badge-new {
  position: absolute; top: 10px;
  background: var(--accent); color: #000;
  font-size: 0.7rem; font-weight: 800;
  padding: 3px 9px; border-radius: 4px; z-index: 2;
}
html[dir="rtl"] .badge-new { right: 10px; }
html[dir="ltr"] .badge-new { left: 10px; }

/* Overlay on cover */
.card-overlay {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(0deg, rgba(0,0,0,0.88) 0%, rgba(0,0,0,0.5) 60%, transparent 100%);
  padding: 32px 12px 12px;
}
.card-title {
  font-size: 0.88rem; font-weight: 700; color: #fff;
  line-height: 1.4; margin-bottom: 4px;
  word-break: keep-all;
}
.card-author {
  font-size: 0.72rem; color: rgba(255,255,255,0.7);
  display: flex; align-items: center; gap: 4px;
}
.card-author-icon { font-size: 0.7rem; }

/* Detail panel (collapsed by default) */
.card-detail {
  max-height: 0; overflow: hidden;
  transition: max-height 0.35s ease, padding 0.2s;
  padding: 0 14px;
  font-size: 0.8rem; color: var(--text-muted); line-height: 1.6;
}
.card-detail.open {
  max-height: 180px;
  overflow-y: auto;
  padding: 12px 14px 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) transparent;
}
.card-detail.open::-webkit-scrollbar { width: 4px; }
.card-detail.open::-webkit-scrollbar-track { background: transparent; }
.card-detail.open::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

/* Footer */
.card-footer {
  padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; border-top: 1px solid var(--border); margin-top: auto;
}
.card-price-wrap { display: flex; flex-direction: column; line-height: 1.2; }
.card-price-main { font-size: 1.1rem; font-weight: 800; color: var(--accent); }
.card-price-sub  { font-size: 0.68rem; color: var(--text-muted); }

.add-btn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #000; border: none; padding: 8px 14px;
  border-radius: 8px; cursor: pointer;
  font-size: 0.82rem; font-weight: 700;
  display: flex; align-items: center; gap: 5px;
  transition: opacity 0.2s, transform 0.15s;
  white-space: nowrap; text-decoration: none;
}
.add-btn:hover { opacity: 0.9; transform: translateY(-1px); }

/* Detail toggle btn */
.detail-toggle {
  width: 100%; background: transparent; border: none;
  border-top: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.75rem;
  padding: 7px; cursor: pointer; text-align: center;
  transition: color 0.2s, background 0.2s;
}
.detail-toggle:hover { color: var(--text); background: rgba(255,255,255,0.03); }

/* ===== ADD BUTTON — IN CART STATE ===== */
.add-btn.in-cart {
  background: linear-gradient(135deg, #2ea043, #1a7a30);
  color: #fff;
}
.book-card.in-cart {
  border-color: rgba(46,160,67,0.5);
  box-shadow: 0 0 0 2px rgba(46,160,67,0.25);
}

/* ===== CART BADGE on header button ===== */
.cart-badge {
  background: var(--accent); color: #000;
  font-size: 0.7rem; font-weight: 800;
  border-radius: 50%; width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-inline-start: 2px;
}

/* ===== CART SIDEBAR ===== */
.cart-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(4px);
}
.cart-overlay.open { display: block; }

.cart-sidebar {
  position: fixed; top: 0; bottom: 0;
  width: min(420px, 100vw);
  background: var(--bg2);
  border-inline-start: 1px solid var(--border);
  display: flex; flex-direction: column;
  z-index: 501;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  box-shadow: -8px 0 40px rgba(0,0,0,0.5);
}
html[dir="rtl"] .cart-sidebar { right: 0; left: auto; transform: translateX(100%); }
html[dir="ltr"] .cart-sidebar { left: 0; right: auto; transform: translateX(-100%); }
.cart-sidebar.open {
  transform: translateX(0) !important;
}

.cart-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.cart-header h3 { font-size: 1.1rem; font-weight: 700; }
.cart-close {
  background: transparent; border: none; color: var(--text-muted);
  font-size: 1.4rem; cursor: pointer; line-height: 1;
  transition: color 0.2s;
}
.cart-close:hover { color: var(--text); }

.cart-items {
  flex: 1; overflow-y: auto; padding: 12px 0;
  scrollbar-width: thin; scrollbar-color: var(--accent) transparent;
}
.cart-items::-webkit-scrollbar { width: 4px; }
.cart-items::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 4px; }

.cart-empty {
  text-align: center; padding: 60px 20px;
  color: var(--text-muted); font-size: 0.95rem;
}
.cart-empty .cart-empty-icon { font-size: 3rem; margin-bottom: 12px; }

.cart-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.cart-item:hover { background: rgba(255,255,255,0.03); }
.cart-item-img {
  width: 48px; height: 64px; object-fit: cover;
  border-radius: 6px; flex-shrink: 0;
  background: var(--bg3);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-title {
  font-size: 0.82rem; font-weight: 600;
  line-height: 1.4; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden;
}
.cart-item-price { font-size: 0.8rem; color: var(--accent); font-weight: 700; margin-top: 3px; }
.cart-item-remove {
  background: transparent; border: none;
  color: var(--text-muted); font-size: 1.1rem;
  cursor: pointer; flex-shrink: 0; padding: 4px;
  transition: color 0.2s;
}
.cart-item-remove:hover { color: #e96c6c; }

.cart-footer {
  padding: 18px 20px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}
.cart-total {
  display: flex; justify-content: space-between; align-items: center;
}
.cart-total-label { font-size: 0.9rem; color: var(--text-muted); }
.cart-total-price { font-size: 1.3rem; font-weight: 800; color: var(--accent); }
.cart-checkout-btn {
  background: var(--whatsapp); color: white;
  border: none; padding: 13px; border-radius: 10px;
  cursor: pointer; font-size: 1rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: background 0.2s, transform 0.15s;
  text-decoration: none;
}
.cart-checkout-btn:hover { background: var(--whatsapp-hover); transform: translateY(-1px); }
.cart-checkout-btn svg { width: 20px; height: 20px; fill: white; flex-shrink: 0; }

/* ===== NO RESULTS ===== */
.no-results {
  grid-column: 1/-1; text-align: center;
  color: var(--text-muted); padding: 60px 0; font-size: 1.1rem;
}

/* ===== FOOTER ===== */
footer {
  background: var(--bg2); border-top: 1px solid var(--border);
  text-align: center; padding: 24px;
  font-size: 0.82rem; color: var(--text-muted);
}
footer strong { color: var(--accent); }

/* ===== RESPONSIVE header ===== */
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; }
  .header-center { order: 3; width: 100%; }
  .phone-link { display: none; }
  .hero h1 { font-size: 1.7rem; }
}
