﻿/* Wrapper */
:root {
    --mabuhay-accent: #49975c;
}

.mabuhay-events-public {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.25rem;
    background: #fff;
}

/* Toolbar */
.mabuhay-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1rem;
}

.mabuhay-view button,
.mabuhay-nav button {
    border: 1px solid #ccd0d4;
    background: #fff;
    padding: 0.3rem 0.8rem;
    cursor: pointer;
    border-radius: 6px;
    color: #49975c;
}

.mabuhay-view button.is-active {
    background: #49975c;
    color: #fff;
    border-color: #49975c;
}

.mabuhay-display-toggle {
    display: inline-flex;
    border: 1px solid #cbd5f5;
    border-radius: 6px;
    overflow: hidden;
    margin-top: 5px;
}

.mabuhay-display-toggle button {
    border: none;
    background: transparent;
    padding: 0.35rem 0.85rem;
    font-weight: 600;
    color: #49975c;
    cursor: pointer;
}

.mabuhay-display-toggle button.is-active {
    background: #49975c;
    color: #fff;
}

.mabuhay-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    border: 1px solid #cbd5f5;
    border-radius: 999px;
    padding: 0.4rem 2.6rem 0.4rem 1rem;
    min-width: 200px;
    font-weight: 600;
    color: #0f172a;
    background-color: #fff;
    background-image:
        linear-gradient(45deg, transparent 50%, #49975c 50%),
        linear-gradient(135deg, #49975c 50%, transparent 50%),
        linear-gradient(to right, #e2e8f0, #e2e8f0);
    background-position:
        calc(100% - 18px) calc(50% - 4px),
        calc(100% - 12px) calc(50% - 4px),
        calc(100% - 2.3rem) 50%;
    background-size: 6px 6px, 6px 6px, 1px 60%;
    background-repeat: no-repeat;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.mabuhay-select:focus {
    border-color: #49975c;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
    outline: none;
}

.mabuhay-nav span[data-current-month] {
    color: #1d2327;
    font-weight: 600;
}

/* Calendar grid */
.mabuhay-calendar-scroll {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

[data-calendar-wrapper][hidden] {
    display: none;
}

.mabuhay-days {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.45rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #475569;
}

.mabuhay-day-label {
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    padding: 0.25rem 0.4rem;
    color: #49975c;
}

.mabuhay-calendar {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    min-width: 0;
}

.mabuhay-list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1rem;
}

.mabuhay-list-view[hidden] {
    display: none;
}

.mabuhay-list-day {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 1rem;
    background: #fff;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.mabuhay-list-day__date {
    display: flex;
    align-items: baseline;
    margin-bottom: 0.8rem;
    color: #0f172a;
}

.mabuhay-list-day__date .full {
    font-weight: 600;
    font-size: 1rem;
}

.mabuhay-list-day__slots {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Day card */
.mabuhay-day {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 0.75rem;
    min-height: 110px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    transition: box-shadow 120ms ease, transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.mabuhay-day:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.mabuhay-day.is-empty { background: #f6f7f7; }

/* Status styling - soft backgrounds + clear borders */
.mabuhay-day.is-available {
    border-color: #34a853;
    background: #f0fbf4;
}
.mabuhay-day.is-blocked {
    border-color: #d93025;
    background: #fff4f4;
}
.mabuhay-day.is-mixed {
    border-color: #f9ab00;
    background: #fff9e6;
}

/* Date number */
.mabuhay-day__number {
    font-weight: 700;
    margin-bottom: 0.25rem;
    display: block;
    color: #49975c;
}

/* Lists */
.mabuhay-day__list,
.mabuhay-week-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
}
.mabuhay-day__list li,
.mabuhay-week-list li { margin-bottom: 0.25rem; }

.mabuhay-slot-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-top: 0.4rem;
    width: 100%;
}

.mabuhay-slot-row {
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.6rem;
    background: #fff;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
}

.mabuhay-slot-row__details {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mabuhay-slot-row__details strong {
    font-size: 0.95rem;
    color: #0f172a;
}

.mabuhay-slot-row__details span {
    font-size: 0.85rem;
    color: #475569;
}

.mabuhay-slot-row__details em {
    font-style: normal;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #475569;
}

.mabuhay-slot-row.is-available {
    border-color: #22c55e;
    background: #f0fdf4;
}

.mabuhay-slot-row.is-blocked {
    border-color: #ef4444;
    background: #fef2f2;
}

.mabuhay-slot-row.is-compact {
    padding: 0.45rem 0.55rem;
}

.mabuhay-slot-more {
    border: none;
    background: transparent;
    color: #2563eb;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    text-align: left;
}

.mabuhay-slot-chip {
    border: none;
    background: transparent;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    padding: 0;
    color: #0f172a;
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mabuhay-slot-chip:hover {
    text-decoration: underline;
}

.mabuhay-slot-chip.is-available {
    color: #0f5132;
}

.mabuhay-slot-chip.is-blocked {
    color: #842029;
}

/* Week view */
.mabuhay-calendar.is-week-view {
    grid-template-columns: repeat(7, minmax(0, 1fr));
    min-width: 0;
}
.mabuhay-day.week { min-height: 180px; }
.mabuhay-day__header {
    color: #1d2327;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: medium;
}
.mabuhay-week-slot.is-available { color: #0f5132; }
.mabuhay-week-slot.is-blocked { color: #842029; }

/* Legend */
.mabuhay-legend { margin-top: 1rem; display: flex; gap: 1rem; }
.mabuhay-legend .legend::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 999px; margin-right: 0.25rem; }
.mabuhay-legend .available::before { background: #34a853; }
.mabuhay-legend .blocked::before { background: #d93025; }

/* Modal */
body.mabuhay-modal-open {
    overflow: hidden;
}

.mabuhay-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    padding: 1rem;
    z-index: 9999;
}

.mabuhay-modal[hidden] {
    display: none;
}

.mabuhay-modal__content {
    background: #fff;
    border-radius: 16px;
    padding: 1.5rem;
    width: min(500px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}

.mabuhay-modal__close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: #475569;
}

.mabuhay-modal__title {
    margin: 0 0 1rem;
    color: #0f172a;
}

.mabuhay-modal__list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Responsive */
@media (max-width: 992px) {
    .mabuhay-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
    .mabuhay-view,
    .mabuhay-display-toggle,
    .mabuhay-nav,
    .mabuhay-filter {
        width: 100%;
        justify-content: space-between;
    }
    .mabuhay-select {
        width: 100%;
    }
    .mabuhay-nav {
        gap: 0.5rem;
    }
    .mabuhay-display-toggle {
        justify-content: center;
    }
    .mabuhay-display-toggle button {
        flex: 1;
    }
}

@media (max-width: 640px) {
    .mabuhay-events-public {
        padding: 1rem;
    }
    .mabuhay-day {
        min-height: 30px;
        padding-left: 0.3rem;
    }
    .mabuhay-view button,
    .mabuhay-nav button {
        flex: 1;
    }
    .mabuhay-view,
    .mabuhay-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
    }
    .mabuhay-nav span[data-current-month] {
        width: 100%;
        text-align: center;
    }
    .mabuhay-modal {
        align-items: flex-start;
        overflow-y: auto;
    }
    .mabuhay-modal__content {
        width: 100%;
        max-height: none;
        margin-top: 1.5rem;
    }
}
