/**
 * TP Calendar Responsive CSS
 * עיצוב מותאם במיוחד למסכים קטנים ולטלפונים ניידים
 */

/* בסיס - חל על כל הגדלים */
.tp-calendar-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 30px;
    font-family: 'Assistant', 'Rubik', 'Heebo', sans-serif;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
    direction: rtl;
}

/* ניווט לוח שנה */
.calendar-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 2px solid #2e7d32; /* ירוק כהה */
    padding-bottom: 15px;
}

.current-month {
    font-size: 24px;
    font-weight: 700;
    margin: 0;
    color: #2e7d32; /* ירוק כהה */
    text-align: center;
}

.month-nav {
    background-color: #4caf50; /* ירוק */
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none; /* מונע סימון טקסט */
    -webkit-tap-highlight-color: transparent; /* מונע הדגשת לחיצה במובייל */
}

.month-nav:hover {
    background-color: #2e7d32; /* ירוק כהה */
    transform: scale(1.1);
}

/* טבלת לוח שנה */
.tp-calendar {
    width: 100%;
    border-collapse: separate;
    border-spacing: 5px;
    table-layout: fixed;
}

/* כותרת הטבלה */
.tp-calendar thead th {
    padding: 10px;
    background-color: #2e7d32; /* ירוק כהה */
    color: white;
    font-weight: 600;
    text-align: center;
    border-radius: 5px;
}

/* ימי סוף שבוע */
.tp-calendar thead th:last-child {
    background-color: #1b5e20; /* ירוק כהה יותר לסוף שבוע */
}

/* תאי הטבלה */
.tp-calendar td {
    padding: 5px;
    border: 1px solid #e0e0e0;
    height: 100px;
    vertical-align: top;
    background-color: #f9f9f9;
    border-radius: 5px;
    transition: all 0.2s ease;
    position: relative; /* לפריסת אלמנטים בתוך התא */
}

.tp-calendar td:hover {
    background-color: #f0f7f0; /* גוון ירוק בהיר */
    transform: scale(1.02);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

/* מספר היום */
.day-number {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #333;
    text-align: right;
}

/* היום הנוכחי */
.today {
    background-color: #e8f5e9; /* ירוק בהיר מאוד */
    border: 2px solid #4caf50; /* ירוק */
}

.today .day-number {
    color: #2e7d32; /* ירוק כהה */
}

/* תאים ריקים */
.empty-day {
    background-color: #ffffff;
    border: none;
}

/* ימי החודש הבא */
.next-month-day {
    opacity: 0.5;
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    height: 100px;
    vertical-align: top;
    border-radius: 5px;
    transition: all 0.2s ease;
    position: relative;
}

.next-month-day:hover {
    opacity: 0.8;
    background-color: #f0f7f0;
    transform: scale(1.02);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1);
}

.next-month-day .day-number {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 5px;
    color: #777;
    text-align: right;
}

/* מיכל אירועים */
.day-events {
    max-height: 80px !important; /* גבוה יותר מהמקורי */
    overflow-y: auto !important;
}

/* WebKit scrollbar styling */
.day-events::-webkit-scrollbar {
    width: 6px;
}

.day-events::-webkit-scrollbar-track {
    background: #e0e0e0;
    border-radius: 3px;
}

.day-events::-webkit-scrollbar-thumb {
    background-color: #4caf50;
    border-radius: 3px;
}

