/**
 * Mindflix Viewed & Suggested Posts CSS
 *
 * Includes full RTL support and responsive design
 * for both full and minimal post display styles.
 */

/* ==========================================================================
   Base Styles
   ========================================================================== */

.mindflix-viewed-posts,
.mindflix-suggested-posts {
    direction: rtl;
    text-align: right;
    margin: 20px 0 40px 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    display: none; /* הסתר בהתחלה עד שה-JavaScript בודק */
}

/* הצג רק אם יש תוכן */
.mindflix-viewed-posts.mindflix-has-content,
.mindflix-suggested-posts.mindflix-has-content {
    display: block;
}

.mindflix-title {
    font-size: 1.5em;
    font-weight: 600;
    margin: 0 0 15px 0;
    color: #333;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 8px;
}

.mindflix-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
}

.mindflix-no-posts,
.mindflix-error {
    text-align: center;
    padding: 20px;
    color: #666;
    font-style: italic;
    background: #f9f9f9;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.mindflix-error {
    color: #d63638;
    background: #fef7f7;
    border-color: #d63638;
}

/* ==========================================================================
   Full Style Layout
   ========================================================================== */

.mindflix-posts-full {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 15px;
}

/* הגבלת רוחב לפוסט יחיד */
.mindflix-posts-full .mindflix-post-full:only-child {
    max-width: 400px;
    justify-self: start;
}

/* הגבלת רוחב לשני פוסטים */
.mindflix-posts-full .mindflix-post-full:nth-child(2):last-child,
.mindflix-posts-full .mindflix-post-full:first-child:nth-last-child(2) {
    max-width: 400px;
}

.mindflix-post-full {
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.mindflix-post-full:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border-color: #0073aa;
}

.mindflix-post-full .mindflix-post-link {
    display: block;
    text-decoration: none;
    color: inherit;
    height: 100%;
}

.mindflix-post-full .mindflix-post-thumbnail {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f0f0f0;
}

.mindflix-post-full .mindflix-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.mindflix-post-full:hover .mindflix-post-thumbnail img {
    transform: scale(1.05);
}

.mindflix-post-full .mindflix-post-content {
    padding: 15px;
}

