/* PayPal Event Calendar Styles */
.paypal-event-calendar-container {
    max-width: 1200px;
    margin: 0 auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    box-sizing: border-box;
}

.paypal-event-calendar-container *,
.paypal-event-calendar-container *:before,
.paypal-event-calendar-container *:after {
    box-sizing: inherit;
}

.calendar-header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 20px;
    width: 100%;
    flex-wrap: wrap;
}

.calendar-title {
    font-size: 28px;
    margin: 0;
    padding: 0;
    color: #666;
}

.calendar-filter-controls {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
}

.filter-item {
    margin-left: 10px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.filter-item label {
    margin-right: 5px;
    font-weight: normal;
}

.calendar-month-dropdown,
.calendar-year-dropdown {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    min-width: 120px;
}

.view-calendar-button {
    padding: 8px 16px;
    background-color: #ffccd5;
    color: #333;
    border: 1px solid #ffb8c6;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.view-calendar-button:hover {
    background-color: #ffa8b8;
}

/* List All button - matches View Calendar styling */
.list-all-button {
    padding: 8px 16px;
    background-color: #ffccd5;
    color: #333;
    border: 1px solid #ffb8c6;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
}

.list-all-button:hover {
    background-color: #ffa8b8;
}

/* List All Mode - forces mobile-style list view on all screen sizes */
.list-all-mode .desktop-view {
    display: none !important;
}

.list-all-mode .mobile-event-list {
    display: block !important;
}

/* Monthly calendar container styles for 'View All Months' mode */
.monthly-calendar-container {
    margin-bottom: 40px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #ddd;
}

.monthly-calendar-container:last-child {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

.monthly-calendar-title {
    font-size: 22px;
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

/* Calendar grid - Desktop view */
.calendar-grid {
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow: hidden;
    width: 100%;
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f0f0f0;
    border-bottom: 1px solid #ddd;
    font-weight: bold;
    width: 100%;
}

.weekdays div {
    padding: 10px;
    text-align: center;
}

.days {
  display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    width: 100%;
}

.days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #fff;
    width: 100%;
    grid-auto-rows: minmax(120px, auto); /* Ensures minimum height */
}

.day {
    min-height: 120px;
    height: 100%;
    padding: 5px;
    border-right: 1px solid #eee;
    border-bottom: 1px solid #eee;
    position: relative;
    overflow: hidden; /* Prevents content from breaking layout */
}

.day:nth-child(7n) {
    border-right: none;
}

.day.empty {
    background: #f9f9f9;
}

.day-number {
    font-weight: bold;
    margin-bottom: 5px;
    color: #666;   
    position: absolute;
    top: 5px;
    right: 8px;
    z-index: 1; /* Keep day number above events */
}

.has-events .day-number {
    color: #0070ba;
}

.events-list {
    font-size: 13px;
    margin-top: 25px; /* Adjusted to leave room for day number */
    margin-bottom: 5px;
    overflow-y: auto; /* Allow scrolling if too many events */
    max-height: calc(100% - 30px); /* Leave room for day number */
}

.event-item {
    margin-bottom: 3px;
    padding: 2px 4px;
    background: #f0f7ff;
    border-left: 3px solid #0070ba;
    border-radius: 2px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background-color 0.2s;
    font-size: 11px; /* Slightly smaller to fit more */
    max-width: 100%; /* Prevent overflow */
}

.event-item:hover {
    background: #e0f0ff;
}

/* Mobile event list */
.mobile-event-list {
    display: none;
    margin-top: 20px;
}

.mobile-date-group {
    margin-bottom: 20px;
}

.mobile-date-header {
    background: #f0f0f0;
    padding: 10px;
    margin: 0 0 10px 0;
    border-radius: 4px;
}

.mobile-event-item {
    padding: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.mobile-event-item:hover {
    background: #f8f8f8;
}

.mobile-event-title {
    font-weight: bold;
    margin-bottom: 5px;
}

.mobile-event-host {
    font-size: 14px;
    color: #666;
}

/* Event popup */
.event-popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    overflow-y: auto;
}

.event-popup-container {
    position: relative;
    max-width: 800px;
    margin: 50px auto;
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.event-popup-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    color: #999;
    cursor: pointer;
    line-height: 1;
}

.event-popup-close:hover {
    color: #333;
}

/* Loading state */
.calendar-loading {
    position: relative;
    min-height: 200px;
}

.calendar-loading:after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7) url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 50 50"><path fill="%230070ba" d="M25.251,6.461c-10.318,0-18.683,8.365-18.683,18.683h4.068c0-8.071,6.543-14.615,14.615-14.615V6.461z" transform="rotate(275.098 25 25)"><animateTransform attributeType="xml" attributeName="transform" type="rotate" from="0 25 25" to="360 25 25" dur="0.8s" repeatCount="indefinite"/></path></svg>') center center no-repeat;
    z-index: 9999;
}

/* Media Queries for Responsive Design */
@media screen and (max-width: 992px) {
    .day {
        min-height: 80px;
    }
    
    .event-popup-container {
        margin: 40px 20px;
    }
}

@media screen and (max-width: 768px) {
    .calendar-header-wrapper {
        flex-direction: column;
    }
    
    .calendar-title {
        margin-bottom: 15px;
    }
    
    .calendar-filter-controls {
        width: 100%;
    }
    
    .filter-item {
        margin-left: 0;
        margin-right: 10px;
    }
    
    .day {
        min-height: 80px;
    }
    .days {
        grid-auto-rows: minmax(80px, auto);
    }
    .event-item {
        font-size: 10px;
        padding: 1px 3px;
    }
}

@media screen and (max-width: 576px) {
    .desktop-view {
        display: none;
    }
    
    .mobile-event-list {
        display: block;
    }
    
    .event-popup-container {
        margin: 20px 10px;
        padding: 15px;
    }
}