/*
 * Chat assistant widget (chatbot/templates/chatbot/widget.html).
 * Built for an older audience, sized like the rest of the site (visitors set
 * their own browser zoom): 16px reading text, 42px+ tap targets, labelled
 * buttons (never icon-only), full screen on phones, high contrast.
 */
.gc {
    --gc-navy: #07122e;
    --gc-navy-2: #0d1a44;
    --gc-gold: #d79d28;
    --gc-gold-light: #f2c14e;
    --gc-gold-soft: #fff3d6;
    --gc-cream: #faf7f0;
    --gc-line: #e6dfcf;
    --gc-text: #1c2233;
    --gc-muted: #555c6d;
    --gc-heading: montserrat, sans-serif;
    --gc-error: #b3261e;
}

.gc *,
.gc *::before,
.gc *::after { box-sizing: border-box; }

.gc button,
.gc textarea { font-family: inherit; }

.gc :focus-visible {
    outline: 3px solid var(--gc-gold-light);
    outline-offset: 2px;
}

/* ---------- Launcher ---------- */
.gc-launcher {
    position: fixed;
    right: max(16px, env(safe-area-inset-right));
    bottom: calc(16px + env(safe-area-inset-bottom));
    z-index: 1040; /* above the sticky header (1020), below Bootstrap modals (1055) */
    display: inline-flex;
    align-items: center;
    gap: 9px;
    min-height: 50px;
    padding: 0 20px;
    border: 2px solid var(--gc-gold);
    border-radius: 999px;
    background: var(--gc-navy);
    color: #fff;
    font-family: var(--gc-heading);
    font-size: 16px;
    font-weight: 700;
    box-shadow: 0 6px 20px rgba(7, 18, 46, 0.35);
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
}
.gc-launcher i { color: var(--gc-gold-light); font-size: 20px; transition: color 0.15s; }
.gc-launcher:hover { background: var(--gc-gold); color: var(--gc-navy); }
.gc-launcher:hover i { color: var(--gc-navy); }
.gc.is-open .gc-launcher { display: none; }

/* ---------- Panel ---------- */
.gc-panel {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1045;
    display: flex;
    flex-direction: column;
    width: min(410px, calc(100vw - 48px));
    height: min(760px, calc(100vh - 48px));
    border-radius: 16px;
    overflow: hidden;
    background: var(--gc-cream);
    color: var(--gc-text);
    box-shadow: 0 18px 50px rgba(7, 18, 46, 0.45);
}
.gc-panel[hidden] { display: none; }

@media (max-width: 575.98px) {
    /* Phones: the whole screen, so the keyboard never hides the conversation. */
    .gc-panel {
        top: 0;
        right: 0;
        bottom: auto;
        left: 0;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        border-radius: 0;
    }
    html.gc-locked,
    html.gc-locked body { overflow: hidden; }

    /* Give the conversation the room: no kicker. */
    .gc-head { padding: 8px 12px 8px 16px; }
    .gc-kicker { display: none; }
}

