/* ======================================================================
   style.css — סגנונות מותאמים אישית מעבר ל-Tailwind
   shiur.co.il (האתר הפומבי)
   ====================================================================== */

/* ── 1. Base — סגנונות גלובליים ────────────────────────────── */
html { scroll-behavior: smooth; }

body {
    font-family: 'Heebo', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background-color: #f8fafc;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* תיקון עברית: ספרות וסימנים בתוך טקסט עברי */
html[lang="he"] {
    font-feature-settings: "kern", "liga", "calt";
}

/* תיקון יישור צ'ק-בוקסים ו-radio ב-RTL */
input[type="checkbox"],
input[type="radio"] {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* ── 2. Glass Effect — זכוכית הניווט הקבועה ────────────────── */
.glass-effect {
    background: rgba(255, 255, 255, 0.95);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

/* כשהדף נגלל — נוסיף יותר shadow */
.glass-effect.scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

/* ── 3. Hero Background — תמונת רקע parallax ────────────────── */
.hero-bg {
    background-image:
        linear-gradient(to right, rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.75)),
        url('https://images.unsplash.com/photo-1503387762-592deb58ef4e?ixlib=rb-4.0.3&auto=format&fit=crop&w=2000&q=80');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

@media (min-width: 768px) {
    .hero-bg {
        background-attachment: fixed;
    }
}

/* כיבוי parallax ב-prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .hero-bg {
        background-attachment: scroll !important;
    }
    html { scroll-behavior: auto; }
}

/* ── 4. VIP Gradient — בלוק ה-VIP ───────────────────────────── */
.vip-gradient {
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
}

/* ── 5. Card Hover — אנימציית הצף לכרטיסים ──────────────────── */
.card-hover {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-5px);
    box-shadow:
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

/* כיבוי הריחוף ב-reduced motion */
@media (prefers-reduced-motion: reduce) {
    .card-hover {
        transition: none;
    }
    .card-hover:hover {
        transform: none;
    }
}

/* ── 6. Line Clamp — הגבלת מס' שורות בתוכן ──────────────────── */
.line-clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── 7. xs Breakpoint — נקודת שבירה קטנה (Tailwind מתחיל מ-sm=640) ── */
@media (min-width: 480px) {
    .xs\:inline    { display: inline; }
    .xs\:hidden    { display: none; }
    .xs\:block     { display: block; }
}

/* ── 8. Print Styles — הדפסה נקייה (חוסך דיו) ───────────────── */
@media print {
    nav, footer, .glass-effect, .hero-bg::before,
    #pwa-modal, [data-no-print] {
        display: none !important;
    }
    body {
        background: white !important;
        color: black !important;
    }
    a {
        text-decoration: underline;
        color: black !important;
    }
    a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: #555;
    }
    .card-hover, .shadow-xl, .shadow-lg, .shadow-md, .shadow-sm {
        box-shadow: none !important;
    }
}

/* ── 9. Focus Visible — נגישות מקלדת ─────────────────────────── */
:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
    border-radius: 4px;
}

/* ── 10. Selection — צבע סימון טקסט ──────────────────────────── */
::selection {
    background: #2563eb;
    color: white;
}
::-moz-selection {
    background: #2563eb;
    color: white;
}

/* ── 11. Loading Skeleton (לטעינה אסינכרונית עתידית) ─────────── */
.skeleton {
    background: linear-gradient(90deg, #f1f5f9 25%, #e2e8f0 50%, #f1f5f9 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}
@keyframes skeleton-loading {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── 12. Scroll Margin — תיקון anchor links עם nav fixed ─────── */
[id]:not(body) {
    scroll-margin-top: 5rem; /* 80px = h-16 (nav) + buffer */
}

/* ── 12b. Mobile menu open — מסתיר את כפתור הגלילה למעלה ─────── */
body.menu-open #scroll-to-top {
    display: none !important;
}

/* ── 13b. Logo tilt animation (זהה לפורטל הסטודנט ב-portal-app) ── */
@keyframes tilt-hat {
    0%   { transform: rotate(0deg); }
    50%  { transform: rotate(45deg); }
    100% { transform: rotate(0deg); }
}
.animate-tilt-hat {
    animation: tilt-hat 0.35s ease-in-out;
    transform-origin: center center;
    display: inline-block;
}

@media (prefers-reduced-motion: reduce) {
    .animate-tilt-hat { animation: none; }
}

/* ── 13. SR Only utility (Tailwind has it, אבל מחזק כאן) ─────── */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.focus\:not-sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    padding: inherit;
    margin: inherit;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* ── 14. WhatsApp Floating Bubble ───────────────────────────── */
@keyframes floatBubble {
    0% { transform: translateY(-50%); }
    50% { transform: translateY(calc(-50% - 8px)); }
    100% { transform: translateY(-50%); }
}

.wa-chat-bubble {
    position: fixed;
    top: 51%; /* קצת מתחת לאמצע המסך לגובה */
    right: 25px; /* מרוחק מעט מהקיר הימני */
    
    /* התחלה - שקוף ומוקטן */
    transform: translateY(-50%) scale(0.5);
    opacity: 0;
    pointer-events: none;
    
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%); /* רקע ירוק וואטסאפ */
    color: white;
    filter: drop-shadow(0 10px 20px rgba(37, 211, 102, 0.3));
    border-radius: 25px; /* צורת בועה */
    padding: 15px 25px 15px 40px;
    z-index: 99999;
    direction: rtl;
    
    transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.4s ease;
    display: flex;
    align-items: center;
    gap: 15px;
    width: max-content;
    max-width: 300px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
}

.wa-chat-bubble[hidden] {
    display: none !important;
}

.wa-chat-bubble.show {
    transform: translateY(-50%) scale(1);
    opacity: 1;
    pointer-events: auto;
    animation: floatBubble 4s ease-in-out infinite 0.5s;
}

.wa-chat-bubble::after {
    content: '';
    position: absolute;
    right: -12px;
    top: 50%;
    margin-top: -12px;
    border-width: 12px 0 12px 14px;
    border-style: solid;
    border-color: transparent transparent transparent #128C7E; 
}

.wa-chat-bubble:hover {
    filter: drop-shadow(0 15px 25px rgba(37, 211, 102, 0.5));
    background: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
    color: white;
}

.wa-icon-container {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: white;
}

.wa-text-content { display: flex; flex-direction: column; line-height: 1.2; }
.wa-title { font-size: 17px; font-weight: bold; margin-bottom: 3px; }
.wa-subtitle { font-size: 14px; opacity: 0.9; }

.wa-close-btn {
    position: absolute;
    top: 50%;
    left: 10px;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 16px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    z-index: 2;
    padding: 0;
    line-height: 1;
}
.wa-close-btn:hover { background: rgba(255, 255, 255, 0.4); }

@media (max-width: 480px) {
    .wa-chat-bubble { top: auto; bottom: 100px; right: 15px; padding: 12px 20px 12px 35px; transform: scale(0.5); }
    .wa-chat-bubble.show { transform: scale(1); animation: none; }
    .wa-chat-bubble::after { display: none; }
    .wa-title { font-size: 15px; }
    .wa-subtitle { font-size: 13px; }
    .wa-icon-container { width: 38px; height: 38px; }
    .wa-icon-container svg { width: 20px; height: 20px; }
}

@media (prefers-reduced-motion: reduce) {
    .wa-chat-bubble.show { animation: none; }
}
