/**
 * RSL Full Page Calendar Component
 * Version: 1.0.0
 *
 * A fully accessible, ADA-compliant calendar component with
 * Day, Week, Month, and Year views. Supports events, categories,
 * recurrence, and FilterBus integration.
 *
 * Features:
 * - Four calendar views: day, week, month, year
 * - Full keyboard navigation with ARIA grid patterns
 * - Event creation, editing, deletion
 * - Category-based event filtering via FilterBus
 * - Dark mode support
 * - Responsive design
 * - High contrast mode support
 * - Reduced motion support
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

:root {
    /* Calendar dimensions */
    --rsl-calendar-min-height: 600px;
    --rsl-calendar-cell-min-height: 100px;
    --rsl-calendar-week-cell-height: 60px;
    --rsl-calendar-day-hour-height: 60px;
    --rsl-calendar-time-gutter-width: 60px;

    /* Colors - Light mode */
    --rsl-calendar-bg: #ffffff;
    --rsl-calendar-border: #e0e0e0;
    --rsl-calendar-header-bg: #f8f9fa;
    --rsl-calendar-header-text: #333333;
    --rsl-calendar-cell-bg: #ffffff;
    --rsl-calendar-cell-hover: #f0f4ff;
    --rsl-calendar-cell-selected: #e3f2fd;
    --rsl-calendar-cell-today: #fff8e1;
    --rsl-calendar-cell-outside: #f5f5f5;
    --rsl-calendar-text: #333333;
    --rsl-calendar-text-muted: #757575;
    --rsl-calendar-text-outside: #bdbdbd;
    --rsl-calendar-weekend-bg: #fafafa;

    /* Toolbar */
    --rsl-calendar-toolbar-bg: #ffffff;
    --rsl-calendar-toolbar-border: #e0e0e0;
    --rsl-calendar-btn-bg: #f5f5f5;
    --rsl-calendar-btn-hover: #e0e0e0;
    --rsl-calendar-btn-active: #1976d2;
    --rsl-calendar-btn-active-text: #ffffff;

    /* Events */
    --rsl-calendar-event-default: #1976d2;
    --rsl-calendar-event-text: #ffffff;
    --rsl-calendar-event-hover-opacity: 0.9;

    /* Event panel */
    --rsl-calendar-panel-bg: #ffffff;
    --rsl-calendar-panel-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --rsl-calendar-panel-border: #e0e0e0;

    /* Focus states - more pronounced for ADA compliance */
    --rsl-calendar-focus-ring: 0 0 0 3px #1976d2, 0 0 0 6px rgba(25, 118, 210, 0.4);
    --rsl-calendar-focus-ring-inset: inset 0 0 0 3px #1976d2;
    --rsl-calendar-event-focus-bg: #000000;
    --rsl-calendar-event-focus-text: #ffffff;
    --rsl-calendar-event-focus-scale: 1.02;

    /* Category colors */
    --rsl-calendar-category-work: #4285f4;
    --rsl-calendar-category-personal: #0f9d58;
    --rsl-calendar-category-holiday: #db4437;
    --rsl-calendar-category-meeting: #f4b400;
    --rsl-calendar-category-travel: #ab47bc;
    --rsl-calendar-category-health: #00acc1;

    /* Transitions */
    --rsl-calendar-transition: 0.2s ease;
}

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

[data-theme="dark"] {
    --rsl-calendar-bg: #1e1e1e;
    --rsl-calendar-border: #3a3a3a;
    --rsl-calendar-header-bg: #252525;
    --rsl-calendar-header-text: #e0e0e0;
    --rsl-calendar-cell-bg: #1e1e1e;
    --rsl-calendar-cell-hover: #2a3a4a;
    --rsl-calendar-cell-selected: #1a3a5c;
    --rsl-calendar-cell-today: #3d3520;
    --rsl-calendar-cell-outside: #151515;
    --rsl-calendar-text: #e0e0e0;
    --rsl-calendar-text-muted: #9e9e9e;
    --rsl-calendar-text-outside: #616161;
    --rsl-calendar-weekend-bg: #1a1a1a;

    --rsl-calendar-toolbar-bg: #252525;
    --rsl-calendar-toolbar-border: #3a3a3a;
    --rsl-calendar-btn-bg: #333333;
    --rsl-calendar-btn-hover: #444444;
    --rsl-calendar-btn-active: #1976d2;
    --rsl-calendar-btn-active-text: #ffffff;

    --rsl-calendar-panel-bg: #252525;
    --rsl-calendar-panel-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    --rsl-calendar-panel-border: #3a3a3a;

    --rsl-calendar-focus-ring: 0 0 0 3px #64b5f6, 0 0 0 6px rgba(100, 181, 246, 0.4);
    --rsl-calendar-event-focus-bg: #ffffff;
    --rsl-calendar-event-focus-text: #000000;
    --rsl-calendar-event-focus-scale: 1.02;
}

/* ==========================================================================
   Base Calendar Container
   ========================================================================== */

