* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #e4cae2;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

h1 {
    color: #580977;
    text-align: center;
    margin-bottom: 30px;
}

.calendar-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-bottom: 10px;
    font-weight: bold;
    text-align: center;
    color: #580977;
}

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

.calendar-day {
    min-height: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    overflow-y: auto; /* Enable scroll for many events */
    max-height: 250px;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
}

.calendar-day:hover {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.date-number {
    font-weight: bold;
    margin-bottom: 8px;
    color: #580977;
    font-size: 1.1em;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.events-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    flex-grow: 1;
}

.event {
    background: #e4cae2;
    padding: 8px;
    border-radius: 6px;
    font-size: 12px;
    word-break: break-word;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    padding-left: 15px;
    border-left: 3px solid #580977;
    margin-bottom: 8px; /* Add space between events */
}

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

.event::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 50%;
    width: 6px;
    height: 6px;
    background: #580977;
    border-radius: 50%;
    transform: translateY(-50%);
}

.event-title {
    font-weight: bold;
    color: #580977;
    margin-bottom: 3px;
}

.event-time {
    font-size: 11px;
    color: #666;
    margin-top: 2px;
}

.event-copy {
    font-size: 11px;
    margin-top: 3px;
    display: none;
    color: #444;
    line-height: 1.4;
}

.event.expanded .event-copy {
    display: block;
}

.event.expanded {
    background: #d4b5d2;
}

.today {
    border: 2px solid #580977;
    background-color: #faf5fa;
}

.other-month {
    background: #f9f9f9;
}

.back-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    padding: 15px 30px;
    background: #a80873;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
    z-index: 1000;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.back-button:hover {
    background: #8f0661;
    transform: translateY(-2px);
}

.controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 0 10px;
}

.month-year {
    font-size: 20px;
    font-weight: bold;
    color: #580977;
}

button {
    padding: 10px 20px;
    background: #580977;
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

button:hover {
    background: #450661;
    transform: translateY(-2px);
}

.error-message {
    background: #fce8e6;
    color: #d93025;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: none;
    text-align: center;
}

.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    padding: 20px;
    border-radius: 8px;
    display: none;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.refresh-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #580977;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    display: none;
    animation: fadeInOut 2s ease;
    z-index: 1000;
}

.event-count {
    background: #580977;
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 10px;
}

.debug-panel {
    background: #f5f5f5;
    border: 1px solid #ddd;
    padding: 10px;
    margin-top: 20px;
    border-radius: 8px;
    display: none;
}

.debug-panel.show {
    display: block;
}

#debugToggle {
    margin-top: 10px;
    background: #444;
    font-size: 12px;
    padding: 5px 10px;
}

.debug-actions {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.debug-actions button {
    background: #333;
    font-size: 12px;
    padding: 5px 10px;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .calendar-day {
        min-height: 100px;
        font-size: 0.9em;
    }

    .event {
        padding: 6px;
        font-size: 11px;
    }
}