/* calendar.css */

/* Apply box-sizing globally for better layout control */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Container for the calendar */
.cec-calendar {
    width: 100%; /* Make the calendar take up full width of its container */
    max-width: 100% !important; /* Optional: Limit the maximum width */
    margin: 20px auto;
    font-family: Arial, sans-serif;
    overflow-x: hidden; /* Prevent horizontal overflow */
    padding: 10px; /* Add some padding for better appearance on small screens */
}

/* Header of the calendar */
.cec-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap; /* Allow items to wrap on smaller screens */
}

.cec-calendar-header h2 {
    margin: 0;
    font-size: 1.5em;
    text-align: center; /* Center the title on small screens */
    flex: 1 1 100%; /* Make the title take full width when wrapped */
    margin-bottom: 10px; /* Add space below the title */
}

.cec-calendar-header .cec-nav {
    display: flex;
    gap: 10px;
    flex: 1 1 auto; /* Allow navigation buttons to adjust */
    justify-content: center; /* Center the navigation buttons */
}

/* Navigation buttons */
.cec-calendar-header .cec-nav button {
    padding: 5px 10px;
    background-color: #0073aa;
    color: #fff;
    border: none;
    cursor: pointer;
    border-radius: 3px;
    flex: 1; /* Make buttons grow equally */
    max-width: 120px; /* Limit maximum width of buttons */
    transition: background-color 0.2s ease, transform 0.15s ease;
}

.cec-calendar-header .cec-nav button:hover {
    background-color: #0f4c81;
    color: #ffffff;
    transform: translateY(-1px);
}

.cec-calendar-header .cec-nav button:active {
    background-color: #0a355b;
    transform: translateY(0);
}

.cec-calendar-header .cec-nav button:focus-visible {
    outline: 2px solid rgba(99, 102, 241, 0.8);
    outline-offset: 2px;
}

/* Calendar Grid */
.cec-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr); /* 7 equal columns */
    gap: 1px;
    background-color: #ddd;
}

/* Day Headers */
.cec-calendar-day {
    background-color: #f7f7f7;
    text-align: center;
    font-weight: bold;
    padding: 8px 5px;
    font-size: 0.9em;
}

/* Date Cells */
.cec-calendar-date {
    background-color: #fff;
    padding: 8px 5px;
    min-height: 100px;
    position: relative;
    overflow: hidden; /* Prevent content overflow */
    display: flex;
    flex-direction: column;
}

/* Empty Date Cells */
.cec-calendar-date.empty {
    background-color: #f9f9f9;
}

/* Date Number */
.cec-date-number {
    font-weight: bold;
    margin-bottom: 5px;
    font-size: 0.9em;
}

/* Event Entries */
.cec-event {
    background-color: #0073aa;
    color: #fff;
    padding: 2px 5px;
    margin-top: 2px;
    border-radius: 3px;
    font-size: 0.8em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
}

/* Adjust event font size and padding on smaller screens */
@media (max-width: 600px) {
    .cec-calendar-header h2 {
        font-size: 1.2em;
    }

    .cec-calendar-header .cec-nav button {
        padding: 5px 8px;
        font-size: 0.9em;
        max-width: 100px;
    }

    .cec-calendar-day {
        font-size: 0.8em;
        padding: 6px 3px;
    }

    .cec-calendar-date {
        padding: 6px 3px;
        min-height: 80px;
    }

    .cec-date-number {
        font-size: 0.8em;
    }

    .cec-event {
        font-size: 0.7em;
        padding: 1px 3px;
    }
}

/* Modal Styling */
.cec-modal {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.cec-modal.is-visible {
    display: flex;
}

.cec-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.cec-modal__dialog {
    position: relative;
    background: #ffffff;
    border-radius: 20px;
    padding: 36px 40px;
    width: calc(100% - 48px);
    max-width: 540px;
    box-shadow: 0 28px 64px rgba(15, 23, 42, 0.22);
    z-index: 1;
    font-family: "Inter", "Helvetica Neue", Arial, sans-serif;
    border: 1px solid rgba(99, 102, 241, 0.08);
}

.cec-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 38px;
    height: 38px;
    border-radius: 14px;
    border: none;
    background: rgba(99, 102, 241, 0.12);
    color: #312e81;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    font-weight: 600;
}

.cec-modal__close:hover,
.cec-modal__close:focus {
    background: rgba(99, 102, 241, 0.24);
    transform: translateY(-1px);
    outline: none;
    color: #1e1b4b;
}

.cec-modal__header {
    margin-bottom: 24px;
}

.cec-modal__eyebrow {
    display: inline-block;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.72rem;
    color: #6366f1;
    font-weight: 600;
    margin-bottom: 10px;
    background: rgba(99, 102, 241, 0.12);
    padding: 6px 12px;
    border-radius: 999px;
}

.cec-modal__title {
    font-size: 2rem;
    line-height: 1.2;
    color: #0f172a;
    margin: 0;
    font-weight: 800;
    word-break: break-word;
}

.cec-modal__body {
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.cec-modal__description {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.75;
    color: #334155;
}

.cec-modal__meta {
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
}

.cec-modal__meta-row {
    display: grid;
    grid-template-columns: 120px 1fr;
    align-items: flex-start;
    gap: 16px;
    padding: 14px 0;
    border-top: 1px solid #e2e8f0;
}

.cec-modal__meta-row:first-child {
    border-top: none;
}

.cec-modal__meta-row dt {
    font-weight: 600;
    color: #1f2937;
    font-size: 0.98rem;
}

.cec-modal__meta-row dd {
    margin: 0;
    font-size: 0.98rem;
    color: #0f172a;
}

@media (max-width: 640px) {
    .cec-modal__dialog {
        padding: 30px 24px;
    }

    .cec-modal__meta-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}