/* ---------- Header ---------- */
.gc-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px 10px 16px;
    background: var(--gc-navy);
    border-bottom: 3px solid var(--gc-gold);
}
.gc-kicker {
    margin: 0 0 2px;
    color: var(--gc-gold-light);
    font-family: var(--gc-heading);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.gc-title {
    margin: 0;
    color: #fff;
    font-family: var(--gc-heading);
    font-size: 18px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
.gc-close {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 0 14px;
    border: 2px solid rgba(255, 255, 255, 0.55);
    border-radius: 10px;
    background: transparent;
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.gc-close:hover { border-color: var(--gc-gold-light); color: var(--gc-gold-light); }

/* ---------- Conversation ---------- */
.gc-log {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px;
}
.gc-log:focus { outline: none; }

.gc-preview-note {
    margin: 0 0 12px;
    padding: 5px 10px;
    border: 1px dashed #b9a87a;
    border-radius: 8px;
    color: var(--gc-muted);
    font-size: 13px;
    text-align: center;
}

.gc-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 14px;
}
.gc-bot { align-items: flex-start; }
.gc-user { align-items: flex-end; }

.gc-bubble {
    max-width: 92%;
    padding: 10px 14px;
    border-radius: 15px;
    font-size: 16px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}
.gc-bubble p { margin: 0 0 0.6em; }
.gc-bubble p:last-child { margin-bottom: 0; }
.gc-bot .gc-bubble {
    border: 1px solid var(--gc-line);
    border-bottom-left-radius: 4px;
    background: #fff;
}
.gc-user .gc-bubble {
    border-bottom-right-radius: 4px;
    background: var(--gc-navy);
    color: #fff;
}
.gc-error .gc-bubble { border-left: 4px solid var(--gc-error); }

/* Suggested questions */
.gc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.gc-chip {
    min-height: 42px;
    padding: 8px 14px;
    border: 2px solid var(--gc-navy);
    border-radius: 999px;
    background: #fff;
    color: var(--gc-navy);
    font-size: 15px;
    font-weight: 600;
    line-height: 1.25;
    text-align: left;
    cursor: pointer;
}
.gc-chip:hover { background: var(--gc-navy); color: #fff; }
.gc-chip:disabled { opacity: 0.55; cursor: default; }

/* Buttons under an answer */
.gc-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.gc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 0 16px;
    border: 2px solid var(--gc-navy);
    border-radius: 999px;
    background: #fff;
    color: var(--gc-navy);
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
}
.gc-btn:hover { background: var(--gc-navy); color: #fff; }
.gc-btn-call { background: var(--gc-navy); color: #fff; }
.gc-btn-call:hover { background: var(--gc-navy-2); color: var(--gc-gold-light); }
.gc-btn-gold {
    border-color: var(--gc-gold);
    background: linear-gradient(180deg, var(--gc-gold-light), var(--gc-gold));
    color: var(--gc-navy);
}
.gc-btn-gold:hover { background: var(--gc-gold); color: var(--gc-navy); }
.gc-sold-out {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    background: #ebecef;
    color: #5b606c;
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
}

/* Show cards */
.gc-shows {
    display: grid;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
}
.gc-show {
    border: 1px solid var(--gc-line);
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
}
.gc-show-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--gc-navy);
    text-decoration: none;
}
.gc-show-title { text-decoration: underline; text-underline-offset: 3px; } /* the title opens the show's page */
.gc-show-head:hover { background: var(--gc-cream); color: var(--gc-navy-2); }
.gc-show-head img {
    flex-shrink: 0;
    width: 56px;
    height: 56px;
    border-radius: 8px;
    object-fit: cover;
}
.gc-show-title {
    display: block;
    font-family: var(--gc-heading);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.25;
}
.gc-show-flag {
    display: inline-block;
    margin-bottom: 4px;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--gc-navy);
    color: var(--gc-gold-light);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.gc-dates {
    margin: 0;
    padding: 0 12px;
    list-style: none;
}
.gc-dates li {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 12px;
    padding: 8px 0;
    border-top: 1px solid var(--gc-line);
}
.gc-when { font-size: 15px; line-height: 1.3; }
.gc-when strong { display: block; color: var(--gc-navy); }
.gc-when span { color: var(--gc-muted); }
.gc-more {
    display: block;
    padding: 10px;
    border-top: 1px solid var(--gc-line);
    color: var(--gc-navy);
    font-size: 15px;
    font-weight: 700;
    text-align: center;
}

/* "Looking that up..." */
.gc-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    color: var(--gc-muted);
    font-size: 15px;
}
.gc-typing[hidden] { display: none; }
.gc-dots { display: inline-flex; gap: 5px; }
.gc-dots i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--gc-gold);
    animation: gc-bounce 1.2s infinite ease-in-out;
}
.gc-dots i:nth-child(2) { animation-delay: 0.15s; }
.gc-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes gc-bounce {
    0%, 80%, 100% { transform: translateY(0); opacity: 0.45; }
    40% { transform: translateY(-5px); opacity: 1; }
}

/* ---------- Typing area ---------- */
.gc-form {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 10px 6px;
    border-top: 1px solid var(--gc-line);
    background: #fff;
}
.gc-input {
    flex: 1 1 auto;
    min-width: 0;
    max-height: 130px;
    padding: 10px 12px;
    border: 2px solid #b9bfcc;
    border-radius: 12px;
    background: #fff;
    color: var(--gc-text);
    font-size: 16px; /* 16px+ stops iPhones zooming in on focus: don't go lower */
    line-height: 1.4;
    resize: none;
    overflow-y: hidden; /* chat.js shows a scrollbar once the text reaches max-height */
}
.gc-input:focus { border-color: var(--gc-navy); outline: 3px solid var(--gc-gold-light); outline-offset: 0; }
.gc-input::placeholder { color: #737a8a; }
.gc-send {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    gap: 7px;
    min-height: 46px;
    padding: 0 16px;
    border: 0;
    border-radius: 12px;
    background: var(--gc-navy);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
}
.gc-send i { color: var(--gc-gold-light); }
.gc-send:hover { background: var(--gc-navy-2); }
.gc-send:disabled { opacity: 0.5; cursor: default; }

.gc-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 10px calc(4px + env(safe-area-inset-bottom)) 12px;
    background: #fff;
    color: var(--gc-muted);
    font-size: 11.5px;
    line-height: 1.3;
}
.gc-foot-actions { display: flex; flex-direction: column; align-items: flex-end; flex-shrink: 0; }
.gc-foot-actions .gc-restart { min-height: 26px; }