.rsl-calendar {
    display: flex;
    flex-direction: column;
    min-height: var(--rsl-calendar-min-height);
    background: var(--rsl-calendar-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 8px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    color: var(--rsl-calendar-text);
}

.rsl-calendar * {
    box-sizing: border-box;
}

/* ==========================================================================
   Toolbar
   ========================================================================== */

.rsl-calendar-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--rsl-calendar-toolbar-bg);
    border-bottom: 1px solid var(--rsl-calendar-toolbar-border);
    flex-wrap: wrap;
    gap: 0.75rem;
}

.rsl-calendar-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rsl-calendar-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--rsl-calendar-header-text);
    margin: 0 1rem;
    min-width: 200px;
    text-align: center;
}

.rsl-calendar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background: var(--rsl-calendar-btn-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 6px;
    color: var(--rsl-calendar-text);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--rsl-calendar-transition),
                border-color var(--rsl-calendar-transition);
    white-space: nowrap;
}

.rsl-calendar-btn:hover {
    background: var(--rsl-calendar-btn-hover);
}

.rsl-calendar-btn:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
}

.rsl-calendar-btn[aria-pressed="true"],
.rsl-calendar-btn.active {
    background: var(--rsl-calendar-btn-active);
    color: var(--rsl-calendar-btn-active-text);
    border-color: var(--rsl-calendar-btn-active);
}

.rsl-calendar-btn-icon {
    padding: 0.5rem;
    min-width: 36px;
}

.rsl-calendar-btn-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

/* View switcher */
.rsl-calendar-views {
    display: flex;
    gap: 0.25rem;
    background: var(--rsl-calendar-btn-bg);
    border-radius: 6px;
    padding: 0.25rem;
}

.rsl-calendar-views .rsl-calendar-btn {
    border: none;
    background: transparent;
    border-radius: 4px;
}

.rsl-calendar-views .rsl-calendar-btn:hover {
    background: var(--rsl-calendar-btn-hover);
}

.rsl-calendar-views .rsl-calendar-btn[aria-pressed="true"] {
    background: var(--rsl-calendar-btn-active);
    color: var(--rsl-calendar-btn-active-text);
}

/* Actions */
.rsl-calendar-actions {
    display: flex;
    gap: 0.5rem;
}

.rsl-calendar-btn-primary {
    background: var(--rsl-calendar-btn-active);
    color: var(--rsl-calendar-btn-active-text);
    border-color: var(--rsl-calendar-btn-active);
}

.rsl-calendar-btn-primary:hover {
    background: #1565c0;
    border-color: #1565c0;
}

/* ==========================================================================
   Calendar Grid Base
   ========================================================================== */

.rsl-calendar-grid {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: auto;
}

/* Column headers */
.rsl-calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: var(--rsl-calendar-header-bg);
    border-bottom: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-header-cell {
    padding: 0.75rem 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--rsl-calendar-text-muted);
}

.rsl-calendar-header-cell.weekend {
    color: var(--rsl-calendar-category-holiday);
}

/* Grid body */
.rsl-calendar-body {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    grid-auto-rows: minmax(var(--rsl-calendar-cell-min-height), 1fr);
}

/* ==========================================================================
   Month View
   ========================================================================== */

.rsl-calendar-cell {
    position: relative;
    padding: 0.5rem;
    border-right: 1px solid var(--rsl-calendar-border);
    border-bottom: 1px solid var(--rsl-calendar-border);
    background: var(--rsl-calendar-cell-bg);
    cursor: pointer;
    transition: background var(--rsl-calendar-transition);
    min-height: var(--rsl-calendar-cell-min-height);
}

.rsl-calendar-cell:nth-child(7n) {
    border-right: none;
}

.rsl-calendar-cell:hover {
    background: var(--rsl-calendar-cell-hover);
}

.rsl-calendar-cell:focus,
.rsl-calendar-cell:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring-inset);
    z-index: 1;
    background: var(--rsl-calendar-cell-selected);
}

.rsl-calendar-cell[aria-selected="true"] {
    background: var(--rsl-calendar-cell-selected);
}

.rsl-calendar-cell[aria-current="date"] {
    background: var(--rsl-calendar-cell-today);
}

.rsl-calendar-cell[aria-current="date"]::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--rsl-calendar-btn-active);
}

.rsl-calendar-cell.outside-month {
    background: var(--rsl-calendar-cell-outside);
}

.rsl-calendar-cell.outside-month .rsl-calendar-day-number {
    color: var(--rsl-calendar-text-outside);
}

.rsl-calendar-cell.weekend {
    background: var(--rsl-calendar-weekend-bg);
}

.rsl-calendar-cell.weekend.outside-month {
    background: var(--rsl-calendar-cell-outside);
}

/* Day number */
.rsl-calendar-day-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rsl-calendar-text);
    border-radius: 50%;
    margin-bottom: 0.25rem;
}

.rsl-calendar-cell[aria-current="date"] .rsl-calendar-day-number {
    background: var(--rsl-calendar-btn-active);
    color: #ffffff;
}

/* Events in month view */
.rsl-calendar-events {
    display: flex;
    flex-direction: column;
    gap: 2px;
    overflow: hidden;
}

