/* Diary Mobile Styles RTL - Fixes for mobile diary view in RTL */

/* Fix datepicker display - HIDE input field, show ONLY icon button */
/* Applied to BOTH mobile and desktop - RTL */
.date-begin-and-end {
    display: flex !important;
    flex-direction: row-reverse !important; /* Icon on the RIGHT in RTL */
    align-items: center !important;
    gap: 12px !important;
    margin-bottom: 16px !important;
    direction: rtl !important;
}

/* Hide the label "תאריך תחילה" */
.date-begin-and-end label {
    display: none !important;
}

.date-begin-and-end md-datepicker {
    width: auto !important;
    max-width: none !important;
    min-width: auto !important;
    direction: rtl !important;
    order: 1; /* Calendar icon appears on the right in RTL */
}

/* HIDE the input field completely - RTL */
.date-begin-and-end md-datepicker input {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    visibility: hidden !important;
}

.date-begin-and-end md-datepicker .md-datepicker-input-container {
    width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
}

.date-begin-and-end md-datepicker .md-datepicker-input {
    display: none !important;
    width: 0 !important;
}

/* Show ONLY the calendar icon button - NO YELLOW background - RTL */
.date-begin-and-end md-datepicker button {
    width: 40px !important;
    min-width: 40px !important;
    height: 40px !important;
    padding: 8px !important;
    margin: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background-color: transparent !important; /* NO yellow - transparent */
    border: 1px solid #ddd !important; /* Light gray border */
    border-radius: 4px !important;
}

.date-begin-and-end md-datepicker button:hover {
    background-color: #f5f5f5 !important; /* Light gray on hover */
}

.date-begin-and-end md-datepicker button md-icon {
    width: 24px !important;
    height: 24px !important;
    font-size: 24px !important;
    color: #666 !important; /* Dark gray icon */
}

/* Style for the selected date display - LARGE and prominent - RTL */
.selected-date-display {
    font-size: 24px !important;
    font-weight: bold !important;
    color: #000 !important;
    text-align: center !important;
    padding: 10px 16px !important;
    background-color: transparent !important; /* NO gray background */
    border: 1px solid #ddd !important; /* Border like in the image */
    border-radius: 20px !important; /* Rounded like in the image */
    flex: 1 !important;
    max-width: 300px !important;
    direction: rtl !important;
    order: 2; /* Date display appears on the left in RTL */
}

/* MOBILE ONLY - Adjust margins for better spacing - RTL */
@media (max-width: 768px) {
    /* Remove margin-top and margin-bottom from FullCalendar toolbar */
    .diary-with-activities .fc-header-toolbar.fc-toolbar.fc-toolbar-ltr,
    .diary-with-activities .fc-header-toolbar.fc-toolbar {
        margin-top: 0 !important;
        margin-bottom: 0 !important;
    }
    
    /* Remove margin-top from calendar container */
    .diary-with-activities.ng-scope div#calendar,
    .diary-with-activities div#calendar,
    #calendar {
        margin-top: 0 !important;
    }
    
    /* Set master-column-wrapper margin-top to 15% ONLY on mobile (not 1024px) */
  .technicianPortal-portal .master-column-wrapper .diary-page {
    margin-top: 0% !important;
  }
}

