/* ============================================================
   SRRF — Guest Portal Styles
   Loaded only on /guest/ pages (includes/header.php, $pageExtraCss).
   Mobile first; every tap target is at least 44px.
   Colors come from var(--color-*) (site_settings via header.php) and
   the static tokens in style.css. No hex values in this file.
   ============================================================ */

/* --- Card + form (login, forgot password, set password, messages) --- */
.guest-card {
    padding: 1.75rem 1.25rem;
    background-color: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.guest-card-intro,
.guest-message {
    margin-bottom: 1.5rem;
}

.guest-form .form-label {
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.guest-form .form-control {
    min-height: 52px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 1px solid var(--color-input-border);
    border-radius: 4px;
}

.guest-form .password-toggle {
    min-width: 52px;
    border: 1px solid var(--color-input-border);
    border-left: 0;
    background-color: var(--color-surface);
    color: var(--color-primary);
}

.guest-form .password-toggle:hover,
.guest-form .password-toggle:focus-visible {
    background-color: var(--color-light);
    color: var(--color-primary);
}

.guest-submit {
    width: 100%;
    min-height: 52px;
    font-size: 1.05rem;
}

.guest-form-links {
    margin: 1rem 0 0;
    text-align: center;
}

.guest-form-links a {
    display: inline-block;
    min-height: 44px;
    line-height: 44px;
    font-weight: 600;
}

/* --- Signed-in bar --- */
/* "Signed in as {name} · Change password · Log out" */
.guest-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0 0.6rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1.5rem;
    background-color: var(--color-light);
    border-radius: 6px;
}

/* Not a flex container: inline-flex would drop the space before the <strong> name */
.guest-bar-user {
    display: inline-block;
    line-height: 44px;
}

.guest-bar a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    font-weight: 600;
}

.guest-bar-sep {
    opacity: 0.5;
}

/* "Back to visits" (visit page: left of the toolbar, and again below the grid) */
.guest-back {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    min-height: 44px;
    padding-right: 0.5rem;
    font-weight: 600;
}

.guest-back--below {
    margin-top: 1.5rem;
}

.guest-section-heading {
    font-size: 1.6rem;
    color: var(--color-primary);
    margin-bottom: 1rem;
}

/* --- Visit cards (guest/includes/visit-card.php) --- */
.guest-visit-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 1.5rem;
    background-color: var(--color-surface);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.guest-visit-name {
    font-size: 1.35rem;
    margin-bottom: 0.25rem;
}