.rsl-calendar-event {
    display: flex;
    align-items: center;
    padding: 2px 6px;
    background: var(--rsl-calendar-event-default);
    color: var(--rsl-calendar-event-text);
    border-radius: 3px;
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: opacity var(--rsl-calendar-transition);
}

.rsl-calendar-event:hover {
    opacity: var(--rsl-calendar-event-hover-opacity);
}

.rsl-calendar-event:focus,
.rsl-calendar-event:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
    background-color: var(--rsl-calendar-event-focus-bg) !important;
    color: var(--rsl-calendar-event-focus-text) !important;
    transform: scale(var(--rsl-calendar-event-focus-scale));
    position: relative;
    z-index: 5;
}

.rsl-calendar-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 4px;
    flex-shrink: 0;
}

.rsl-calendar-event-time {
    font-weight: 600;
    margin-right: 4px;
}

.rsl-calendar-event-more {
    font-size: 0.7rem;
    color: var(--rsl-calendar-text-muted);
    padding: 2px 0;
    cursor: pointer;
}

.rsl-calendar-event-more:hover {
    color: var(--rsl-calendar-btn-active);
    text-decoration: underline;
}

/* Event category colors */
.rsl-calendar-event[data-category="work"] { background: var(--rsl-calendar-category-work); }
.rsl-calendar-event[data-category="personal"] { background: var(--rsl-calendar-category-personal); }
.rsl-calendar-event[data-category="holiday"] { background: var(--rsl-calendar-category-holiday); }
.rsl-calendar-event[data-category="meeting"] { background: var(--rsl-calendar-category-meeting); color: #333; }
.rsl-calendar-event[data-category="travel"] { background: var(--rsl-calendar-category-travel); }
.rsl-calendar-event[data-category="health"] { background: var(--rsl-calendar-category-health); }

/* ==========================================================================
   Week View
   ========================================================================== */

.rsl-calendar[data-view="week"] .rsl-calendar-header {
    grid-template-columns: var(--rsl-calendar-time-gutter-width) repeat(7, 1fr);
}

.rsl-calendar[data-view="week"] .rsl-calendar-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0.5rem;
}

.rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-name {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--rsl-calendar-text-muted);
}

.rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-number {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--rsl-calendar-text);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    margin-top: 0.25rem;
}

.rsl-calendar[data-view="week"] .rsl-calendar-header-cell[aria-current="date"] .day-number {
    background: var(--rsl-calendar-btn-active);
    color: #ffffff;
}

.rsl-calendar-time-gutter {
    width: var(--rsl-calendar-time-gutter-width);
    background: var(--rsl-calendar-header-bg);
    border-right: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-week-grid {
    flex: 1;
    display: grid;
    grid-template-columns: var(--rsl-calendar-time-gutter-width) repeat(7, 1fr);
    overflow-y: auto;
}

.rsl-calendar-time-slot {
    height: var(--rsl-calendar-week-cell-height);
    border-bottom: 1px solid var(--rsl-calendar-border);
    padding: 0 0.5rem;
    display: flex;
    align-items: flex-start;
    font-size: 0.75rem;
    color: var(--rsl-calendar-text-muted);
    padding-top: 0.25rem;
}

.rsl-calendar-week-column {
    position: relative;
    border-right: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-week-column:last-child {
    border-right: none;
}

.rsl-calendar-week-cell {
    height: var(--rsl-calendar-week-cell-height);
    border-bottom: 1px solid var(--rsl-calendar-border);
    position: relative;
}

.rsl-calendar-week-cell:hover {
    background: var(--rsl-calendar-cell-hover);
}

/* Events in week view */
.rsl-calendar-week-event {
    position: absolute;
    left: 2px;
    right: 2px;
    padding: 4px 6px;
    background: var(--rsl-calendar-event-default);
    color: var(--rsl-calendar-event-text);
    border-radius: 4px;
    font-size: 0.75rem;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
}

.rsl-calendar-week-event:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
    background-color: var(--rsl-calendar-event-focus-bg) !important;
    color: var(--rsl-calendar-event-focus-text) !important;
    z-index: 2;
}

.rsl-calendar-week-event-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rsl-calendar-week-event-time {
    font-size: 0.7rem;
    opacity: 0.9;
}

/* ==========================================================================
   Day View
   ========================================================================== */

.rsl-calendar[data-view="day"] .rsl-calendar-header {
    grid-template-columns: var(--rsl-calendar-time-gutter-width) 1fr;
}

.rsl-calendar[data-view="day"] .rsl-calendar-header-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
}

.rsl-calendar[data-view="day"] .rsl-calendar-header-cell .day-full {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--rsl-calendar-text);
}

.rsl-calendar-day-grid {
    flex: 1;
    display: grid;
    grid-template-columns: var(--rsl-calendar-time-gutter-width) 1fr;
    overflow-y: auto;
}

.rsl-calendar-day-column {
    position: relative;
}

.rsl-calendar-day-cell {
    height: var(--rsl-calendar-day-hour-height);
    border-bottom: 1px solid var(--rsl-calendar-border);
    position: relative;
}