/* FIX DATEPICKER POPUP - Calendar that opens when clicking the icon - RTL */
@media (max-width: 767px) {
    /* Fix the datepicker calendar popup - RTL */
    md-datepicker-calendar {
        width: 100% !important;
        max-width: 320px !important;
        direction: rtl !important;
    }

    /* Fix calendar pane - RTL */
    .md-datepicker-calendar-pane {
        width: 100% !important;
        max-width: 320px !important;
        direction: rtl !important;
    }

    /* Make calendar dates HORIZONTAL not vertical - RTL */
    .md-calendar {
        width: 100% !important;
        max-width: 320px !important;
        direction: rtl !important;
    }

    /* Fix month header - RTL */
    .md-calendar-month-label {
        font-size: 16px !important;
        font-weight: bold !important;
        padding: 8px !important;
        text-align: center !important;
    }

    /* Fix navigation arrows - RTL */
    .md-datepicker-calendar-pane .md-calendar-arrow {
        display: inline-block !important;
        visibility: visible !important;
        width: 30px !important;
        height: 30px !important;
    }

    /* Fix day-of-week headers (Sun, Mon, Tue...) - RTL */
    .md-calendar-day-header {
        font-size: 12px !important;
        text-align: center !important;
    }

    /* Fix date cells to display in GRID not vertical - RTL */
    .md-calendar-date {
        width: 14.28% !important; /* 100% / 7 days */
        display: inline-block !important;
        font-size: 14px !important;
        text-align: center !important;
        padding: 8px 0 !important;
    }

    /* Ensure calendar month grid displays correctly - RTL */
    .md-calendar-month {
        display: block !important;
    }

    /* Fix date button - RTL */
    .md-calendar-date-selection-indicator {
        font-size: 14px !important;
    }
}