.guest-visit-dates {
    color: var(--color-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.guest-visit-description {
    margin-bottom: 1rem;
}

.guest-visit-description--page {
    max-width: 44rem;
    margin-bottom: 1.5rem;
}

.guest-visit-count {
    margin-top: auto;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    opacity: 0.8;
}

.guest-visit-card .btn {
    min-height: 48px;
}

/* --- Empty states --- */
.guest-empty {
    padding: 3rem 1rem;
    text-align: center;
    background-color: var(--color-light);
    border-radius: 8px;
}

.guest-empty-icon {
    display: block;
    margin-bottom: 1rem;
    font-size: 2.5rem;
    color: var(--color-primary);
    opacity: 0.6;
}

.guest-empty p {
    margin: 0;
    font-size: 1.1rem;
}

/* --- Child filter chips --- */
.guest-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

/* One "Play slideshow" button per child with photos on the visit */
.guest-slideshows {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.guest-slideshows .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.guest-chip {
    min-height: 44px;
    padding: 0 1.1rem;
    border: 2px solid var(--color-primary);
    border-radius: 999px;
    background-color: transparent;
    color: var(--color-primary);
    font-weight: 600;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.guest-chip:hover {
    background-color: var(--color-light);
}

.guest-chip.active {
    background-color: var(--color-primary);
    color: var(--color-on-dark);
}

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

.guest-toolbar .btn {
    min-height: 44px;
}

.guest-select-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* --- Photo grid: 2 columns, 3 at lg --- */
.guest-photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.guest-photo {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 6px;
    background-color: var(--color-light);
}

.guest-photo-open {
    display: block;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: zoom-in;
}

.guest-photo-open img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Selection checkbox: hidden until Select mode, 44px round target */
.guest-photo-select {
    position: absolute;
    top: 0.5rem;
    left: 0.5rem;
    display: none;
    width: 44px;
    height: 44px;
    align-items: center;
    justify-content: center;
    margin: 0;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    cursor: pointer;
}

.guest-photo-select input {
    width: 1.5rem;
    height: 1.5rem;
    margin: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}

.guest-photo-grid.is-selecting .guest-photo-select {
    display: flex;
}

.guest-photo-grid.is-selecting .guest-photo-open {
    cursor: pointer;
}

.guest-photo.is-selected {
    outline: 4px solid var(--color-accent);
    outline-offset: -4px;
}

.guest-photo.is-selected .guest-photo-open img {
    opacity: 0.85;
}

/* --- Lightbox (Bootstrap fullscreen modal) --- */
.guest-lightbox {
    --guest-lightbox-top: 56px;
}

/* While open, the whole modal (top bar included) owns every touch, so the
   browser never page-zooms behind it; the rule ends with the .show class */
.guest-lightbox.show {
    touch-action: none;
}

.guest-lightbox .modal-content {
    position: relative;
    border: 0;
    border-radius: 0;
    background-color: var(--color-dark);
    color: var(--color-on-dark);
}

/* The bar overlays the stage, which fills the modal beneath it */
.guest-lightbox-top {
    position: relative;
    z-index: 3;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: var(--guest-lightbox-top);
    padding: 0.5rem 0.75rem;
}

.guest-lightbox-counter {
    font-weight: 600;
}

.guest-lightbox-top .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

.guest-lightbox-top .btn-close {
    width: 44px;
    height: 44px;
    margin-left: auto;
    padding: 0;
    background-size: 1.25rem;
}

/* Stage: a three-slide track (previous, current, next). The track is three
   stage widths wide and rests one stage width to the left; a swipe or mouse
   drag moves it with the pointer (guest.js), then it snaps or commits with
   the same easing the prev/next buttons use. pan-y leaves vertical scrolling
   to the browser. */
.guest-lightbox-stage {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
    cursor: grab;
}

.guest-lightbox-stage.is-dragging {
    cursor: grabbing;
}

.guest-lightbox-stage.is-zoomed {
    cursor: move;
}

.guest-lightbox-track {
    display: flex;
    width: 300%;
    height: 100%;
    transform: translateX(-33.3333%);
}

.guest-lightbox-track.is-animating {
    transition: transform 250ms cubic-bezier(0, 0, 0.58, 1);
}

/* Each slide is the full stage; the top padding keeps the photo clear of the bar */
.guest-lightbox-slide {
    display: flex;
    flex: 0 0 33.3333%;
    box-sizing: border-box;
    width: 33.3333%;
    height: 100%;
    padding-top: var(--guest-lightbox-top);
    align-items: center;
    justify-content: center;
}

.guest-lightbox-slide img {
    max-width: 100%;
    max-height: 100%;
    max-height: calc(100dvh - 56px);
    width: auto;
    height: auto;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    pointer-events: none;
}

.guest-lightbox-slide img:not([src]) {
    display: none;
}

/* Pinch zoom: the current image carries translate() scale() (guest.js);
   the transition runs only for the spring-back and double-tap steps */
.guest-lightbox-slide img.is-animating {
    transition: transform 250ms cubic-bezier(0, 0, 0.58, 1);
}

@media (prefers-reduced-motion: reduce) {
    .guest-lightbox-track.is-animating,
    .guest-lightbox-slide img.is-animating {
        transition: none;
    }
}

.guest-lightbox-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 48px;
    height: 72px;
    border: 0;
    border-radius: 6px;
    background-color: rgba(0, 0, 0, 0.4);
    color: var(--color-on-dark);
    font-size: 1.5rem;
    transform: translateY(-50%);
    transition: background-color 0.2s ease;
}

.guest-lightbox-nav:hover,
.guest-lightbox-nav:focus-visible {
    background-color: rgba(0, 0, 0, 0.65);
}

.guest-lightbox-nav:disabled {
    opacity: 0.3;
}

.guest-lightbox-prev {
    left: 0.5rem;
}

.guest-lightbox-next {
    right: 0.5rem;
}

.guest-lightbox :focus-visible {
    outline-color: var(--color-accent);
}

/* --- Larger screens --- */
@media (min-width: 768px) {
    .guest-card {
        padding: 2.5rem 2rem;
    }

    .guest-submit {
        width: auto;
        min-width: 12rem;
    }

    .guest-photo-grid {
        gap: 0.75rem;
    }
}

@media (min-width: 992px) {
    .guest-photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* --- Quiet buttons: Select / Select all / Clear on the visit page (the stock
   .btn-outline-dark). Surface background, a 1px border, ink text; hover
   darkens the border and tints the background; pressed (aria-pressed on
   the Select toggle) is the primary color as a tint, text and border.
   Everything is a configurable --color-* variable; the color-mix() tints
   apply where supported and the plain values stand in elsewhere. --- */
.guest-toolbar .btn-outline-dark {
    --bs-btn-color: var(--color-dark);
    --bs-btn-bg: var(--color-surface);
    --bs-btn-border-color: var(--color-input-border);
    --bs-btn-hover-color: var(--color-dark);
    --bs-btn-hover-bg: var(--color-light);
    --bs-btn-hover-border-color: var(--color-dark);
    --bs-btn-active-color: var(--color-primary);
    --bs-btn-active-bg: var(--color-light);
    --bs-btn-active-border-color: var(--color-primary);
    --bs-btn-active-shadow: none;
    --bs-btn-disabled-color: var(--color-input-border);
    --bs-btn-disabled-bg: var(--color-surface);
    --bs-btn-disabled-border-color: var(--color-input-border);
    border-radius: 8px;
}

@supports (color: color-mix(in srgb, red 4%, white)) {
    .guest-toolbar .btn-outline-dark {
        --bs-btn-hover-bg: color-mix(in srgb, var(--color-dark) 4%, var(--color-surface));
        --bs-btn-hover-border-color: color-mix(in srgb, var(--color-dark) 55%, var(--color-surface));
        --bs-btn-active-bg: color-mix(in srgb, var(--color-primary) 10%, var(--color-surface));
        --bs-btn-focus-box-shadow: 0 0 0 0.25rem color-mix(in srgb, var(--color-primary) 35%, transparent);
    }
}

.guest-toolbar .btn-outline-dark[aria-pressed="true"] {
    color: var(--bs-btn-active-color);
    background-color: var(--bs-btn-active-bg);
    border-color: var(--bs-btn-active-border-color);
}