.rsl-calendar-day-cell:hover {
    background: var(--rsl-calendar-cell-hover);
}

/* Events in day view */
.rsl-calendar-day-event {
    position: absolute;
    left: 4px;
    right: 4px;
    padding: 8px;
    background: var(--rsl-calendar-event-default);
    color: var(--rsl-calendar-event-text);
    border-radius: 6px;
    font-size: 0.875rem;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
}

.rsl-calendar-day-event:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
    background-color: var(--rsl-calendar-event-focus-bg) !important;
    color: var(--rsl-calendar-event-focus-text) !important;
    z-index: 2;
}

.rsl-calendar-day-event-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.rsl-calendar-day-event-time {
    font-size: 0.75rem;
    opacity: 0.9;
}

.rsl-calendar-day-event-description {
    font-size: 0.75rem;
    opacity: 0.85;
    margin-top: 0.25rem;
}

/* ==========================================================================
   Year View
   ========================================================================== */

.rsl-calendar[data-view="year"] .rsl-calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.5rem;
    padding: 1.5rem;
    overflow-y: auto;
}

.rsl-calendar-mini-month {
    background: var(--rsl-calendar-cell-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 8px;
    overflow: hidden;
}

.rsl-calendar-mini-month-header {
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
    background: var(--rsl-calendar-header-bg);
    border-bottom: 1px solid var(--rsl-calendar-border);
    cursor: pointer;
    transition: background var(--rsl-calendar-transition);
}

.rsl-calendar-mini-month-header:hover {
    background: var(--rsl-calendar-cell-hover);
}

.rsl-calendar-mini-month-header:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring-inset);
}

.rsl-calendar-mini-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    padding: 0.5rem;
}

.rsl-calendar-mini-header {
    font-size: 0.6rem;
    text-align: center;
    color: var(--rsl-calendar-text-muted);
    padding: 0.25rem 0;
}

.rsl-calendar-mini-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    color: var(--rsl-calendar-text);
    border-radius: 50%;
    cursor: pointer;
    transition: background var(--rsl-calendar-transition);
}

.rsl-calendar-mini-day:hover {
    background: var(--rsl-calendar-cell-hover);
}

.rsl-calendar-mini-day:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
}

.rsl-calendar-mini-day.outside {
    color: var(--rsl-calendar-text-outside);
}

.rsl-calendar-mini-day.today {
    background: var(--rsl-calendar-btn-active);
    color: #ffffff;
}

.rsl-calendar-mini-day.has-events::after {
    content: '';
    position: absolute;
    bottom: 2px;
    width: 4px;
    height: 4px;
    background: var(--rsl-calendar-event-default);
    border-radius: 50%;
}

/* ==========================================================================
   Event Panel / Form
   ========================================================================== */

.rsl-calendar-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 400px;
    max-width: 100%;
    height: 100vh;
    background: var(--rsl-calendar-panel-bg);
    box-shadow: var(--rsl-calendar-panel-shadow);
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 100000; /* Above navbar (10000-10002) and all other overlays */
    display: flex;
    flex-direction: column;
}

.rsl-calendar-panel.open {
    transform: translateX(0);
}

.rsl-calendar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--rsl-calendar-panel-border);
}

.rsl-calendar-panel-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: var(--rsl-calendar-text);
}

.rsl-calendar-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    color: var(--rsl-calendar-text-muted);
    transition: background var(--rsl-calendar-transition);
}

.rsl-calendar-panel-close:hover {
    background: var(--rsl-calendar-btn-hover);
    color: var(--rsl-calendar-text);
}

.rsl-calendar-panel-close:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
}

.rsl-calendar-panel-body {
    flex: 1;
    padding: 1.25rem;
    overflow-y: auto;
}

.rsl-calendar-form-group {
    margin-bottom: 1.25rem;
}

.rsl-calendar-form-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--rsl-calendar-text);
    margin-bottom: 0.5rem;
}

.rsl-calendar-form-input,
.rsl-calendar-form-select,
.rsl-calendar-form-textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--rsl-calendar-cell-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--rsl-calendar-text);
    transition: border-color var(--rsl-calendar-transition),
                box-shadow var(--rsl-calendar-transition);
}

.rsl-calendar-form-input:focus,
.rsl-calendar-form-select:focus,
.rsl-calendar-form-textarea:focus {
    outline: none;
    border-color: var(--rsl-calendar-btn-active);
    box-shadow: var(--rsl-calendar-focus-ring);
}

.rsl-calendar-form-textarea {
    min-height: 100px;
    resize: vertical;
}

.rsl-calendar-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Date picker integration */
.rsl-calendar-form-group-date {
    position: relative;
}

.rsl-calendar-form-group-date .rsl-date-picker {
    width: 100%;
}

.rsl-calendar-form-group-date .rsl-date-picker-wrapper {
    width: 100%;
}

.rsl-calendar-form-group-date .rsl-date-picker-field {
    width: 100%;
}

.rsl-calendar-form-group-date .rsl-date-picker-field input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    padding-right: 2.5rem;
    background: var(--rsl-calendar-cell-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--rsl-calendar-text);
}