/* Staff-only problem report (chatbot_reporter) */
.gc-form[hidden], .gc-report[hidden] { display: none; }
.gc-report {
    padding: 12px 14px;
    border-top: 1px solid var(--gc-line);
    background: var(--gc-gold-soft);
}
.gc-report-label { display: block; margin-bottom: 6px; color: var(--gc-navy); font-size: 15px; font-weight: 700; }
.gc-report-label span { color: var(--gc-muted); font-size: 13px; font-weight: 600; }
.gc-report-note {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gc-line);
    border-radius: 10px;
    background: #fff;
    color: var(--gc-text);
    font-size: 16px;
    line-height: 1.4;
    resize: vertical;
}
.gc-report-note:focus { border-color: var(--gc-navy); outline: 3px solid var(--gc-gold-light); outline-offset: 0; }
.gc-report-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.gc-report-actions .gc-btn { min-height: 40px; }
.gc-report-status { margin: 8px 0 0; color: var(--gc-navy); font-size: 14px; font-weight: 600; }

.gc-restart {
    flex-shrink: 0;
    min-height: 32px;
    padding: 0 4px;
    border: 0;
    background: none;
    color: var(--gc-navy);
    font-size: 12.5px;
    font-weight: 700;
    text-decoration: underline;
    cursor: pointer;
}

/* ---------- Page version: the Box Office Assistant in the dashboard ----------
 * chatbot/box_office.html, data-mode="page": part of the page instead of a
 * floating panel. A utility (Jeremy, 2026-11-23): no intro or suggested
 * questions, and the chat fills everything between the page title and the
 * staff footer, so the page itself never scrolls. That is done with flex all
 * the way down the staff layout (staff-body > staff-shell > staff-main > main
 * > .sp > .gc), scoped to this page with :has(); a browser without :has()
 * keeps the fixed calc() heights below. */
.gc.is-page .gc-panel {
    position: relative;
    inset: auto;
    z-index: auto;
    width: 100%;
    height: calc(100vh - 220px);
    height: calc(100dvh - 220px);
    min-height: 420px;
    border: 1px solid var(--gc-line);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(7, 18, 46, 0.08);
}

.staff-body:has(.gc.is-page) {
    height: 100vh;
    height: 100dvh;
    min-height: 520px; /* very short windows: let the page scroll instead of crushing the chat */
}
.staff-body:has(.gc.is-page) > .staff-shell { flex: 1 1 0; min-height: 0; }
.staff-main:has(.gc.is-page) > main {
    display: flex;
    flex: 1 1 0;
    flex-direction: column;
    min-height: 0;
    padding-bottom: 0;
}
.sp:has(> .gc.is-page) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    width: 100%;
    min-height: 0;
    padding-bottom: 16px;
}
.sp:has(> .gc.is-page) > .sp-head { margin-bottom: 12px; }
.gc.is-page:has(.gc-panel) {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-height: 0;
}
.sp:has(> .gc.is-page) .gc-panel { flex: 1 1 auto; height: auto; min-height: 0; }

.gc.is-page .gc-log { padding: 18px 22px; }
.gc.is-page .gc-bubble { max-width: min(88%, 760px); }
.gc.is-page .gc-shows { max-width: 560px; }
.gc.is-page .gc-form { padding: 12px 14px 8px; }
.gc.is-page .gc-foot { padding: 0 14px 6px; font-size: 12px; }
.gc.is-page .gc-foot-actions { flex-direction: row; gap: 12px; }

.gc-box-only { white-space: nowrap; }
@media (max-width: 575.98px) {
    .gc.is-page .gc-panel {
        height: calc(100dvh - 165px);
        min-height: 380px;
        border-radius: 10px;
    }
    .sp:has(> .gc.is-page) { padding: 14px 12px 12px; }
    .sp:has(> .gc.is-page) > .sp-head { margin-bottom: 10px; }
    .gc.is-page .gc-log { padding: 12px; }
    .gc.is-page .gc-bubble { max-width: 92%; }
    .gc.is-page .gc-form { padding: 10px 10px 6px; }
    .gc.is-page .gc-foot { padding: 0 10px 4px; flex-wrap: wrap; row-gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .gc-dots i { animation: none; opacity: 1; }
    .gc-launcher, .gc-launcher i { transition: none; }
}

@media print {
    .gc { display: none !important; }
}
