/* =========================================
   agenda.css - outlook style calendar
   ========================================= */

:root
{
    --agenda-primary: #0078d4;
    --agenda-primary-light: #e8f4fd;
    --agenda-primary-dark: #106ebe;
    --agenda-border: #e0e0e0;
    --agenda-border-light: #f0f0f0;
    --agenda-text: #333;
    --agenda-text-muted: #666;
    --agenda-bg: #fff;
    --agenda-bg-alt: #fafcff;
    --agenda-scrollbar-width: 17px;
    --agenda-time-col-width: 50px;
    --agenda-hour-height: 60px;
}

/* container */
.agenda-container
{
    display: flex;
    flex-direction: column;
    height: calc(100vh - 135px);
    min-height: 400px;
    max-height: calc(100vh - 135px);
    background-color: #f5f5f5;
}

/* toolbar */
.agenda-toolbar
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 16px;
    background-color: var(--agenda-bg);
    border-bottom: 1px solid var(--agenda-border);
    flex-wrap: wrap;
    position: relative;
}

.agenda-toolbar-left
{
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.agenda-nav
{
    display: flex;
    gap: 4px;
}

.agenda-toolbar #agenda-date-picker
{
    width: auto;
    max-width: 150px;
}

.agenda-filters
{
    display: flex;
}

.agenda-title-wrapper
{
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
}

.agenda-title
{
    margin: 0;
    width: 235px;
    font-size: 18px;
    font-weight: 600;
    color: var(--agenda-text);
    text-transform: capitalize;
    text-align: center;
}

.btn-add-event
{
    width: 32px;
    height: 32px;
    border-radius: 50%;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.agenda-view-buttons .btn.active,
.agenda-view-buttons .btn-primary
{
    background-color: var(--agenda-primary);
    border-color: var(--agenda-primary);
    color: #fff;
}

/* calendar container */
.agenda-calendar
{
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: var(--agenda-bg);
    margin: 8px;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    min-height: 0;
}

/* =========================================
   day/week view
   ========================================= */

/* header row */
.agenda-header
{
    display: flex;
    border-bottom: 1px solid var(--agenda-border);
    flex-shrink: 0;
    position: sticky;
    top: 0;
    background-color: var(--agenda-bg);
    z-index: 10;
}

.agenda-header-time
{
    width: var(--agenda-time-col-width);
    min-width: var(--agenda-time-col-width);
    max-width: var(--agenda-time-col-width);
    flex-shrink: 0;
    border-right: 1px solid var(--agenda-border);
}


/* wrapper for day columns in header */
.agenda-header-days
{
    display: flex;
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
}

.agenda-header-day
{
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    text-align: center;
    padding: 8px 2px;
    border-right: 1px solid var(--agenda-border);
    box-sizing: border-box;
}

.agenda-header-day:last-child
{
    border-right: none;
}

.agenda-header-day.is-today
{
    background-color: var(--agenda-primary-light);
}

.agenda-header-day-name
{
    font-size: 10px;
    color: var(--agenda-text-muted);
    margin-bottom: 2px;
    text-transform: uppercase;
}

.agenda-header-day-num
{
    font-size: 16px;
    font-weight: 400;
    width: 28px;
    height: 28px;
    line-height: 28px;
    margin: 0 auto;
    border-radius: 50%;
}

.agenda-header-day.is-today .agenda-header-day-num
{
    background-color: var(--agenda-primary);
    color: #fff;
    font-weight: 600;
}

/* grid container */
.agenda-grid-wrapper
{
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
}

.agenda-grid-wrapper::-webkit-scrollbar
{
    display: none;
}

.agenda-grid
{
    display: flex;
}

/* time column */
.agenda-time-col
{
    width: var(--agenda-time-col-width);
    min-width: var(--agenda-time-col-width);
    max-width: var(--agenda-time-col-width);
    flex-shrink: 0;
    border-right: 1px solid var(--agenda-border);
}

.agenda-time-label
{
    height: var(--agenda-hour-height);
    font-size: 10px;
    color: var(--agenda-text-muted);
    text-align: right;
    padding-right: 6px;
    box-sizing: border-box;
}

/* wrapper for day columns in grid */
.agenda-days
{
    display: flex;
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
}

/* day columns */
.agenda-day-col
{
    flex: 1 1 0%;
    min-width: 0;
    width: 0;
    position: relative;
    border-right: 1px solid var(--agenda-border);
    box-sizing: border-box;
}

.agenda-day-col:last-child
{
    border-right: none;
}

.agenda-day-col.is-today
{
    background-color: var(--agenda-bg-alt);
}

/* hour cells */
.agenda-hour-cell
{
    height: var(--agenda-hour-height);
    border-top: 1px solid var(--agenda-border-light);
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.agenda-hour-cell:hover
{
    background-color: rgba(0, 120, 212, 0.05);
}

.agenda-hour-cell-half
{
    height: 30px;
    border-bottom: 1px dashed var(--agenda-border-light);
}

.agenda-event-link
{
    display: none;
}

/* events */
.agenda-event
{
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    padding: 2px 4px;
    color: #222;
    font-size: 11px;
    font-weight: 500;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    z-index: 1;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
    user-select: none;
}

.agenda-event:hover
{
    transform: scale(1.02);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.agenda-event.dragging,
.agenda-month-event.dragging
{
    opacity: 0.4;
}

.agenda-event-ghost
{
    position: absolute;
    left: 2px;
    right: 2px;
    border-radius: 4px;
    background-color: #FEF9C3;
    border: 2px dashed #D4A017;
    z-index: 3;
    pointer-events: none;
    font-size: 11px;
    font-weight: 600;
    color: #92400E;
    padding: 2px 4px;
}

.agenda-month-day.drag-over
{
    background-color: rgba(0, 120, 212, 0.1);
}

/* event status borders */
.agenda-event[data-status="completed"],
.agenda-month-event[data-status="completed"]
{
    box-shadow: inset 0 0 0 2px #10B981;
}

.agenda-event[data-status="confirmed"],
.agenda-month-event[data-status="confirmed"]
{
    box-shadow: none;
    border: 2px dotted #10B981;
}

.agenda-event[data-status="pending"],
.agenda-month-event[data-status="pending"]
{
    box-shadow: none;
    border: 2px dotted #999;
}

.agenda-event[data-status="cancelled"],
.agenda-month-event[data-status="cancelled"]
{
    box-shadow: inset 0 0 0 2px #EF4444;
}

/* intervention type emoji */
.agenda-event[data-type="intervention"] .agenda-event-title::before,
.agenda-month-event[data-type="intervention"]::before
{
    content: "\1F6A8";
    margin-right: 3px;
}

.agenda-event-title
{
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-event-address
{
    font-size: 9px;
    opacity: 0.7;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.agenda-event-time
{
    font-size: 10px;
    opacity: 0.9;
}

/* =========================================
   month view
   ========================================= */

.agenda-month-header
{
    display: flex;
    border-bottom: 1px solid var(--agenda-border);
    flex-shrink: 0;
}

.agenda-month-header-day
{
    flex: 1;
    text-align: center;
    padding: 8px 4px;
    font-size: 11px;
    font-weight: 600;
    color: var(--agenda-text-muted);
    border-right: 1px solid var(--agenda-border);
    text-transform: uppercase;
}

.agenda-month-header-day:last-child
{
    border-right: none;
}

.agenda-month-grid
{
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.agenda-month-week
{
    flex: 1 1 0%;
    display: flex;
    border-bottom: 1px solid var(--agenda-border);
    min-height: 0;
}

.agenda-month-week:last-child
{
    border-bottom: none;
}

.agenda-month-day
{
    flex: 1 1 0%;
    min-height: 0;
    padding: 4px;
    border-right: 1px solid var(--agenda-border);
    cursor: pointer;
    overflow: hidden;
    transition: background-color 0.15s ease;
}

.agenda-month-day:last-child
{
    border-right: none;
}

.agenda-month-day:hover
{
    background-color: rgba(0, 120, 212, 0.05);
}

.agenda-month-day.is-other-month
{
    opacity: 0.4;
}

.agenda-month-day.is-today
{
    background-color: var(--agenda-primary-light);
}

.agenda-month-day-num
{
    font-size: 14px;
    font-weight: 400;
    width: 24px;
    height: 24px;
    line-height: 24px;
    text-align: center;
    border-radius: 50%;
    margin-bottom: 2px;
}

.agenda-month-day.is-today .agenda-month-day-num
{
    background-color: var(--agenda-primary);
    color: #fff;
    font-weight: 600;
}

.agenda-month-event
{
    font-size: 10px;
    padding: 1px 4px;
    margin-bottom: 1px;
    color: #222;
    border-radius: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    user-select: none;
}

.agenda-month-event:hover
{
    filter: brightness(1.1);
}

.agenda-month-more
{
    font-size: 11px;
    color: var(--agenda-text-muted);
    text-decoration: none;
    display: block;
    padding: 2px 4px;
    font-weight: 500;
}

.agenda-month-more:hover
{
    color: var(--agenda-primary);
}

/* =========================================
   context menu
   ========================================= */

.agenda-context-menu
{
    display: none;
    position: absolute;
    z-index: 1000;
    min-width: 180px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================================
   responsive
   ========================================= */

@media (max-width: 768px)
{
    .agenda-toolbar
    {
        padding: 8px;
        gap: 8px;
    }

    .agenda-title-wrapper
    {
        position: static;
        transform: none;
        order: -1;
        width: 100%;
        justify-content: center;
        margin-bottom: 8px;
    }

    .agenda-title
    {
        font-size: 14px;
    }

    .agenda-toolbar-left
    {
        flex-wrap: wrap;
        gap: 8px;
    }


    .agenda-view-buttons .btn
    {
        padding: 4px 8px;
        font-size: 12px;
    }

    .agenda-header-day-num
    {
        font-size: 14px;
        width: 24px;
        height: 24px;
        line-height: 24px;
    }

    .agenda-event
    {
        font-size: 10px;
        padding: 1px 2px;
    }

    .agenda-event-time
    {
        display: none;
    }
}

@media (max-width: 576px)
{
    .agenda-toolbar
    {
        flex-direction: column;
        align-items: center;
    }

    .agenda-toolbar-left
    {
        flex-direction: column;
        align-items: center;
        width: 100%;
    }

    .agenda-nav,
    .agenda-view-buttons
    {
        justify-content: center;
    }

    .agenda-title
    {
        text-align: center;
    }

    #agenda-date-picker
    {
        max-width: 100%;
    }

}