.rsl-calendar-form-group-date .rsl-date-picker-field input:focus {
    outline: none;
    border-color: var(--rsl-calendar-btn-active);
    box-shadow: var(--rsl-calendar-focus-ring);
}

/* Date picker popover z-index within calendar panel */
.rsl-calendar-panel .rsl-date-picker-popover {
    z-index: 100002;
}

/* RSL Select integration */
.rsl-calendar-form-group .rsl-select {
    width: 100%;
}

.rsl-calendar-form-group .rsl-select .rsl-select-trigger {
    width: 100%;
    padding: 0.625rem 0.75rem;
    background: var(--rsl-calendar-cell-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 6px;
    font-size: 0.875rem;
    color: var(--rsl-calendar-text);
}

.rsl-calendar-form-group .rsl-select .rsl-select-trigger:focus {
    outline: none;
    border-color: var(--rsl-calendar-btn-active);
    box-shadow: var(--rsl-calendar-focus-ring);
}

/* RSL Select dropdown z-index within calendar panel */
.rsl-calendar-panel .rsl-select-dropdown {
    z-index: 100002;
}

.rsl-calendar-panel-footer {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--rsl-calendar-panel-border);
}

.rsl-calendar-panel-footer .rsl-calendar-btn {
    flex: 1;
}

.rsl-calendar-btn-danger {
    background: var(--rsl-calendar-category-holiday);
    color: #ffffff;
    border-color: var(--rsl-calendar-category-holiday);
}

.rsl-calendar-btn-danger:hover {
    background: #c62828;
    border-color: #c62828;
}

/* ==========================================================================
   Overlay
   ========================================================================== */

.rsl-calendar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 99999; /* Just below panel (100000) but above navbar */
}

.rsl-calendar-overlay.visible {
    opacity: 1;
    visibility: visible;
}

/* ==========================================================================
   Live Region (Screen Reader Announcements)
   ========================================================================== */

.rsl-calendar-live-region {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   Loading State
   ========================================================================== */

.rsl-calendar-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

[data-theme="dark"] .rsl-calendar-loading {
    background: rgba(30, 30, 30, 0.8);
}

.rsl-calendar-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--rsl-calendar-border);
    border-top-color: var(--rsl-calendar-btn-active);
    border-radius: 50%;
    animation: rsl-calendar-spin 0.8s linear infinite;
}

@keyframes rsl-calendar-spin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.rsl-calendar-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    text-align: center;
    color: var(--rsl-calendar-text-muted);
}

.rsl-calendar-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.rsl-calendar-empty-text {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.rsl-calendar-empty-hint {
    font-size: 0.875rem;
    opacity: 0.75;
}

/* ==========================================================================
   Current Time Indicator
   ========================================================================== */

.rsl-calendar-current-time {
    position: absolute;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--rsl-calendar-category-holiday);
    z-index: 10;
    pointer-events: none;
}

.rsl-calendar-current-time::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -4px;
    width: 10px;
    height: 10px;
    background: var(--rsl-calendar-category-holiday);
    border-radius: 50%;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

/* Ensure calendar fills container properly */
.rsl-calendar {
    width: 100%;
    max-width: 100%;
    overflow: hidden;
}

/* Month view grid - ensure proper sizing */
.rsl-calendar-body {
    min-width: 0; /* Allow grid to shrink */
}

.rsl-calendar-cell {
    min-width: 0; /* Allow cells to shrink */
    overflow: hidden;
}