.mindflix-post-full .mindflix-post-title {
    font-size: 1.1em;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mindflix-post-full .mindflix-post-excerpt {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    margin: 0 0 10px 0;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mindflix-post-full .mindflix-post-date {
    font-size: 0.8em;
    color: #999;
    display: block;
}

/* ==========================================================================
   Minimal Style Layout
   ========================================================================== */

.mindflix-posts-minimal {
    margin-top: 15px;
}

.mindflix-post-minimal {
    display: flex;
    align-items: stretch; /* שינוי מ-center ל-stretch */
    padding: 0; /* הסרת padding כללי */
    margin-bottom: 10px;
    background: #fff;
    border: 1px solid #e1e1e1;
    border-radius: 6px;
    transition: all 0.3s ease;
    overflow: hidden; /* וידוא שהתמונה לא תחרוג */
    min-height: 80px; /* גובה מינימלי */
}

.mindflix-post-minimal:hover {
    border-color: #0073aa;
    transform: translateX(-3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mindflix-post-minimal:last-child {
    margin-bottom: 0;
}

.mindflix-post-minimal .mindflix-post-link {
    display: flex;
    align-items: stretch; /* שינוי מ-center ל-stretch */
    text-decoration: none;
    color: inherit;
    width: 100%;
    height: 100%;
}

.mindflix-post-minimal .mindflix-post-thumbnail {
    width: 80px; /* הגדלת רוחב התמונה */
    flex-shrink: 0;
    overflow: hidden;
    background: #f0f0f0;
    /* הסרת border-radius כדי שהתמונה תהיה צמודה לקצה */
    border-top-right-radius: 6px;
    border-bottom-right-radius: 6px;
}

.mindflix-post-minimal .mindflix-post-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.mindflix-post-minimal:hover .mindflix-post-thumbnail img {
    transform: scale(1.05);
}

.mindflix-post-minimal .mindflix-post-content {
    flex: 1;
    padding: 15px; /* הוספת padding רק לתוכן */
    display: flex;
    align-items: center; /* מרכז את הכותרת אנכית */
}

.mindflix-post-minimal .mindflix-post-title {
    font-size: 1em;
    font-weight: 500;
    margin: 0;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ==========================================================================
   Responsive Design
   ========================================================================== */

@media (max-width: 768px) {
    .mindflix-posts-full {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .mindflix-post-full .mindflix-post-thumbnail {
        height: 150px;
    }

    .mindflix-post-minimal {
        padding: 10px;
    }

    .mindflix-post-minimal .mindflix-post-thumbnail {
        width: 60px; /* שמירה על יחס טוב גם במובייל */
    }

    .mindflix-post-minimal .mindflix-post-content {
        padding: 12px;
    }

    .mindflix-title {
        font-size: 1.3em;
    }
}

@media (max-width: 480px) {
    .mindflix-viewed-posts,
    .mindflix-suggested-posts {
        margin: 15px 0;
    }

    .mindflix-post-full .mindflix-post-content {
        padding: 12px;
    }

    .mindflix-post-minimal .mindflix-post-thumbnail {
        width: 50px; /* קטן יותר במובייל קטן */
    }

    .mindflix-post-minimal .mindflix-post-content {
        padding: 10px;
        margin-left: 10px;
    }

    .mindflix-post-minimal .mindflix-post-title {
        font-size: 0.9em;
    }
}

/* ==========================================================================
   RTL Support Enhancements
   ========================================================================== */

[dir="rtl"] .mindflix-viewed-posts,
[dir="rtl"] .mindflix-suggested-posts,
.rtl .mindflix-viewed-posts,
.rtl .mindflix-suggested-posts {
    direction: rtl;
    text-align: right;
}

.tpmindflix-popular-item p:empty {
  margin: 0;
  padding: 0;
}

[dir="rtl"] .mindflix-post-minimal .mindflix-post-thumbnail,
.rtl .mindflix-post-minimal .mindflix-post-thumbnail {
    margin-left: 0;
    margin-right: 0;
}

[dir="rtl"] .mindflix-post-minimal:hover,
.rtl .mindflix-post-minimal:hover {
    transform: translateX(3px);
}

/* ==========================================================================
   Dark Mode Support
   ========================================================================== */

@media (prefers-color-scheme: dark) {
    .mindflix-viewed-posts,
    .mindflix-suggested-posts {
        color: #e0e0e0;
    }

    .mindflix-title {
        color: #f0f0f0;
        border-bottom-color: #4a9eff;
    }

    .mindflix-post-full {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .mindflix-post-full:hover {
        border-color: #4a9eff;
        background: #333;
    }

    .mindflix-post-minimal {
        background: #2a2a2a;
        border-color: #444;
        color: #e0e0e0;
    }

    .mindflix-post-minimal:hover {
        background: #333;
        border-color: #4a9eff;
    }

    .mindflix-post-full .mindflix-post-title,
    .mindflix-post-minimal .mindflix-post-title {
        color: #f0f0f0;
    }

    .mindflix-post-full .mindflix-post-excerpt {
        color: #ccc;
    }

    .mindflix-post-full .mindflix-post-date {
        color: #aaa;
    }

    .mindflix-no-posts,
    .mindflix-error {
        background: #2a2a2a;
        border-color: #444;
        color: #ccc;
    }

    .mindflix-error {
        background: #3a2a2a;
        border-color: #d63638;
        color: #ff6b6b;
    }
}

/* ==========================================================================
   Animation and Loading States
   ========================================================================== */

.mindflix-posts-container {
    min-height: 50px;
}

.mindflix-loading {
    position: relative;
}

.mindflix-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #0073aa;
    border-radius: 50%;
    animation: mindflix-spin 1s linear infinite;
}

@keyframes mindflix-spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Fade in animation for posts */
.mindflix-posts-full,
.mindflix-posts-minimal {
    animation: mindflix-fadeIn 0.5s ease-in;
}

@keyframes mindflix-fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Accessibility Improvements
   ========================================================================== */

.mindflix-post-link:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

.mindflix-post-full .mindflix-post-link:focus,
.mindflix-post-minimal .mindflix-post-link:focus {
    border-radius: 8px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mindflix-post-full,
    .mindflix-post-minimal {
        border-width: 2px;
    }

    .mindflix-title {
        border-bottom-width: 3px;
    }
}

/* ==========================================================================
   WordPress Fixes - תיקון בעיות וורדפרס
   ========================================================================== */

/* תיקון תגיות P ריקות שוורדפרס מוסיף */
.mindflix-viewed-posts p:empty,
.mindflix-suggested-posts p:empty {
    display: none !important;
    margin: 0 !important;
    padding: 0 !important;
    height: 0 !important;
}

.mindflix-viewed-posts p:only-child:empty,
.mindflix-suggested-posts p:only-child:empty {
    display: none !important;
}

/* איפוס סטיילים של וורדפרס לתגיות P לא רצויות */
.mindflix-viewed-posts > p:not(.mindflix-no-posts),
.mindflix-suggested-posts > p:not(.mindflix-no-posts) {
    display: none !important;
}

/* וידוא שרק התוכן שלנו מוצג */
.mindflix-viewed-posts > *:not(.mindflix-title):not(.mindflix-loading):not(.mindflix-posts-container):not(.mindflix-no-posts),
.mindflix-suggested-posts > *:not(.mindflix-title):not(.mindflix-loading):not(.mindflix-posts-container):not(.mindflix-no-posts) {
    display: none !important;
}

/* תיקון margin/padding נוסף מוורדפרס */
.mindflix-viewed-posts,
.mindflix-suggested-posts {
    padding: 0 !important;
    background: transparent !important;
}

.mindflix-viewed-posts::after,
.mindflix-suggested-posts::after {
    content: "";
    display: block;
    clear: both;
}

/* ==========================================================================
   Mindflix Notifications - מערכת התראות מותאמת אישית
   ========================================================================== */

/* קונטיינר ההתראות */
.mindflix-notifications-container {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
    direction: rtl;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

/* התראה בודדת */
.mindflix-notification {
    display: flex;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    margin-bottom: 10px;
    padding: 15px;
    min-width: 350px;
    max-width: 400px;
    opacity: 0;
    transform: translateX(-100%);
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

/* אנימציה של הופעה */
.mindflix-notification-show {
    opacity: 1;
    transform: translateX(0);
}

/* תמונה */
.mindflix-notification-img {
    flex-shrink: 0;
    margin-left: 15px;
    border-radius: 6px;
    overflow: hidden;
    width: 60px;
    height: 60px;
}

.mindflix-notification-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* תוכן */
.mindflix-notification-content {
    flex: 1;
    text-align: right;
}

.mindflix-notification-title {
    font-weight: bold;
    font-size: 16px;
    margin-bottom: 5px;
    line-height: 1.3;
}

.mindflix-notification-msg {
    font-size: 14px;
    opacity: 0.9;
    line-height: 1.4;
}

.mindflix-notification-msg a {
    color: inherit;
    text-decoration: none;
}

.mindflix-notification-msg a:hover {
    text-decoration: underline;
}

/* כפתור סגירה */
.mindflix-notification-close {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 20px;
    height: 20px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: background 0.2s ease;
}

.mindflix-notification-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* סוגי התראות שונים */
.mindflix-notification-success {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
}

.mindflix-notification-error {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

.mindflix-notification-warning {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

.mindflix-notification-info {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
}

/* אפקט hover */
.mindflix-notification:hover {
    transform: translateX(5px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* רספונסיבי */
@media (max-width: 480px) {
    .mindflix-notifications-container {
        left: 10px;
        right: 10px;
        bottom: 10px;
    }

    .mindflix-notification {
        min-width: auto;
        max-width: none;
    }
}

.lobibox-notify .lobibox-close {
    top: 3px;
    right: 3px;
}