/* Modern Event Calendar Styles with senior-friendly design */
:root {
    --calendar-max-width: 1200px;
    --calendar-cell-size-mobile: 80px; /* Increased from 40px */
    --calendar-cell-size-tablet: 90px; /* Increased from 60px */
    --calendar-cell-size-desktop: 110px; /* Increased from 80px */
}

.calendar-wrapper {
    width: 100%;
    max-width: var(--calendar-max-width);
    margin: 0 auto;
    padding: 1rem;
}

.calendar-container {
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 1.25rem; /* Reduced from 2rem */
    max-width: 1200px;
    margin: 1.5rem auto; /* Reduced top/bottom margin */
    font-size: 16px;
}

/* Header Styles */
.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem; /* Reduced from 2rem */
}

.month-title {
    font-size: 1.3rem; /* Further reduced from 1.75rem */
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    text-align: center;
}

.nav-button {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 1rem;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-button:hover {
    background: #e9ecef;
    color: #212529;
}

.nav-button:focus {
    outline: 3px solid #4dabf7;
    outline-offset: 2px;
}

/* Calendar Grid */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    width: 100%;
    gap: 1px;
    background-color: #E5E7EB;
    border: 1px solid #E5E7EB;
    border-radius: 0.5rem;
    overflow: hidden;
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.weekday {
    padding: 1rem;
    text-align: center;
    font-weight: 600;
    color: #495057;
    font-size: 1.125rem; /* Added larger font size for weekday headers */
}

.weekday .full-name {
    display: none;
}

@media (min-width: 768px) {
    .weekday .full-name {
        display: block;
    }
    .weekday .short-name {
        display: none;
    }
}

.calendar-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #e9ecef;
}

/* Cell layout */
.calendar-cell {
    min-height: var(--calendar-cell-size-desktop);
    position: relative;
    background: white;
    padding: 0.5rem; /* Reduced padding */
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Prevent content overflow */
}

.calendar-cell.inactive {
    background: #f8f9fa;
}

.calendar-cell.weekend {
    background: #FFFBEB;
    border-color: #FEF3C7;
}

.calendar-cell.today {
    background: #e7f5ff;
}

.date-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.date-number {
    font-size: 1.375rem; /* Increased from 1.25rem */
    font-weight: 600;
    color: #212529;
}

.inactive .date-number {
    color: #adb5bd;
}

.cost-indicator {
    font-size: 1rem; /* Increased from 0.875rem */
    font-weight: 600;
    color: #2b8a3e;
    background: #d3f9d8;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
}

/* Events Styling */
.events-container {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden; /* Prevent overflow */
    padding: 0.125rem; /* Add small padding */
}

.event {
    margin: 1px;
    padding: 0.125rem 0.25rem; /* Reduced padding */
    font-size: 0.6875rem; /* Decreased from 0.75rem */
    border-radius: 4px;
    cursor: pointer;
    transition: transform 0.2s ease;
    overflow: hidden; /* Prevent text overflow */
    text-overflow: ellipsis; /* Show ellipsis for long text */
    white-space: nowrap; /* Prevent text wrapping */
}

.event:hover {
    transform: translateY(-2px);
}

.event.available {
    background-color: #DCFCE7;
    color: #166534;
}

.event.booked {
    background-color: #FEE2E2;
    color: #991B1B;
}

.event-title {
    font-weight: 600;
    font-size: 0.8125rem; /* Decreased from 0.9375rem */
    margin-bottom: 0.25rem;
}

.event-details {
    font-size: 0.9375rem; /* Decreased from 1.0625rem */
    opacity: 0.9;
}

/* Legend Styling */
.calendar-legend {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 2px solid #e9ecef;
}

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

.legend-dot {
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
}

.legend-dot.available {
    background: #d3f9d8;
    border: 2px solid #8ce99a;
}

.legend-dot.booked {
    background: #ffe3e3;
    border: 2px solid #ffa8a8;
}

.legend-dot.today {
    background: #e7f5ff;
    border: 2px solid #74c0fc;
}

.legend-text {
    font-size: 1rem;
    color: #495057;
    font-weight: 500;
}

/* Accessibility Improvements */
@media (prefers-reduced-motion: reduce) {
    .event {
        transition: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .event.available {
        background: #000000;
        color: #ffffff;
        border-color: #ffffff;
    }
    .event.booked {
        background: #ffffff;
        color: #000000;
        border-color: #000000;
    }
}

/* Large Screen Optimizations */
@media (min-width: 1200px) {
    .calendar-container {
        padding: 3rem;
    }
    
    .month-title {
        font-size: 1.75rem;
    }
    
    .calendar-cell {
        min-height: 150px;
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .calendar-wrapper {
        padding: 0.5rem;
    }

    .calendar-container {
        padding: 1rem;
        margin: 1rem;
    }
    
    .month-title {
        font-size: 1.5rem;
    }
    
    .calendar-cell {
        min-height: var(--calendar-cell-size-mobile);
        padding: 0.375rem; /* Reduced padding for mobile */
    }
    
    .date-number {
        font-size: 1rem;
    }
    
    .cost-indicator {
        font-size: 0.75rem;
    }
    
    .event {
        font-size: 0.5625rem; /* Decreased from 0.625rem */
        padding: 0.0625rem 0.125rem; /* Much smaller padding */
        margin: 0.5px; /* Reduced margin */
    }
    
    .calendar-legend {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}

/* Responsive adjustments */
@media (min-width: 641px) and (max-width: 1024px) {
    .calendar-cell {
        min-height: var(--calendar-cell-size-tablet);
        padding: 0.5rem; /* Appropriate padding for tablet */
    }
    
    .event {
        font-size: 0.625rem; /* Decreased from 0.6875rem */
        padding: 0.125rem 0.1875rem;
        margin: 1px;
    }
}

/* Print styles */
@media print {
    .calendar-wrapper {
        width: 100% !important;
        max-width: none !important;
    }
}
