/* assets/css/calendar-style.css */

/* Google Font: Readex Pro - Loaded via PHP enqueue */
body {
    font-family: 'Readex Pro', sans-serif;
    color: #333; /* Default text color */
}

.my-api-calendar-container {
    max-width: 1000px; /* Increased width */
    margin: 30px auto;
    padding: 20px;
    background-color: #fff; /* White background */
    border-radius: 12px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    font-family: 'Readex Pro', sans-serif;
    overflow: hidden; /* Ensure no overflow from grid */
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid rgba(108, 28, 4, 0.2); /* Dark red/brown border */
}

.calendar-title {
    font-size: 1.8em;
    font-weight: 600;
    color: rgb(108, 28, 4); /* Dark red/brown */
    margin: 0;
    text-align: center;
    flex-grow: 1; /* Allow title to take available space */
}

.calendar-nav-btn {
    background-color: rgb(108, 28, 4); /* Dark red/brown */
    color: rgb(242, 220, 188); /* Light beige text */
    border: none;
    padding: 10px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.2em;
    font-weight: 700;
    transition: background-color 0.3s ease, transform 0.2s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.calendar-nav-btn:hover {
    background-color: rgba(108, 28, 4, 0.8); /* Slightly lighter on hover */
    transform: translateY(-2px);
}

/* Specific button padding/margin */
#prevMonth {
    margin-right: 15px; /* Padding right margin */
}

#nextMonth {
    margin-left: 15px; /* Equivalent to padding left margin */
    /* No top/right margin needed if flexbox handles spacing,
       but added for clarity if layout changes */
    /* margin-top: 0; */
    /* margin-right: 0; */
}


/* Month/Year Selectors */
.month-year-select-container {
    display: flex;
    gap: 10px;
    flex-grow: 1;
    justify-content: center;
}

.calendar-select {
    padding: 8px 12px;
    border: 1px solid rgb(108, 28, 4);
    border-radius: 8px;
    background-color: rgb(242, 220, 188);
    color: rgb(108, 28, 4);
    font-family: 'Readex Pro', sans-serif;
    font-size: 1em;
    cursor: pointer;
    appearance: none; /* Remove default dropdown arrow */
    background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%236c1c04%22%20d%3D%22M287%2C197.3L159.2%2C69.5c-3.1-3.1-8.2-3.1-11.3%2C0L5.4%2C197.3c-3.1%2C3.1-3.1%2C8.2%2C0%2C11.3l11.3%2C11.3c3.1%2C3.1%2C8.2%2C3.1%2C11.3%2C0l115.5-115.5l115.5%2C115.5c3.1%2C3.1%2C8.2%2C3.1%2C11.3%2C0l11.3-11.3C290.1%2C205.5%2C290.1%2C200.4%2C287%2C197.3z%22%2F%3E%3C%2Fsvg%3E'); /* Custom arrow */
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 12px;
    padding-right: 30px; /* Space for arrow */
}

.calendar-select:focus {
    outline: none;
    border-color: rgba(108, 28, 4, 0.5);
    box-shadow: 0 0 0 2px rgba(108, 28, 4, 0.2);
}


.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-weight: 600;
    color: rgb(108, 28, 4); /* Dark red/brown */
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid rgba(108, 28, 4, 0.1);
}

.calendar-weekdays span {
    padding: 8px 0;
    font-size: 0.95em;
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px; /* Spacing between days */
}

.calendar-day {
    background-color: rgba(255, 255, 255, 0.7); /* Slightly transparent white */
    border: 1px solid rgba(108, 28, 4, 0.1);
    border-radius: 8px;
    padding: 10px 5px;
    min-height: 100px; /* Minimum height for day cells */
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.9em;
    color: #555;
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* For event positioning */
    cursor: pointer; /* Indicate clickable */
    overflow: hidden; /* Hide overflowing events */
}

