/* הגדרות בסיסיות ופונטים */
:root {
    --bg-dark: #0f172a;
    --panel-bg: #1e293b;
    --accent-blue: #3b82f6;
    --accent-hover: #2563eb;
    --text-slate: #94a3b8;
    --border-color: rgba(255, 255, 255, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.03);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Assistant', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: #f1f5f9;
    line-height: 1.5;
    overflow-x: hidden;
}

#bg-video {
    position: fixed;
    right: 0;
    bottom: 0;
    min-width: 100%;
    min-height: 100%;
    z-index: -1; /* מאחורי הכל */
    object-fit: cover;
    filter: brightness(0.4); /* מכהה מעט את הרקע כדי שהטקסט יהיה קריא */
}

/* מוודא שהתוכן הראשי צף מעל הרקע */
#main-content {
    position: relative;
    z-index: 1;
    background: transparent; /* חשוב כדי לראות את הרקע */
}

/* חלונית הלוגין צריכה רקע כהה/מטושטש משלה */
#login-overlay {
    backdrop-filter: blur(15px); /* אפקט טשטוש יפה לרקע כשהלוגין פתוח */
    background-color: rgba(2, 6, 23, 0.8); /* צבע כהה שקוף */
}

/* עיצוב כרטיסיות הסטטיסטיקה - תיקון רספונסיבי גורף */
.stat-card {
    background: var(--glass-bg);
    border: 1px solid var(--border-color);
    padding: 1.25rem 0.75rem;
    border-radius: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: all 0.3s ease;
}

/* ניווט ב-Sidebar */
.nav-link {
    display: flex;
    align-items: flex-start;
    padding: 1rem 1.25rem;
    border-radius: 1rem;
    color: var(--text-slate);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    margin-bottom: 0.5rem;
}

.nav-link.active-tab {
    background: linear-gradient(135deg, var(--accent-blue), #1d4ed8);
    color: white !important;
}

.active-tab {
    border-color: rgba(59, 130, 246, 0.5) !important;
    background: rgba(59, 130, 246, 0.1) !important;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
    transform: translateY(-2px);
}

#sidebar {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

#sidebar.sidebar-closed {
    width: 0 !important;
    transform: translateX(100%) !important;
}

.sidebar-content {
    width: 320px;
    height: 100%;
    overflow: hidden;
}

/* וידאו וקונטיינר */
.video-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.background-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block !important;
}

.partner-media {
    position: relative;
    background: #0f172a;
    overflow: hidden;
}

.partner-media--logo {
    isolation: isolate;
}

.partner-video-fallback {
    position: absolute;
    inset: 0;
    z-index: 0;
    opacity: 1;
    pointer-events: none;
    background:
        radial-gradient(circle at 30% 20%, rgba(59, 130, 246, 0.45), transparent 50%),
        radial-gradient(circle at 70% 80%, rgba(14, 165, 233, 0.35), transparent 45%),
        linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
    background-size: 200% 200%;
    animation: partner-gradient 8s ease-in-out infinite;
}

.partner-media--fallback .partner-video {
    display: none;
}

.partner-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
    display: block;
}

@keyframes partner-gradient {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

header {
    position: relative;
    background: transparent !important;
}

/* --- תיקוני תוכן רספונסיבי (Main Content) --- */

#main-content {
    width: 100%;
    max-width: 100vw;
}

#content-area {
    width: 100%;
    padding-bottom: 50px;
}

/* כפיית גריד רספונסיבי על כרטיסיות הסטטיסטיקה בתוך הפרויקט */
#content-area .grid-cols-5, 
#content-area .grid-cols-4 {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important; /* 2 בשורה במובייל */
    gap: 12px !important;
}

/* כפיית טור אחד על אזורי מידע (ניהול סיכונים/מתחרים) */
#content-area .grid-cols-2 {
    display: grid !important;
    grid-template-columns: 1fr !important; /* טור אחד במובייל */
    gap: 20px !important;
}
button#btn-lazy {
    margin-top: 5px;
}
/* התאמה למובייל (מסכים קטנים מ-768px) */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    .mb-66 {
        padding:5px !important;
    }

    .flex.items-center.gap-4.mb-4 {
        margin: 0 auto;
    }
   
    #sidebar {
        width: 100% !important;
        height: auto !important;
        position: relative !important;
        transform: none !important;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }

    #nav-menu {
        display: flex;
        overflow-x: auto;
        gap: 8px;
        padding: 10px;
        -webkit-overflow-scrolling: touch;
    }

    .nav-link {
        min-width: 150px;
        margin-bottom: 0;
        flex-shrink: 0;
    }

    .glass-footer {
        position: relative !important; /* מבטל את הציפה */
        bottom: auto !important;
        left: auto !important;
        width: 100% !important;
        margin-top: 2rem; /* רווח מהתוכן */
        padding: 20px !important;
        background: rgba(30, 41, 59, 0.5); /* שקיפות עדינה יותר */
        backdrop-filter: none;
    }

    .glass-footer .flex {
        flex-direction: column; /* שווי מעל התנתקות */
        gap: 15px;
        align-items: center;
    }

    /* תיקון רוחב ה-Main Content כדי לאפשר גלילה חלקה */
    #main-content {
        height: auto !important;
        overflow-y: visible !important;
    }

    header h2 {
        font-size: 1.6rem !important;
        text-align: center;
    }

    /* ביטול רוחב קבוע שעלול להגיע מ-Tailwind */
    .max-w-6xl, .max-w-4xl {
        max-width: 100% !important;
    }
    #sidebar .glass-footer, 
    #sidebar #total-portfolio-value,
    #sidebar button[onclick="logoutUser()"] {
        display: none !important;
    }
}

/* החזרת תצוגת גריד רחבה למחשב בלבד */
@media (min-width: 1024px) {
    #content-area .grid-cols-5 {
        grid-template-columns: repeat(5, 1fr) !important;
    }
    #content-area .grid-cols-4 {
        grid-template-columns: repeat(4, 1fr) !important;
    }
    #content-area .grid-cols-2 {
        grid-template-columns: 1fr 1fr !important;
    }
}

/* אלמנטים נוספים */
.glass-footer {
    background: rgba(30, 41, 59, 0.8);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border-color);
}

.flagship-item {
    border: 1px solid rgba(234, 179, 8, 0.5) !important;
    background: linear-gradient(90deg, rgba(234, 179, 8, 0.1), rgba(30, 41, 59, 0.5)) !important;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 10px; }