/* Tablet and below - 1024px */
@media (max-width: 1024px) {
    .rsl-calendar[data-view="year"] .rsl-calendar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Tablet - 768px */
@media (max-width: 768px) {
    .rsl-calendar {
        --rsl-calendar-cell-min-height: 70px;
        --rsl-calendar-week-cell-height: 50px;
        --rsl-calendar-day-hour-height: 50px;
        --rsl-calendar-time-gutter-width: 50px;
        min-height: 450px;
    }

    .rsl-calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .rsl-calendar-nav {
        justify-content: center;
        order: 2;
    }

    .rsl-calendar-title {
        margin: 0;
        min-width: auto;
        font-size: 1.1rem;
        order: 1;
        text-align: center;
    }

    .rsl-calendar-views {
        justify-content: center;
        order: 3;
    }

    .rsl-calendar-actions {
        justify-content: center;
        order: 4;
    }

    .rsl-calendar-header-cell {
        font-size: 0.65rem;
        padding: 0.5rem 0.25rem;
    }

    .rsl-calendar-day-number {
        width: 22px;
        height: 22px;
        font-size: 0.75rem;
    }

    .rsl-calendar-event {
        font-size: 0.65rem;
        padding: 1px 4px;
    }

    /* Year view responsive */
    .rsl-calendar[data-view="year"] .rsl-calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
        padding: 1rem;
    }

    /* Panel responsive */
    .rsl-calendar-panel {
        width: 100%;
    }

    /* Week view - horizontal scroll wrapper */
    .rsl-calendar[data-view="week"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-grid {
        min-width: 700px;
        width: max-content;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header {
        min-width: 700px;
    }

    .rsl-calendar-week-grid {
        min-width: 700px;
    }

    /* Day view - horizontal scroll on tablet */
    .rsl-calendar[data-view="day"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-grid {
        min-width: 400px;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header {
        min-width: 400px;
    }

    .rsl-calendar-day-grid {
        min-width: 400px;
    }

    /* Week/day view header adjustments */
    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-number,
    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell .day-number {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell .day-full {
        font-size: 1.25rem;
    }
}

/* Mobile - 576px */
@media (max-width: 576px) {
    .rsl-calendar {
        --rsl-calendar-cell-min-height: 55px;
        --rsl-calendar-week-cell-height: 45px;
        --rsl-calendar-day-hour-height: 45px;
        --rsl-calendar-time-gutter-width: 45px;
        min-height: 400px;
    }

    .rsl-calendar-toolbar {
        padding: 0.5rem;
    }

    .rsl-calendar-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .rsl-calendar-btn-icon {
        padding: 0.4rem;
        min-width: 32px;
    }

    .rsl-calendar-title {
        font-size: 1rem;
    }

    .rsl-calendar-views {
        padding: 0.125rem;
    }

    .rsl-calendar-views .rsl-calendar-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    .rsl-calendar-header-cell {
        font-size: 0.6rem;
        padding: 0.375rem 0.125rem;
    }

    /* Use single letter day names on small screens via CSS content */
    .rsl-calendar-header-cell {
        overflow: hidden;
        text-overflow: clip;
    }

    .rsl-calendar-cell {
        padding: 0.25rem;
    }

    .rsl-calendar-day-number {
        width: 20px;
        height: 20px;
        font-size: 0.7rem;
        margin-bottom: 0.125rem;
    }

    .rsl-calendar-event {
        font-size: 0.6rem;
        padding: 1px 3px;
    }

    .rsl-calendar-event-time {
        display: none; /* Hide time on small screens */
    }

    .rsl-calendar-events {
        gap: 1px;
    }

    /* Year view on mobile - 2 columns still */
    .rsl-calendar[data-view="year"] .rsl-calendar-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
        padding: 0.75rem;
    }

    .rsl-calendar-mini-month {
        border-radius: 6px;
    }

    .rsl-calendar-mini-month-header {
        padding: 0.5rem;
        font-size: 0.85rem;
    }

    .rsl-calendar-mini-grid {
        padding: 0.25rem;
    }

    .rsl-calendar-mini-day {
        font-size: 0.6rem;
    }

    /* Week view - scrollable with minimum width */
    .rsl-calendar[data-view="week"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-grid {
        min-width: 600px;
        width: max-content;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header {
        min-width: 600px;
    }

    .rsl-calendar-week-grid {
        min-width: 600px;
    }

    /* Day view - scrollable */
    .rsl-calendar[data-view="day"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-grid {
        min-width: 320px;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header {
        min-width: 320px;
    }

    .rsl-calendar-day-grid {
        min-width: 320px;
    }

    /* Week/day header compact */
    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell,
    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell {
        padding: 0.375rem;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-name {
        font-size: 0.6rem;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-number {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell .day-full {
        font-size: 1rem;
    }

    .rsl-calendar-time-slot {
        font-size: 0.6rem;
        padding: 0 0.25rem;
    }

    .rsl-calendar-week-event,
    .rsl-calendar-day-event {
        padding: 2px 4px;
    }

    .rsl-calendar-week-event-title,
    .rsl-calendar-day-event-title {
        font-size: 0.65rem;
    }

    .rsl-calendar-week-event-time,
    .rsl-calendar-day-event-time {
        font-size: 0.55rem;
    }

    /* Form adjustments */
    .rsl-calendar-form-row {
        grid-template-columns: 1fr;
    }
}

/* Extra small mobile - 400px */
@media (max-width: 400px) {
    .rsl-calendar {
        --rsl-calendar-cell-min-height: 45px;
        min-height: 350px;
    }

    .rsl-calendar-toolbar {
        padding: 0.375rem;
        gap: 0.375rem;
    }

    .rsl-calendar-nav {
        gap: 0.25rem;
    }

    .rsl-calendar-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.7rem;
    }

    .rsl-calendar-btn-icon {
        padding: 0.35rem;
        min-width: 28px;
    }

    .rsl-calendar-btn-icon svg {
        width: 14px;
        height: 14px;
    }

    .rsl-calendar-title {
        font-size: 0.9rem;
        margin: 0;
    }

    .rsl-calendar-views .rsl-calendar-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.65rem;
    }

    .rsl-calendar-header-cell {
        font-size: 0.55rem;
        padding: 0.25rem 0;
    }

    .rsl-calendar-cell {
        padding: 0.125rem;
    }

    .rsl-calendar-day-number {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }

    /* Show event dots instead of full events on very small screens */
    .rsl-calendar-event {
        width: 100%;
        height: 4px;
        padding: 0;
        border-radius: 2px;
        min-height: 4px;
    }

    .rsl-calendar-event-time,
    .rsl-calendar-event-title {
        display: none;
    }

    .rsl-calendar-event-more {
        font-size: 0.55rem;
    }

    .rsl-calendar-events {
        gap: 2px;
        max-height: calc(var(--rsl-calendar-cell-min-height) - 24px);
    }

    /* Year view single column on very small */
    .rsl-calendar[data-view="year"] .rsl-calendar-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
        padding: 0.5rem;
    }

    /* Week view - compact scrollable */
    .rsl-calendar[data-view="week"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-grid {
        min-width: 550px;
        width: max-content;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header {
        min-width: 550px;
    }

    .rsl-calendar-week-grid {
        min-width: 550px;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
        margin-top: 0.125rem;
    }

    .rsl-calendar[data-view="week"] .rsl-calendar-header-cell .day-name {
        font-size: 0.55rem;
    }

    /* Day view - compact scrollable */
    .rsl-calendar[data-view="day"] {
        overflow-x: auto;
        overflow-y: hidden;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-grid {
        min-width: 280px;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header {
        min-width: 280px;
    }

    .rsl-calendar-day-grid {
        min-width: 280px;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell .day-full {
        font-size: 0.85rem;
    }

    .rsl-calendar[data-view="day"] .rsl-calendar-header-cell {
        padding: 0.5rem 0.25rem;
    }

    /* Event popover */
    .rsl-calendar-event-popover {
        min-width: 240px;
        max-width: calc(100vw - 2rem);
    }
}

/* ==========================================================================
   High Contrast Mode
   ========================================================================== */

@media (prefers-contrast: high) {
    .rsl-calendar {
        border-width: 2px;
    }

    .rsl-calendar-cell {
        border-width: 2px;
    }

    .rsl-calendar-cell:focus-visible {
        box-shadow: inset 0 0 0 3px #000000;
    }

    .rsl-calendar-event:focus-visible {
        box-shadow: 0 0 0 3px #000000;
    }

    .rsl-calendar-btn:focus-visible {
        box-shadow: 0 0 0 3px #000000;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .rsl-calendar,
    .rsl-calendar *,
    .rsl-calendar-panel,
    .rsl-calendar-overlay {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Event Detail Popover (Read-Only View)
   ========================================================================== */

.rsl-calendar-event-popover {
    position: fixed;
    min-width: 280px;
    max-width: 360px;
    background: var(--rsl-calendar-panel-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    z-index: 100001; /* Above panel (100000) */
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.rsl-calendar-event-popover.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.rsl-calendar-event-popover-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-event-popover-header h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--rsl-calendar-text);
    line-height: 1.3;
    padding-right: 1rem;
}

.rsl-calendar-event-popover-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: var(--rsl-calendar-text-muted);
    flex-shrink: 0;
    transition: background 0.2s ease, color 0.2s ease;
}

.rsl-calendar-event-popover-close:hover {
    background: var(--rsl-calendar-btn-hover);
    color: var(--rsl-calendar-text);
}

.rsl-calendar-event-popover-close:focus-visible {
    outline: none;
    box-shadow: var(--rsl-calendar-focus-ring);
}

.rsl-calendar-event-popover-close svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.rsl-calendar-event-popover-body {
    padding: 1rem;
}

.rsl-calendar-event-popover-meta {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.rsl-calendar-event-popover-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    font-size: 0.9rem;
    color: var(--rsl-calendar-text);
}

.rsl-calendar-event-popover-row svg {
    width: 16px;
    height: 16px;
    fill: var(--rsl-calendar-text-muted);
    flex-shrink: 0;
    margin-top: 2px;
}

.rsl-calendar-event-popover-row > span {
    flex: 1;
}

.rsl-calendar-event-popover-category {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.rsl-calendar-event-popover-category-dot {
    width: 8px;
    height: 8px;
    min-width: 8px;
    min-height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.rsl-calendar-event-popover-description {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-event-popover-description p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--rsl-calendar-text);
    line-height: 1.5;
}

/* Dark mode popover */
[data-theme="dark"] .rsl-calendar-event-popover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .rsl-calendar-event-popover-category {
    background: rgba(255, 255, 255, 0.1);
}

/* ==========================================================================
   Upcoming Events Section
   ========================================================================== */

/* Main wrapper for sidebar layout */
.rsl-calendar-main-wrapper {
    display: flex;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.rsl-calendar[data-upcoming="sidebar"] .rsl-calendar-grid {
    flex: 1;
    min-width: 0;
}

/* Upcoming events container */
.rsl-calendar-upcoming {
    background: var(--rsl-calendar-bg);
    border: 1px solid var(--rsl-calendar-border);
    border-radius: 8px;
    overflow: hidden;
}

/* Below mode - full width under calendar */
.rsl-calendar[data-upcoming="below"] .rsl-calendar-upcoming {
    margin-top: 1rem;
    border-top: 1px solid var(--rsl-calendar-border);
    border-radius: 0 0 8px 8px;
    margin-left: -1px;
    margin-right: -1px;
    margin-bottom: -1px;
}

/* Sidebar mode - side by side with calendar */
.rsl-calendar[data-upcoming="sidebar"] .rsl-calendar-upcoming {
    width: 300px;
    min-width: 260px;
    max-width: 350px;
    border-left: none;
    border-radius: 0 8px 8px 0;
    display: flex;
    flex-direction: column;
}

/* Only mode - just the upcoming section */
.rsl-calendar[data-upcoming="only"] {
    min-height: auto;
}

.rsl-calendar[data-upcoming="only"] .rsl-calendar-upcoming {
    border: none;
    border-radius: 8px;
}

/* Upcoming header */
.rsl-calendar-upcoming-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: var(--rsl-calendar-header-bg);
    border-bottom: 1px solid var(--rsl-calendar-border);
}

.rsl-calendar-upcoming-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--rsl-calendar-header-text);
}

.rsl-calendar-upcoming-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 24px;
    padding: 0 8px;
    background: var(--rsl-calendar-btn-active);
    color: #ffffff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 12px;
}

/* Upcoming list */
.rsl-calendar-upcoming-list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    flex: 1;
}

/* Upcoming event item */
.rsl-calendar-upcoming-item {
    display: flex;
    align-items: stretch;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--rsl-calendar-border);
    cursor: pointer;
    transition: background var(--rsl-calendar-transition);
}

.rsl-calendar-upcoming-item:last-child {
    border-bottom: none;
}

.rsl-calendar-upcoming-item:hover {
    background: var(--rsl-calendar-cell-hover);
}

.rsl-calendar-upcoming-item:focus,
.rsl-calendar-upcoming-item:focus-visible {
    outline: none;
    background: var(--rsl-calendar-cell-selected);
    box-shadow: var(--rsl-calendar-focus-ring-inset);
}

/* Category indicator */
.rsl-calendar-upcoming-item-indicator {
    width: 4px;
    min-width: 4px;
    border-radius: 2px;
    margin-right: 0.875rem;
    flex-shrink: 0;
}

/* Item content */
.rsl-calendar-upcoming-item-content {
    flex: 1;
    min-width: 0;
}

.rsl-calendar-upcoming-item-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rsl-calendar-text);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rsl-calendar-upcoming-item-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    color: var(--rsl-calendar-text-muted);
    margin-bottom: 0.25rem;
}

.rsl-calendar-upcoming-item-date {
    font-weight: 500;
}

.rsl-calendar-upcoming-item-time {
    opacity: 0.85;
}

.rsl-calendar-upcoming-item-time::before {
    content: '•';
    margin-right: 0.75rem;
}

.rsl-calendar-upcoming-item-category {
    display: inline-block;
    font-size: 0.7rem;
    color: var(--rsl-calendar-text-muted);
    background: var(--rsl-calendar-btn-bg);
    padding: 0.125rem 0.5rem;
    border-radius: 10px;
    text-transform: capitalize;
}

/* Empty state */
.rsl-calendar-upcoming-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2.5rem 1.5rem;
    text-align: center;
    color: var(--rsl-calendar-text-muted);
}

.rsl-calendar-upcoming-empty-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.rsl-calendar-upcoming-empty-text {
    font-size: 0.9rem;
}

/* ==========================================================================
   Upcoming Events - Responsive Styles
   ========================================================================== */

/* Tablet and below */
@media (max-width: 1024px) {
    /* Sidebar stacks below on smaller screens */
    .rsl-calendar-main-wrapper {
        flex-direction: column;
    }

    .rsl-calendar[data-upcoming="sidebar"] .rsl-calendar-upcoming {
        width: 100%;
        max-width: none;
        min-width: 0;
        border-left: 1px solid var(--rsl-calendar-border);
        border-top: none;
        border-radius: 0 0 8px 8px;
        max-height: 300px;
    }
}

/* Mobile */
@media (max-width: 576px) {
    .rsl-calendar-upcoming-header {
        padding: 0.75rem 1rem;
    }

    .rsl-calendar-upcoming-title {
        font-size: 0.9rem;
    }

    .rsl-calendar-upcoming-item {
        padding: 0.75rem;
    }

    .rsl-calendar-upcoming-item-title {
        font-size: 0.85rem;
    }

    .rsl-calendar-upcoming-item-meta {
        font-size: 0.75rem;
        gap: 0.5rem;
    }

    .rsl-calendar-upcoming-item-category {
        font-size: 0.65rem;
    }

    .rsl-calendar[data-upcoming="sidebar"] .rsl-calendar-upcoming {
        max-height: 250px;
    }
}

/* Extra small */
@media (max-width: 400px) {
    .rsl-calendar-upcoming-item-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.125rem;
    }

    .rsl-calendar-upcoming-item-time::before {
        display: none;
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .rsl-calendar {
        border: 1px solid #000;
        box-shadow: none;
    }

    .rsl-calendar-toolbar {
        background: #fff;
    }

    .rsl-calendar-btn {
        display: none;
    }

    .rsl-calendar-title {
        display: block;
    }

    .rsl-calendar-cell {
        background: #fff !important;
    }

    .rsl-calendar-event {
        background: #ddd !important;
        color: #000 !important;
    }

    .rsl-calendar-panel,
    .rsl-calendar-overlay {
        display: none !important;
    }
}