/* Ensure full day view on mobile - RTL */
@media (max-width: 767px) {
    /* Make sure calendar takes full height */
    .diary-page .fc-timegrid {
        min-height: 600px !important;
    }

    /* HIDE daygrid date numbers that appear vertically - RTL */
    .fc-daygrid-day-number,
    a.fc-daygrid-day-number,
    .fc-daygrid-day-top {
        display: none !important;
        visibility: hidden !important;
    }

    /* Ensure date header is visible and prominent */
    .fc-timegrid .fc-col-header {
        display: table-header-group !important;
        visibility: visible !important;
        background-color: #f5f5f5 !important;
        border-bottom: 2px solid #ddd !important;
    }

    .fc-col-header-cell {
        display: table-cell !important;
        padding: 8px 4px !important;
        font-size: 16px !important;
        font-weight: bold !important;
        text-align: center !important;
        background-color: #f5f5f5 !important;
        border: 1px solid #ddd !important;
    }

    /* Show day and date in header - make it bigger and more visible */
    .fc-col-header-cell-cushion {
        display: block !important;
        padding: 6px !important;
        text-align: center !important;
        font-size: 16px !important;
        line-height: 1.3 !important;
        color: #222 !important;
        font-weight: bold !important;
        width: 100% !important;
    }
    
    /* Custom header content for mobile - RTL */
    .fc-day-header-content {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
    }

    .fc-day-text {
        font-size: 14px !important;
        font-weight: normal !important;
        margin-bottom: 2px !important;
        white-space: nowrap !important;
    }

    .fc-date-text {
        font-size: 18px !important;
        font-weight: bold !important;
        white-space: nowrap !important;
    }

    /* Ensure time slots are scrollable */
    .fc-timegrid-body {
        overflow-y: auto !important;
        max-height: calc(100vh - 200px) !important;
    }

    /* FORCE time grid slots height - ONE ROW PER HOUR */
    .fc-timegrid-slots table,
    .fc-timegrid-slots tbody,
    .fc-timegrid-slots tr {
        height: auto !important;
    }

    /* Make EACH HOUR row bigger with LARGE font */
    .fc-timegrid-slot,
    tr.fc-timegrid-slot {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        line-height: 40px !important;
        border-bottom: 2px solid #a8a8a8 !important;
        background-color: #f8f8f8 !important;
    }

    /* Make HOUR labels VERY BIG and CLEAR */
    .fc-timegrid-slot-label,
    td.fc-timegrid-slot-label {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        line-height: 40px !important;
        padding: 0 8px !important;
        font-size: 22px !important;
        font-weight: bold !important;
        vertical-align: middle !important;
        visibility: visible !important;
        color: #000 !important;
    }

    .fc-timegrid-slot-label-cushion {
        padding: 0 6px !important;
        line-height: 40px !important;
        height: 40px !important;
        display: inline-block !important;
        vertical-align: middle !important;
        font-size: 22px !important;
        font-weight: bold !important;
        color: #000 !important;
    }

    /* Force slot lanes to match their row height */
    .fc-timegrid-slot-lane,
    td.fc-timegrid-slot-lane {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
    }

    /* Force the axis frame to match */
    .fc-timegrid-axis-frame {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
    }

    /* Make EVENTS BIGGER and more readable */
    .fc-timegrid-event {
        font-size: 15px !important;
        padding: 4px 6px !important;
        line-height: 1.4 !important;
    }

    .fc-timegrid-event-harness {
        margin: 0 !important;
    }

    .fc-event-title {
        font-size: 15px !important;
        line-height: 1.4 !important;
        font-weight: 600 !important;
    }

    .fc-event-time {
        font-size: 13px !important;
        font-weight: bold !important;
    }

    .fc-event-main {
        padding: 4px !important;
    }

    /* HIDE the toolbar title on mobile - RTL */
    .fc-toolbar-title {
        display: none !important;
    }

    /* Fix calendar container */
    #calendar {
        width: 100% !important;
        overflow-x: hidden !important;
        direction: rtl !important;
    }

    /* Ensure scrollbar is visible */
    .fc-scroller,
    .fc-scroller-liquid-absolute {
        overflow-y: scroll !important;
        -webkit-overflow-scrolling: touch !important;
    }

    /* Make sure the calendar content doesn't collapse */
    .fc-view-harness {
        min-height: 500px !important;
        height: auto !important;
    }

    /* Fix day header format - BIGGER */
    .fc-timegrid-axis-cushion,
    .fc-timegrid-axis-cushion.fc-scrollgrid-shrink-cushion {
        padding: 0 6px !important;
        text-align: right !important;
        font-size: 22px !important;
        font-weight: bold !important;
        color: #000 !important;
    }

    /* RTL specific adjustments */
    .fc-direction-rtl .fc-daygrid-day-top {
        flex-direction: row-reverse !important;
    }

    .fc-direction-rtl .fc-timegrid-axis {
        text-align: right !important;
    }

    .fc-direction-rtl .fc-timegrid-slot-label {
        text-align: right !important;
        padding-right: 8px !important;
    }

    /* Fix the header toolbar to show date properly */
    .fc-toolbar {
        padding: 8px 0 !important;
        margin-bottom: 8px !important;
    }

    .fc-toolbar-chunk {
        display: flex !important;
        align-items: center !important;
    }

    /* Ensure column header is always on top and visible */
    .fc-timegrid-axis-frame {
        background-color: #f5f5f5 !important;
    }

    /* Make the axis (time column) wider for bigger numbers */
    .fc-timegrid-axis,
    td.fc-timegrid-axis {
        width: 60px !important;
        min-width: 60px !important;
        max-width: 60px !important;
    }

    /* Compact view for better space usage */
    .fc-timegrid-divider {
        padding: 0 !important;
        height: 1px !important;
    }

    /* Make toolbar buttons bigger and readable */
    .fc-button {
        font-size: 13px !important;
        padding: 5px 10px !important;
        font-weight: 600 !important;
    }

    /* Override ANY table cell that might cause extra height */
    .fc-timegrid-body table td {
        padding: 0 !important;
    }
}

/* Fix datepicker display - show selected date - Global (outside media query) */
md-datepicker input {
    color: #333 !important;
    visibility: visible !important;
    opacity: 1 !important;
}

md-datepicker .md-datepicker-input-container {
    padding-bottom: 0 !important;
}

md-datepicker .md-datepicker-input {
    font-size: 16px !important;
}

md-datepicker button {
    visibility: visible !important;
}

/* Ensure the date value is visible */
.md-datepicker-input-container input {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    color: #333 !important;
    font-size: 16px !important;
}
