*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: #0e1f3d; }
::-webkit-scrollbar-thumb { background: #d4af37; border-radius: 2px; }

body {
  font-family: 'Heebo', 'Frank Ruhl Libre', serif;
  background: #0a1628;
  min-height: 100vh;
  color: #e8f0ff;
  direction: rtl;
}

/* HEADER */
.header { background: #071020; border-bottom: 1px solid #1e3560; padding: 0 24px; }
.header-inner { max-width: 1100px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo-wrap { display: flex; align-items: center; height: 100%; padding: 8px 0; }
.logo-wrap img { height: 100%; object-fit: contain; }
.live-badge { display: flex; align-items: center; gap: 8px; }
.pulse-dot { width: 8px; height: 8px; background: #4caf7d; border-radius: 50%; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(76,175,125,0.4); } 50% { box-shadow: 0 0 0 6px rgba(76,175,125,0); } }
.live-text { font-size: 13px; color: #4caf7d; font-weight: 500; }

/* TABS - 2 שורות */
.tabs-bar { background: #071020; border-bottom: 1px solid #1e3560; padding: 0 24px; }
.tabs-inner { 
    max-width: 1100px; 
    margin: 0 auto; 
    display: flex; 
    flex-wrap: wrap; 
    justify-content: center; 
    gap: 8px; 
    padding: 12px 0; 
}
.tab-btn { 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 12px 10px; 
    font-family: inherit; 
    font-size: 14px; 
    font-weight: 500; 
    color: #ffffff; /* שונה ללבן */
    border-bottom: 2px solid transparent; 
    transition: all 0.2s; 
    flex: 1 1 45%; 
    max-width: 220px; 
    text-align: center;
}
.tab-btn.active { color: #d4af37; border-bottom-color: #d4af37; }
.tab-btn:hover { color: #e8f0ff; }
.admin-login-btn { 
    background: none; 
    border: 1px solid #1e3560; 
    border-radius: 4px; 
    color: #ffffff; 
    font-family: inherit; 
    font-size: 13px; 
    padding: 6px 14px; 
    cursor: pointer; 
    transition: all 0.2s; 
    white-space: nowrap; 
    margin-top: 8px; 
    width: 100%; 
    max-width: 200px;
}
.admin-login-btn:hover { border-color: #d4af37; color: #d4af37; }

/* MAIN GRID */
.main { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.campaign-grid { display: grid; grid-template-columns: 1fr 380px; gap: 28px; align-items: start; }
.section-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #ffffff; font-weight: 600; margin-bottom: 12px; }
.campaign-badge { font-size: 11px; color: #d4af37; letter-spacing: 3px; font-weight: 600; margin-bottom: 10px; }
.campaign-title { font-family: 'Frank Ruhl Libre', serif; font-size: 38px; font-weight: 900; line-height: 1.2; color: #e8f0ff; margin-bottom: 12px; }
.campaign-title span { color: #d4af37; }
.campaign-desc { color: #e8f0ff; font-size: 16px; line-height: 1.7; font-weight: 400; }

/* PROGRESS CARDS */
.card { background: #0e1f3d; border: 1px solid #1e3560; border-radius: 8px; padding: 24px; margin-bottom: 20px; }
.progress-top { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; }
.total-raised { font-size: 36px; font-weight: 900; color: #d4af37; font-family: 'Frank Ruhl Libre', serif; }
.total-label { font-size: 18px; color: #e8f0ff; margin-top: 8px; }
#goalLabel { font-size: 26px; font-weight: 900; color: #ffd700; background: rgba(255, 215, 0, 0.1); padding: 2px 10px; border-radius: 6px; border: 1px solid rgba(255, 215, 0, 0.3); }
.percent-num { font-size: 28px; font-weight: 900; color: #e8f0ff; }
.percent-label { font-size: 13px; color: #c8d8f0; } /* הבהרה */
.progress-track { height: 12px; background: #1a3060; border-radius: 100px; overflow: hidden; margin-bottom: 16px; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #b8860b, #d4af37, #f0d060, #d4af37, #b8860b); background-size: 200% 100%; border-radius: 100px; animation: shimmer 2.5s infinite; transition: width 1.2s cubic-bezier(0.4,0,0.2,1); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.stats-row { display: flex; gap: 24px; }
.stat-item { display: flex; align-items: center; gap: 8px; }
.stat-num { font-size: 22px; font-weight: 700; color: #e8f0ff; }
.stat-lbl { font-size: 13px; color: #c8d8f0; } /* הבהרה */
.stat-div { width: 1px; background: #1e3560; }

/* FLIPBOOK CONTAINER SYSTEM */
.book-wrapper { position: relative; width: 100%; margin-bottom: 24px; background: #071020; border: 1px solid #1e3560; border-radius: 12px; overflow: hidden; box-shadow: 0 12px 32px rgba(0,0,0,0.5); }
.book-container { width: 100%; height: 700px; display: flex; position: relative; }
.book-page { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity 0.4s ease, visibility 0.4s ease; display: flex; align-items: center; justify-content: center; background: #071020; }
.book-page.page-active { opacity: 1; visibility: visible; }
.book-page img { width: 100%; height: 100%; object-fit: contain; }
.book-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(212,175,55,0.85); border: none; color: #0a1628; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; font-weight: 900; z-index: 5; box-shadow: 0 4px 10px rgba(0,0,0,0.3); transition: transform 0.2s; }
.book-nav:hover { transform: translateY(-50%) scale(1.05); }
.prev-btn { right: 16px; }
.next-btn { left: 16px; }
.book-indicator { text-align: center; padding: 10px; background: #0e1f3d; font-size: 13px; color: #ffffff; border-top: 1px solid #1e3560; font-weight: 500; }

/* FORM ELEMENTS */
.form-card { background: #0e1f3d; border: 1px solid #1e3560; border-radius: 10px; overflow: hidden; position: sticky; top: 24px; }
.multiplier-banner { background: linear-gradient(135deg, #1a2a0a, #2a3a10); padding: 12px 20px; border-bottom: 1px solid #4a5a20; display: flex; align-items: center; gap: 10px; }
.multiplier-title { font-weight: 700; font-size: 14px; color: #d4af37; display: flex; align-items: center; gap: 8px; }
.multiplier-badge { background: linear-gradient(135deg, #ff6b35, #d4af37); color: #0a1628; font-weight: 900; border-radius: 4px; padding: 2px 8px; font-size: 13px; }
.multiplier-sub { font-size: 12px; color: #6a7a30; margin-top: 2px; }
.form-body { padding: 24px; }
.amounts-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 12px; }
.amount-chip { border: 1px solid #1e3560; background: none; color: #ffffff; font-family: inherit; font-size: 15px; padding: 10px 8px; border-radius: 4px; cursor: pointer; transition: all 0.2s; }
.amount-chip.selected { border-color: #d4af37; background: rgba(212,175,55,0.12); color: #d4af37; font-weight: 700; }
.form-input { background: #0e1f3d; border: 1px solid #1e3560; border-radius: 4px; color: #e8f0ff; font-family: inherit; font-size: 15px; padding: 12px 14px; width: 100%; outline: none; margin-bottom: 10px; }
.form-input:focus { border-color: #d4af37; }
.multiplier-preview { background: rgba(212,175,55,0.08); border: 1px solid rgba(212,175,55,0.2); border-radius: 6px; padding: 10px 14px; margin-bottom: 20px; text-align: center; font-size: 13px; color: #d4af37; }
.anon-label { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 20px; font-size: 14px; color: #ffffff; }
.payment-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.pay-type-btn { flex: 1; border: 1px solid #1e3560; background: none; color: #ffffff; font-family: inherit; font-size: 14px; padding: 10px; border-radius: 4px; cursor: pointer; }
.pay-type-btn.active { border-color: #d4af37; background: rgba(212,175,55,0.12); color: #d4af37; font-weight: 700; }
.donate-btn { background: linear-gradient(135deg, #d4af37, #b8860b); border: none; color: #0a1628; font-family: inherit; font-weight: 900; font-size: 18px; padding: 16px 40px; border-radius: 4px; cursor: pointer; width: 100%; box-shadow: 0 4px 20px rgba(212,175,55,0.35); transition: all 0.2s; }
.donate-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 30px rgba(212,175,55,0.55); }

/* QR CODE FIX */
.qr-code-box { text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #1e3560; }
.qr-code-box img { max-width: 140px; height: auto; object-fit: contain; border-radius: 8px; border: 2px solid #d4af37; margin: 0 auto; display: block; }

/* LIVE FEED ELEMENT STYLE */
.feed-header { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.feed-title { font-size: 13px; font-weight: 600; color: #4caf7d; }
.feed-list { max-height: 320px; overflow-y: auto; }
.feed-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #112040; animation: slideIn 0.5s ease; }
@keyframes slideIn { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }
.feed-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700; flex-shrink: 0; }
.feed-avatar.named { background: rgba(212,175,55,0.15); color: #d4af37; }
.feed-avatar.anon { background: #112040; color: #2a4a70; }
.feed-info { flex: 1; min-width: 0; }
.feed-name { font-weight: 600; font-size: 14px; color: #c8d8f0; display: flex; align-items: center; gap: 6px; }
.new-badge { font-size: 10px; background: #0e2a1a; color: #4caf7d; padding: 1px 6px; border-radius: 10px; font-weight: 600; }
.feed-msg { font-size: 12px; color: #c8d8f0; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-overflow: ellipsis; }
.feed-amount { font-weight: 700; color: #d4af37; font-size: 15px; text-align: left; flex-shrink: 0; }
.feed-time { font-size: 11px; color: #2a4a70; }

/* TABLES & DASHBOARD */
.dash-grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 28px; }
.stat-card { background: #0e1f3d; border: 1px solid #1e3560; border-radius: 8px; padding: 20px; }
.stat-card-num { font-size: 30px; font-weight: 900; font-family: 'Frank Ruhl Libre', serif; }
.stat-card-sub { font-size: 12px; color: #c8d8f0; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; }
th { text-align: right; padding: 8px 0; border-bottom: 1px solid #1e3560; font-size: 11px; color: #c8d8f0; letter-spacing: 1px; font-weight: 600; }
td { padding: 10px 0; font-size: 14px; border-bottom: 1px solid #112040; }
.status-ok { background: #0e2a1a; color: #4caf7d; font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }

/* AMBASSADORS SECTION */
.amb-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; margin-bottom: 28px; }
.amb-card { background: #0e1f3d; border: 1px solid #1e3560; border-radius: 8px; padding: 20px; position: relative; overflow: hidden; }
.amb-accent { position: absolute; top: 0; right: 0; width: 4px; bottom: 0; }
.amb-top { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.amb-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; }
.amb-name { font-weight: 700; font-size: 16px; color: #e8f0ff; }
.amb-raised { font-weight: 900; font-size: 20px; font-family: 'Frank Ruhl Libre', serif; }
.amb-track { height: 8px; background: #1a3060; border-radius: 100px; overflow: hidden; }
.amb-fill { height: 100%; border-radius: 100px; }
.add-amb-btn { background: linear-gradient(135deg,#d4af37,#b8860b); border: none; color: #0a1628; font-family: inherit; font-weight: 700; font-size: 14px; padding: 12px 24px; border-radius: 4px; cursor: pointer; }

/* MODALS LAYOUTS */
#adminLoginModal, #adminPanelModal, #ambModal { display:none; position:fixed; inset:0; background:rgba(0,0,0,0.8); z-index:3000; align-items:center; justify-content:center; }
.toast { position: fixed; top: 24px; left: 50%; transform: translateX(-50%); background: #0e2a1a; border: 1px solid #4caf7d; color: #7ee8a2; padding: 16px 28px; border-radius: 8px; z-index: 4000; font-weight: 600; font-size: 16px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); animation: toastIn 0.3s ease; display: none; }
.toast.show { display: block; }
@keyframes toastIn { from { opacity:0; transform: translateX(-50%) translateY(-20px); } to { opacity:1; transform: translateX(-50%) translateY(0); } }

/* TAB PANELS HIDDEN DEFAULTS */
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* מבנה קהילה מסודר והקלאסים הישנים */
.community-top-grid { display: grid; grid-template-columns: 1fr 340px; gap: 28px; align-items: start; margin-bottom: 32px; }
.community-cards-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.book-poster-wrap { max-width: 450px; margin: 0 auto; }

/* --- ניהול תצוגת חוברות (מחשב מול מובייל) --- */
.desktop-book { display: block !important; }
.mobile-book { display: none !important; }

/* כל הקלאסים לחוברות שמוסתרים או מוצגים */
.desktop-page, .mobile-page, .camp-page, .comm-desktop-page, .comm-mobile-page {
    display: none !important;
}
.desktop-page.page-active, .mobile-page.page-active, .page-active {
    display: block !important;
}

/* --- סליידר תמונות קהילה --- */
.photo-slider { width: 100%; height: 250px; overflow: hidden; position: relative; background: #0e1f3d; border-radius: 10px; border: 1px solid #1e3560; margin-bottom: 32px; direction: ltr; }
.slide-track { display: flex; width: max-content; height: 100%; animation: scroll 20s linear infinite; }
.slide-track:hover { animation-play-state: paused; }
.slide { width: 300px; height: 100%; object-fit: cover; border-right: 2px solid #0a1628; }

@keyframes scroll {
    0% { transform: translateX(0); }
    100% { transform: translateX(-50%); }
}

/* הגדרות לטלפון בלבד */
@media (max-width: 768px) {
  /* סידור הגריד המרכזי לעמודה אחת */
  .campaign-grid { grid-template-columns: 1fr; }
  .dash-grid-4 { grid-template-columns: repeat(2,1fr); }
  .amb-grid { grid-template-columns: 1fr; }
  
  /* סידור הגריד של הקהילה למובייל */
  .community-top-grid { grid-template-columns: 1fr; }
  .community-cards-grid { grid-template-columns: 1fr; }
  .community-top-grid > div:last-child { order: -1; margin-bottom: 16px; }

  /* --- הטאבים העליונים במובייל מתנהגים בצורה דומה (2 בשורה) --- */
  .tabs-inner {
    flex-wrap: wrap !important; 
    overflow-x: visible !important; 
    white-space: normal !important; 
    justify-content: center !important; 
    gap: 12px;
    padding: 12px 0;
  }
  .tab-btn {
    font-size: 14px;
    padding: 12px 8px;
    flex: 1 1 45%;
  }

  /* --- תיקון תמונת הרב והטקסט --- */
  div[style*="display: flex; gap: 24px; align-items: flex-start;"] {
    flex-direction: column !important;
    align-items: center !important;
    text-align: center !important;
  }
  .campaign-title { font-size: 32px !important; }
  div[style*="flex-shrink: 0;"] {
    width: 100% !important;
    margin-bottom: 16px;
  }
  div[style*="flex-shrink: 0;"] img {
    margin: 0 auto !important;
  }

  /* --- תיקון החוברת הדיגיטלית למובייל --- */
  .desktop-book { display: none !important; }
  .mobile-book { display: block !important; }
  
  .book-container, .mobile-book .book-container { 
    height: 130vw !important; 
    min-height: 400px;
    max-height: 600px;
  }
  
  /* הקטנת כפתורי החצים במסך קטן */
  .book-nav {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  /* תיקון רוחב סליידר תמונות למובייל */
  .photo-slider { height: 200px; }
  .slide { width: 240px; }
}

/* ============================ */
/* BOOKS TAB SECTION */
/* ============================ */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}
.book-card {
  padding: 0 !important; /* דורס את הפדינג של ה-card הרגיל */
  display: flex;
  flex-direction: column;
  height: 100%;
}
.book-cover {
  background: #071020;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #1e3560;
  padding: 16px;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.book-cover img {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  box-shadow: 0 4px 15px rgba(0,0,0,0.5);
  border: 1px solid #1e3560;
}
.book-info {
  padding: 16px;
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}
.book-title {
  font-weight: 700;
  font-size: 18px;
  color: #e8f0ff;
  margin-bottom: 6px;
}
.book-topics {
  font-size: 13px;
  color: #c8d8f0;
  line-height: 1.6;
}