.calendar-day:hover {
    background-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.calendar-day.current-month {
    background-color: rgb(242, 220, 188); /* Light beige for current month days */
    color: rgb(108, 28, 4); /* Dark red/brown for current month day numbers */
}

.calendar-day.today {
    border: 2px solid rgb(108, 28, 4); /* Highlight today */
    box-shadow: 0 0 0 3px rgba(108, 28, 4, 0.3);
}

.day-number {
    font-size: 1.4em;
    font-weight: 700;
    margin-bottom: 5px;
    color: rgb(108, 28, 4); /* Dark red/brown for day numbers */
}

.calendar-day.current-month .day-number {
    color: rgb(108, 28, 4);
}

.calendar-day:not(.current-month) {
    opacity: 0.6; /* Dim days from previous/next month */
}

.calendar-events {
    width: 100%;
    margin-top: 5px;
    overflow: hidden; /* Hide overflowing events in day cell */
    text-align: left;
    padding: 0 5px;
}

.calendar-event-item {
    background-color: rgba(108, 28, 4, 0.8); /* Dark red/brown for events */
    color: rgb(242, 220, 188); /* Light beige text for events */
    padding: 3px 5px;
    margin-bottom: 3px;
    border-radius: 4px;
    font-size: 0.75em;
    white-space: nowrap; /* Prevent text wrapping */
    overflow: hidden; /* Hide overflowing text */
    text-overflow: ellipsis; /* Add ellipsis for overflow */
    cursor: pointer; /* Indicate clickable */
    transition: background-color 0.2s ease;
}

.calendar-event-item:hover {
    background-color: rgb(108, 28, 4);
}

.calendar-more-events {
    font-size: 0.7em;
    color: rgb(108, 28, 4);
    font-weight: 600;
    text-align: center;
    margin-top: 5px;
    cursor: pointer;
}

/* Event Details Modal */
.event-details-modal {
    display: none; /* Hidden by default */
    position: fixed; /* Stay in place */
    z-index: 1000; /* Sit on top */
    left: 0;
    top: 0;
    width: 100%; /* Full width */
    height: 100%; /* Full height */
    overflow: auto; /* Enable scroll if needed */
    background-color: rgba(0,0,0,0.6); /* Black w/ opacity */
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background-color: rgb(242, 220, 188); /* Light beige background */
    margin: auto;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.3);
    position: relative;
    font-family: 'Readex Pro', sans-serif;
    color: #333;
    animation: fadeInScale 0.3s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}


.close-button {
    color: rgb(108, 28, 4);
    position: absolute;
    top: 15px;
    right: 25px;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease;
}

.close-button:hover,
.close-button:focus {
    color: rgba(108, 28, 4, 0.7);
    text-decoration: none;
    cursor: pointer;
}

#modalDate {
    color: rgb(108, 28, 4);
    font-size: 1.6em;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(108, 28, 4, 0.2);
    padding-bottom: 10px;
}

.modal-event-item {
    background-color: rgba(108, 28, 4, 0.1); /* Lighter background for modal events */
    border-left: 5px solid rgb(108, 28, 4);
    padding: 10px 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    font-size: 1em;
}

.modal-event-item strong {
    color: rgb(108, 28, 4);
    display: block;
    margin-bottom: 5px;
    font-size: 1.1em;
}

.modal-event-item p {
    margin: 5px 0;
    font-size: 0.9em;
    word-break: break-word; /* Allow long words to break */
}

.modal-event-item .event-link-btn {
    display: inline-block;
    background-color: rgb(108, 28, 4);
    color: rgb(242, 220, 188);
    padding: 8px 12px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.85em;
    margin-top: 10px;
    transition: background-color 0.2s ease;
}

.modal-event-item .event-link-btn:hover {
    background-color: rgba(108, 28, 4, 0.8);
}


/* Monthly Event List below calendar */
.event-list-title {
    font-size: 1.5em;
    font-weight: 600;
    color: rgb(108, 28, 4);
    margin-top: 40px;
    margin-bottom: 20px;
    text-align: center;
    border-bottom: 1px solid rgba(108, 28, 4, 0.2);
    padding-bottom: 10px;
}

.monthly-event-list {
    margin-top: 20px;
    padding: 0 10px;
}