/* פריטי אירוע */
.event-item {
    display: block;
    background-color: #4caf50; /* ירוק */
    color: white;
    padding: 3px 5px;
    margin-bottom: 3px;
    border-radius: 3px;
    text-decoration: none;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.event-item:hover {
    background-color: #2e7d32; /* ירוק כהה */
}

/* פריטי חג */
.holiday-item {
    display: block;
    background-color: #000; /* שחור לחגים */
    color: white;
    padding: 3px 5px;
    margin-bottom: 3px;
    border-radius: 3px;
    font-size: 11px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* טעינה */
.calendar-loader {
    text-align: center;
    padding: 20px;
    font-weight: bold;
    color: #2e7d32; /* ירוק כהה */
}

/* תיקוני עברית */
.tp-calendar-wrapper * {
    font-family: 'Assistant', 'Rubik', 'Heebo', sans-serif;
}

/* קרדיט מפתח */
.tp-calendar-wrapper::after {
    content: "";
    display: block;
    text-align: center;
    font-size: 11px;
    color: #666;
    margin-top: 10px;
    opacity: 0.7;
}

/* --------------- התאמות למובייל (טאבלט) --------------- */
@media screen and (max-width: 992px) {
    .tp-calendar-wrapper {
        padding: 15px;
    }
    
    .tp-calendar {
        border-spacing: 3px;
    }
    
    .calendar-navigation {
        padding-bottom: 10px;
        margin-bottom: 15px;
    }
    
    .current-month {
        font-size: 22px;
    }
    
    .tp-calendar td {
        height: 90px;
        padding: 4px;
    }
    
    .next-month-day {
        height: 90px;
    }
    
    .day-events {
        max-height: 60px;
    }
}

/* --------------- התאמות למובייל (טלפון) --------------- */
@media screen and (max-width: 768px) {
    .tp-calendar-wrapper {
        padding: 10px;
        border-radius: 6px;
    }
    
    .calendar-navigation {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .current-month {
        font-size: 20px;
    }
    
    .month-nav {
        width: 44px;
        height: 44px;
        font-size: 20px;
    }
    
    .tp-calendar {
        border-spacing: 2px;
    }
    
    .tp-calendar thead th {
        padding: 8px 3px;
        font-size: 14px;
    }
    
    .tp-calendar td {
        height: 75px;
        padding: 3px 2px;
    }
    
    .next-month-day {
        height: 75px;
    }
    
    .day-number {
        font-size: 14px;
        margin-bottom: 3px;
    }
    
    .day-events {
        max-height: 50px;
    }
    
    .event-item, .holiday-item {
        padding: 2px 4px;
        margin-bottom: 2px;
        font-size: 10px;
    }
}

/* --------------- התאמות למובייל (טלפון קטן) --------------- */
@media screen and (max-width: 576px) {
    .tp-calendar-wrapper {
        padding: 8px;
        border-radius: 5px;
    }
    
    .calendar-navigation {
        margin-bottom: 8px;
        padding-bottom: 6px;
    }
    
    .current-month {
        font-size: 18px;
    }
    
    .month-nav {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
    
    /* קידוד צבעוני לימים במקום תוכן מלא */
    .tp-calendar {
        border-spacing: 1px;
    }
    
    .tp-calendar thead th {
        padding: 5px 2px;
        font-size: 12px;
    }
    
    .tp-calendar td {
        height: 60px;
        padding: 2px 1px;
    }
    
    .next-month-day {
        height: 60px;
    }
    
    .day-number {
        font-size: 12px;
        margin-bottom: 2px;
        position: absolute;
        top: 2px;
        right: 4px;
    }
    
    .day-events {
        max-height: 45px;
        margin-top: 15px; /* מקום למספר יום */
    }
    
    .event-item, .holiday-item {
        padding: 1px 3px;
        margin-bottom: 1px;
        font-size: 9px;
    }
    
    /* מיקוד במידע חשוב בלבד */
    .day-events:after {
        content: attr(data-count);
        position: absolute;
        bottom: 3px;
        right: 3px;
        font-size: 8px;
        color: #555;
        display: var(--show-counter, none);
    }
}

/* --------------- מצב לטלפונים קטנים במיוחד --------------- */
@media screen and (max-width: 380px) {
    .tp-calendar {
        --compact-view: block;
    }
    
    .tp-calendar thead th {
        padding: 4px 1px;
        font-size: 11px;
    }
    
    .tp-calendar td {
        height: 50px;
        padding: 1px;
    }
    
    .next-month-day {
        height: 50px;
    }
    
    .day-number {
        font-size: 11px;
    }
    
    .day-events {
        max-height: 35px;
        margin-top: 14px;
    }
    
    .event-item, .holiday-item {
        padding: 1px 2px;
        font-size: 8px;
        margin-bottom: 1px;
    }
    
    /* מחוון אירועים במצב קומפקטי */
    .day-events {
        --show-counter: block;
    }
}

/* --------------- תצוגת לוח שנה חודשית על מסך מלא --------------- */
@media screen and (min-width: 1200px) {
    .tp-calendar-wrapper {
        max-width: 1400px;
        padding: 25px;
    }
    
    .tp-calendar td {
        height: 120px;
        padding: 8px;
    }
    
    .next-month-day {
        height: 120px;
    }
    
    .day-number {
        font-size: 18px;
        margin-bottom: 8px;
    }
    
    .day-events {
        max-height: 90px;
    }
    
    .event-item, .holiday-item {
        padding: 4px 6px;
        margin-bottom: 4px;
        font-size: 12px;
    }
}


/**
 * תוספות סגנון לתמיכה בהרחבת תא בלחיצה במובייל
 * הוסף את הקוד הזה לסוף קובץ ה-CSS שלך
 */

/* סגנון לתא מורחב במובייל */
@media screen and (max-width: 768px) {
    .expanded-cell {
        position: relative;
        transform: scale(1.05) !important;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
        transition: all 0.3s ease !important;
        overflow: visible !important;
        background-color: #ffffff !important;
        border: 2px solid #4caf50 !important;
    }

    .expanded-cell .day-events {
        overflow-y: auto !important;
        max-height: 120px !important;
        scrollbar-width: thin !important;
        scrollbar-color: #4caf50 #e0e0e0 !important;
    }

    .expanded-cell:after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: -1;
        background-color: rgba(255, 255, 255, 0.9);
        border-radius: 5px;
    }

    .tp-calendar tbody {
        position: relative;
    }
    
    /* מונע הסתרה של ימים אחרים כאשר תא מורחב */
    .tp-calendar td {
        transition: all 0.25s ease;
    }
    

    
    /* הצג את המחוון רק במסכים קטנים ורק כאשר יש תוכן */
    @media screen and (max-width: 576px) {
        .day-events:not(:empty)::before {
            display: block;
        }
        
        .expanded-cell .day-events::before {
            display: none;
        }
    }
    
    /* חץ 'סגור' לתאים מורחבים */
    .expanded-cell::before {
        content: "×";
        position: absolute;
        top: 2px;
        left: 2px;
        width: 16px;
        height: 16px;
        background-color: rgba(255, 255, 255, 0.8);
        border-radius: 50%;
        font-size: 14px;
        line-height: 16px;
        text-align: center;
        color: #666;
        z-index: 2;
    }
    
    /* עיצוב מיוחד לתצוגת רשימה במובייל במקום לוח */
    @media screen and (max-width: 380px) {
        .mobile-list-view .tp-calendar {
            display: block;
            border-spacing: 0;
        }
        
        .mobile-list-view .tp-calendar thead {
            display: none;
        }
        
        .mobile-list-view .tp-calendar tbody, 
        .mobile-list-view .tp-calendar tr {
            display: block;
        }
        
        .mobile-list-view .tp-calendar td {
            display: block;
            width: auto;
            height: auto;
            min-height: 40px;
            margin-bottom: 5px;
        }
        
        .mobile-list-view .empty-day {
            display: none;
        }
        
        .mobile-list-view .calendar-day, 
        .mobile-list-view .next-month-day {
            padding: 8px 10px;
        }
        
        .mobile-list-view .day-number {
            position: static;
            float: right;
            margin-bottom: 8px;
            font-size: 14px;
        }
        
        .mobile-list-view .day-events {
            clear: both;
            margin-top: 5px;
            max-height: none;
        }
        
        /* כפתור מעבר בין תצוגות */
        .view-toggle {
            display: flex;
            justify-content: center;
            margin-bottom: 10px;
        }
        
        .view-toggle-button {
            background-color: #f1f1f1;
            border: 1px solid #ddd;
            color: #666;
            padding: 5px 10px;
            font-size: 12px;
            cursor: pointer;
            border-radius: 4px;
        }
        
        .view-toggle-button.active {
            background-color: #4caf50;
            color: white;
            border-color: #4caf50;
        }
    }
}


.event-item, .holiday-item {
    /* מבטל את הנקודות בסוף והחיתוך */
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    
    /* מאפשר לטקסט לרדת שורה */
    word-wrap: break-word !important;
    line-height: 1.3 !important;
    
    /* מוודא שיש מספיק מקום לכמה שורות */
    min-height: 18px !important;
}


@media screen and (max-width: 576px) {
    .event-item, .holiday-item {
        font-size: 10px !important;
        padding: 2px 4px !important;
        margin-bottom: 2px !important;
    }
    
    .day-events {
        max-height: 70px !important;
    }
}

.tp-calendar td, .next-month-day {
    height: auto !important;
    min-height: 100px !important;
}

.today {
	background-color: #0080002e !important;
}