* { box-sizing: border-box; }
body {
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    margin: 0;
    background: #f4f5f7;
    color: #1f2328;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    background: #1f2328;
    color: #fff;
    flex-wrap: wrap;
    gap: 1rem;
}
.calendar-header h1 { margin: 0; font-size: 1.4rem; }
.view-switcher a {
    color: #c7cad1;
    text-decoration: none;
    margin-left: 1rem;
    padding: 0.3rem 0.7rem;
    border-radius: 4px;
}
.view-switcher a.active { background: #3366ff; color: #fff; }

main { max-width: 900px; margin: 2rem auto; padding: 0 1rem 3rem; }

/* Stack view */
.event-row {
    display: flex;
    gap: 1.5rem;
    background: #fff;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    margin-bottom: 0.8rem;
    align-items: baseline;
    box-shadow: 0 1px 2px rgba(0,0,0,0.06);
}
.event-date { font-weight: 600; color: #3366ff; white-space: nowrap; }
.event-info { display: flex; flex-direction: column; gap: 0.2rem; flex: 1; }
.event-title { font-weight: 600; }
.event-venue { color: #5a5f68; font-size: 0.9rem; }
.event-details-link { font-size: 0.9rem; align-self: flex-start; }
.no-events { color: #5a5f68; }

.load-more {
    display: block;
    margin: 1rem auto 0;
    padding: 0.6rem 1.6rem;
    background: #3366ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1rem;
}

/* Carousel view */
.carousel {
    position: relative;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.carousel-track {
    position: relative;
    flex: 1 1 0%;
    min-width: 0;
    display: flex;
    gap: 1.5rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    padding: 0.5rem;
}
.carousel-card {
    flex: 0 0 22rem;
    scroll-snap-align: start;
    background: #fff;
    border-radius: 8px;
    padding: 1.2rem 1.4rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.carousel-card h3 { margin: 0; font-size: 1.1rem; }
.carousel-spacer { flex: 0 0 auto; width: calc(100% - 22rem); }
.carousel-btn {
    flex: 0 0 auto;
    background: #fff;
    border: 1px solid #c7cad1;
    border-radius: 50%;
    width: 2.6rem;
    height: 2.6rem;
    font-size: 1rem;
    cursor: pointer;
}
.carousel-btn:disabled { opacity: 0.3; cursor: default; pointer-events: none; }

/* Modal */
.event-modal[hidden] { display: none; }
.event-modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.event-modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.event-modal-content {
    position: relative;
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    width: 32rem;
}
.event-modal-close {
    position: absolute;
    top: 0.6rem;
    right: 0.8rem;
    background: none;
    border: none;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
}
.modal-flyer { max-width: 100%; border-radius: 6px; display: block; margin-bottom: 0.8rem; }
.modal-new-tab-link { display: inline-block; margin-bottom: 1rem; font-size: 0.9rem; }
.modal-notes { white-space: pre-wrap; font-family: inherit; font-size: 0.95rem; }

/* Code entry (enter_code.php) */
.code-entry-main { max-width: 420px; }
.code-entry-form { display: flex; flex-direction: column; gap: 1.5rem; align-items: center; }
.code-boxes { display: flex; gap: 0.3rem; align-items: center; flex-wrap: nowrap; justify-content: center; }
.code-box {
    width: 4rem;
    min-width: 0;
    padding: 0.5rem 0.2rem;
    font-size: 1.2rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
    border: 1px solid #c7cad1;
    border-radius: 4px;
}
.code-dash { font-size: 1.2rem; font-weight: 600; color: #5a5f68; flex: none; }

@media (max-width: 360px) {
    .code-boxes { gap: 0.2rem; }
    .code-box { width: 3rem; padding: 0.5rem 0.1rem; font-size: 1.1rem; letter-spacing: 0; }
    .code-dash { font-size: 1.1rem; }
}
.code-entry-form button[type=submit] {
    padding: 0.7rem 2rem;
    font-size: 1rem;
    background: #3366ff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.code-entry-form button[type=submit]:disabled { opacity: 0.4; cursor: default; }

/* Customer view (view_event.php) */
.customer-view-main { max-width: 700px; }
.customer-info-box, .attachments-box {
    background: #fff;
    border-radius: 6px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
}
.customer-info-box dl { display: grid; grid-template-columns: auto 1fr; gap: 0.3rem 1rem; margin: 0; }
.customer-info-box dt { font-weight: 600; color: #5a5f68; }
.customer-info-box dd { margin: 0; }
.attachments-box ul { margin: 0; padding-left: 1.2rem; }
.owner-email-link { display: inline-block; margin-top: 1rem; }

.overrides-box {
    background: #fff;
    border-radius: 6px;
    padding: 1.2rem 1.5rem;
    margin-bottom: 1.5rem;
}
.overrides-box ul { margin: 0; padding-left: 1.2rem; }
.overrides-box li { margin-bottom: 0.4rem; }

/* Same badge styling as admin/admin.css's -- kept in this separate public
   stylesheet since admin.css is never loaded here. */
.status-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}
.status-badge.status-skipped { background: #fde0e0; color: #b3261e; }
.status-badge.status-modified { background: #fff0c2; color: #7a5c00; }

@media (max-width: 600px) {
    .carousel-btn { display: none; }

    /* Below this width there isn't room for the date/time column and the
       title/venue/link column side by side -- stack them instead, matching
       the carousel card's own top-to-bottom order (date, title, venue,
       link). */
    .event-row { flex-direction: column; align-items: flex-start; gap: 0.4rem; }
    .event-date { white-space: normal; }
}