.monthly-event-item {
    background-color: rgba(108, 28, 4, 0.05); /* Very light background */
    border: 1px solid rgba(108, 28, 4, 0.1);
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.monthly-event-item-details {
    flex: 1;
    min-width: 70%; /* Allow details to take most space */
}

.monthly-event-item-details h4 {
    color: rgb(108, 28, 4);
    font-size: 1.2em;
    margin-top: 0;
    margin-bottom: 5px;
}

.monthly-event-item-details p {
    font-size: 0.9em;
    color: #555;
    margin: 0 0 5px 0;
    word-break: break-word; /* Allow long words to break */
}

.monthly-event-item-details .event-description {
    font-size: 0.85em;
    color: #666;
    margin-top: 10px;
    word-break: break-word; /* Allow long words to break */
}

.monthly-event-item-action {
    flex-basis: auto; /* Take only necessary width */
    margin-left: 20px;
}

.monthly-event-item .event-link-btn {
    background-color: rgb(108, 28, 4);
    color: rgb(242, 220, 188);
    padding: 10px 15px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Prevent button text wrapping */
}

.monthly-event-item .event-link-btn:hover {
    background-color: rgba(108, 28, 4, 0.8);
}

.no-events-message {
    text-align: center;
    color: #777;
    font-style: italic;
    padding: 20px;
}

/* Loading indicator */
.loading-indicator {
    text-align: center;
    color: rgb(108, 28, 4);
    font-size: 1.2em;
    padding: 20px;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .my-api-calendar-container {
        margin: 15px;
        padding: 15px;
    }
    .calendar-title {
        font-size: 1.5em;
    }
    .calendar-nav-btn {
        padding: 8px 12px;
        font-size: 1em;
    }
    #prevMonth {
        margin-right: 10px;
    }
    #nextMonth {
        margin-left: 10px;
    }
    .month-year-select-container {
        gap: 5px;
    }
    .calendar-select {
        padding: 6px 10px;
        font-size: 0.9em;
        background-position: right 6px center;
        background-size: 10px;
        padding-right: 25px;
    }
    .calendar-weekdays span {
        font-size: 0.85em;
    }
    .calendar-day {
        min-height: 80px;
        padding: 8px 3px;
        font-size: 0.8em;
    }
    .day-number {
        font-size: 1.2em;
    }
    .calendar-event-item {
        font-size: 0.7em;
        padding: 2px 4px;
        margin-bottom: 2px;
    }
    .modal-content {
        padding: 20px;
    }
    #modalDate {
        font-size: 1.4em;
    }
    .modal-event-item {
        padding: 8px 10px;
        font-size: 0.9em;
    }
    .monthly-event-item {
        flex-direction: column;
        align-items: flex-start;
    }
    .monthly-event-item-action {
        margin-left: 0;
        margin-top: 15px;
        width: 100%;
        text-align: center;
    }
    .monthly-event-item-details {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .my-api-calendar-container {
        padding: 10px;
    }
    .calendar-header {
        flex-wrap: wrap; /* Allow header to wrap */
        justify-content: center;
    }
    .calendar-title {
        width: 100%; /* Take full width */
        margin-top: 10px;
        margin-bottom: 10px;
    }
    .calendar-nav-btn {
        flex: 1; /* Make buttons take equal space */
        margin: 0 5px;
    }
    .month-year-select-container {
        width: 100%;
        justify-content: space-around;
        margin-top: 10px;
    }
    .calendar-select {
        flex: 1;
    }
    .calendar-weekdays span {
        font-size: 0.8em;
    }
    .calendar-day {
        min-height: 60px;
        font-size: 0.7em;
    }
    .day-number {
        font-size: 1em;
    }
    .calendar-events {
        padding: 0 2px;
    }
    .calendar-event-item {
        font-size: 0.65em;
        padding: 1px 2px;
    }
    .monthly-event-item-details h4 {
        font-size: 1.1em;
    }
    .monthly-event-item-details p {
        font-size: 0.8em;
    }
}