/* ============================================
   Calendar Legend Styling
   ============================================ */

.calendar-legend {
    padding: 1rem;
    background-color: transparent;
    border-radius: 8px;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-color {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.legend-label {
    font-size: 0.9rem;
    color: #555;
    font-weight: 500;
}

/* ============================================
   FullCalendar Component Styling
   ============================================ */

/* Calendar Container */
.fc {
    font-size: 1rem;
}

/* Toolbar - Navigation and View Buttons */
.fc-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 0.5rem;
}

.fc-toolbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
}

/* Button Groups */
.fc-button-group {
    display: flex;
    gap: 0.25rem;
}

/* All Buttons - Today, Prev, Next, View Buttons */
.fc-button {
    padding: 0.5rem 1rem;
    font-size: 0.95rem;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #ddd;
    background-color: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fc-button:hover {
    background-color: #f5f5f5;
    border-color: #bbb;
}

.fc-button-primary {
    background-color: var(--ordolio-default-primary, #007bff);
    border-color: var(--ordolio-default-primary, #007bff);
    color: #fff;
}

.fc-button-primary:hover {
    background-color: var(--ordolio-default-primary-dark, #0056b3);
    border-color: var(--ordolio-default-primary-dark, #0056b3);
}

.fc-button-active {
    background-color: var(--ordolio-default-primary, #007bff);
    border-color: var(--ordolio-default-primary, #007bff);
    color: #fff;
}

/* Calendar Header */
.fc-col-header-cell {
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    font-size: 0.9rem;
    background-color: #f8f9fa;
}

/* Calendar Day Cells */
.fc-daygrid-day {
    font-size: 0.9rem;
}

.fc-daygrid-day-number {
    padding: 0.5rem;
    font-size: 0.9rem;
}

/* Event Styling */
.fc-event {
    border-radius: 4px;
    padding: 2px 4px;
    margin: 1px 2px;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s ease;
    text-align: left !important;
}

.fc-event:hover {
    opacity: 0.85;
}

.fc-event-title {
    font-weight: 500;
    font-size: 0.85rem;
    text-align: left !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.fc-event-time {
    font-size: 0.8rem;
    font-weight: 400;
    text-align: left !important;
}

/* Day Grid Events */
.fc-daygrid-event {
    text-align: left !important;
    justify-content: flex-start !important;
}

.fc-daygrid-event-harness {
    text-align: left !important;
}

.fc-event-main {
    text-align: left !important;
    overflow: hidden;
    display: block;
}

.fc-event-main-frame {
    text-align: left !important;
    display: block;
}

.fc-daygrid-event-dot {
    border: 4px solid;
    border-radius: 50%;
    margin-right: 4px;
}

/* Additional left alignment for all event content */
.fc-event-title-container {
    text-align: left !important;
}

.fc-daygrid-block-event .fc-event-title {
    text-align: left !important;
}

.fc-h-event {
    text-align: left !important;
}

.fc-h-event .fc-event-main {
    text-align: left !important;
}

/* List View */
.fc-list-event-title {
    font-size: 0.9rem;
}

.fc-list-event-time {
    font-size: 0.85rem;
}

/* ============================================
   Responsive Styles - Tablet
   ============================================ */

@media (max-width: 768px) {
    /* Reduce overall calendar font size */
    .fc {
        font-size: 0.9rem;
    }

    /* Toolbar adjustments */
    .fc-toolbar {
        flex-direction: column;
        gap: 0.5rem;
    }

    .fc-toolbar-title {
        font-size: 1.2rem;
        text-align: center;
        width: 100%;
    }

    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        width: 100%;
    }

    /* Button sizing */
    .fc-button {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }

    /* Header cells */
    .fc-col-header-cell {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }

    /* Day numbers */
    .fc-daygrid-day-number {
        padding: 0.4rem;
        font-size: 0.8rem;
    }

    /* Event text */
    .fc-event {
        font-size: 0.75rem;
        padding: 1px 3px;
        margin: 1px;
    }

    .fc-event-title {
        font-size: 0.75rem;
    }

    .fc-event-time {
        font-size: 0.7rem;
    }

    /* List view */
    .fc-list-event-title {
        font-size: 0.8rem;
    }

    .fc-list-event-time {
        font-size: 0.75rem;
    }
}

/* ============================================
   Responsive Styles - Mobile
   ============================================ */

@media (max-width: 576px) {
    /* Further reduce calendar font size */
    .fc {
        font-size: 0.8rem;
    }

    /* Toolbar */
    .fc-toolbar {
        padding: 0.25rem;
    }

    .fc-toolbar-title {
        font-size: 1rem;
    }

    /* Smaller buttons for mobile */
    .fc-button {
        padding: 0.3rem 0.5rem;
        font-size: 0.75rem;
    }

    /* Compact button groups */
    .fc-button-group {
        gap: 0.15rem;
    }

    /* Header - show abbreviated day names */
    .fc-col-header-cell {
        padding: 0.3rem 0.15rem;
        font-size: 0.7rem;
    }

    .fc-col-header-cell-cushion {
        padding: 2px;
    }

    /* Day cells */
    .fc-daygrid-day {
        font-size: 0.75rem;
    }

    .fc-daygrid-day-number {
        padding: 0.3rem;
        font-size: 0.7rem;
    }

    /* Event text - smallest size */
    .fc-event {
        font-size: 0.65rem;
        padding: 1px 2px;
        margin: 0.5px;
    }

    .fc-event-title {
        font-size: 0.65rem;
        line-height: 1.2;
    }

    .fc-event-time {
        font-size: 0.6rem;
    }

    /* Hide event time on very small screens to save space */
    .fc-daygrid-event .fc-event-time {
        display: none;
    }

    /* List view mobile */
    .fc-list-event-title {
        font-size: 0.75rem;
    }

    .fc-list-event-time {
        font-size: 0.7rem;
    }

    /* More events link */
    .fc-daygrid-more-link {
        font-size: 0.65rem;
        padding: 1px 2px;
    }

    /* Week and time grid adjustments */
    .fc-timegrid-slot-label {
        font-size: 0.7rem;
    }

    .fc-timegrid-event {
        font-size: 0.7rem;
    }
}

/* ============================================
   Responsive Styles - Extra Small Mobile
   ============================================ */

@media (max-width: 400px) {
    .fc {
        font-size: 0.75rem;
    }

    .fc-toolbar-title {
        font-size: 0.9rem;
    }

    .fc-button {
        padding: 0.25rem 0.4rem;
        font-size: 0.7rem;
    }

    .fc-col-header-cell {
        font-size: 0.65rem;
        padding: 0.2rem 0.1rem;
    }

    .fc-daygrid-day-number {
        font-size: 0.65rem;
        padding: 0.2rem;
    }

    .fc-event {
        font-size: 0.6rem;
    }

    .fc-event-title {
        font-size: 0.6rem;
    }
}

/* ============================================
   Accessibility and Touch Targets
   ============================================ */

/* Ensure touch targets are adequate on mobile */
@media (hover: none) and (pointer: coarse) {
    .fc-button {
        min-height: 44px;
        min-width: 44px;
    }

    .fc-event {
        min-height: 30px;
        display: flex;
        align-items: center;
    }
}

/* Focus states for accessibility */
.fc-button:focus,
.fc-event:focus {
    outline: 2px solid var(--ordolio-default-primary, #007bff);
    outline-offset: 2px;
}
