/* Guest contact form + the phone sticky bar + the seller's "From shoppers not signed in" panel
   (fix #2; docs/BUYER_CONTACT_AND_TRAFFIC_FIXES_PLAN.md §3). Prefix: .giq-
   The form and the panel sit on surfaces that stay WHITE in dark mode (.section-card on the car page, .dash-section on
   the contact page — public/css/theme.css), so everything inside them uses literal light colours, never theme tokens
   (FEATURE_BUILD_STANDARD §6.1). The sticky bar floats over the page itself, so it follows the theme. */

/* ── The form ─────────────────────────────────────────────────────────────── */
.giq-card { color-scheme: light; color: #0d1526; }
.giq-card .giq-title { font-family: 'Montserrat', sans-serif; font-size: 1.05rem; font-weight: 800; color: #0d1526; margin: 0 0 6px; }
.giq-card .giq-lead { font-size: 0.92rem; color: #374151; margin: 0 0 16px; line-height: 1.5; }
.giq-form { display: block; margin: 0; }
.giq-form[hidden] { display: none; }
.giq-field { margin: 0 0 14px; }
.giq-field label { display: block; font-size: 0.85rem; font-weight: 700; color: #1f2937; margin: 0 0 6px; }
.giq-field .giq-optional { font-weight: 400; color: #4b5563; }
.giq-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.giq-pair .giq-field { margin-bottom: 0; }
.giq-pair-wrap { margin: 0 0 14px; }
.giq-form input[type="text"],
.giq-form input[type="email"],
.giq-form input[type="tel"],
.giq-form textarea,
[data-theme="dark"] .giq-form input[type="text"],
[data-theme="dark"] .giq-form input[type="email"],
[data-theme="dark"] .giq-form input[type="tel"],
[data-theme="dark"] .giq-form textarea {
    display: block; width: 100%; box-sizing: border-box;
    min-height: 44px; padding: 10px 12px;
    font: inherit; font-size: 0.95rem; line-height: 1.4;
    color: #0d1526; background: #ffffff;
    border: 1px solid #9ca3af; border-radius: 8px;
}
.giq-form textarea { min-height: 112px; resize: vertical; }
.giq-form input::placeholder,
.giq-form textarea::placeholder,
[data-theme="dark"] .giq-form input::placeholder,
[data-theme="dark"] .giq-form textarea::placeholder { color: #6b7280; opacity: 1; }
.giq-form input:focus-visible,
.giq-form textarea:focus-visible { outline: 3px solid #1d4ed8; outline-offset: 1px; border-color: #1d4ed8; }
.giq-form [aria-invalid="true"] { border-color: #b91c1c; }
.giq-help { font-size: 0.8rem; color: #4b5563; margin: 12px 0 0; line-height: 1.45; }
.giq-error { font-size: 0.82rem; font-weight: 600; color: #b91c1c; margin: 12px 0 0; }
.giq-error[hidden] { display: none; }
.giq-note { font-size: 0.8rem; color: #4b5563; margin: 4px 0 0; line-height: 1.5; }
.giq-note a, .giq-card .giq-signin a { color: #1d4ed8; font-weight: 600; }
.giq-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 18px 0 0; }
.giq-submit,
[data-theme="dark"] .giq-submit {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 11px 22px;
    font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 800; letter-spacing: .02em;
    color: #ffffff; background: #1d4ed8; border: 1px solid #1d4ed8; border-radius: 10px; cursor: pointer;
}
.giq-submit:hover { background: #1e40af; border-color: #1e40af; }
.giq-submit:focus-visible { outline: 3px solid #0d1526; outline-offset: 2px; }
.giq-submit[disabled] { opacity: .65; cursor: progress; }
.giq-card .giq-signin { font-size: 0.85rem; color: #374151; margin: 0; }
.giq-status { margin: 0 0 14px; }
.giq-status:empty { display: none; }
.giq-alert { padding: 12px 14px; border-radius: 8px; font-size: 0.9rem; line-height: 1.45; margin: 0 0 14px; }
.giq-alert--ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.giq-alert--err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.giq-count { font-variant-numeric: tabular-nums; }

/* The car summary on the stand-alone page (/listings/:id/contact). */
.giq-car { display: flex; gap: 16px; align-items: center; margin: 0 0 18px; }
.giq-car img { width: 120px; height: 80px; object-fit: cover; border-radius: 8px; flex-shrink: 0; background: #e5e7eb; }
.giq-car-title { font-weight: 800; color: #0d1526; margin: 0 0 4px; font-size: 1rem; }
.giq-car-meta { color: #374151; font-size: 0.88rem; margin: 0; }
.giq-page-body { padding: 24px; }
.giq-page-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 16px 0 0; }
.giq-page-actions a {
    display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 10px 18px;
    border-radius: 10px; font-weight: 700; text-decoration: none; color: #1d4ed8; background: #ffffff; border: 1px solid #1d4ed8;
}

@media (max-width: 600px) {
    .giq-pair { grid-template-columns: 1fr; gap: 14px; }
    .giq-page-body { padding: 16px; }
    .giq-car img { width: 96px; height: 64px; }
    .giq-submit { width: 100%; }
}

/* ── The phone sticky bar: Call + Message on every car (≤ 879 px only) ───── */
/* 879, not 960: from 880px the car page is two panes with the price card and its buttons on screen (listing.css,
   docs/FOLDABLE_LAYOUT_PLAN.md W3), so the bar would repeat them. */
.giq-sticky, .giq-sticky-spacer { display: none; }
@media (max-width: 879px) {
    .giq-sticky {
        display: flex; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
        background: var(--bg-surface, #ffffff); border-top: 1px solid var(--border-color, #e5e7eb);
        box-shadow: 0 -4px 16px rgba(13, 21, 38, 0.12);
    }
    [data-theme="dark"] .giq-sticky { border-top-color: #2a3b60; box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.4); }
    .giq-sticky-spacer { display: block; height: 76px; }
    .giq-sticky a {
        flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
        min-height: 48px; padding: 10px 12px; border-radius: 10px; text-decoration: none;
        font-family: 'Montserrat', sans-serif; font-size: 0.95rem; font-weight: 800; letter-spacing: .04em;
    }
    .giq-sticky svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; flex-shrink: 0; }
    .giq-sticky .giq-call { color: #1d4ed8; background: #ffffff; border: 2px solid #1d4ed8; }
    [data-theme="dark"] .giq-sticky .giq-call { color: #ffffff; background: transparent; border-color: #93b4ff; }
    .giq-sticky .giq-message { color: #ffffff; background: #1d4ed8; border: 2px solid #1d4ed8; }
    .giq-sticky a:focus-visible { outline: 3px solid #f5a623; outline-offset: 2px; }
}
/* Short landscape windows — iPhone Duo folded and turned sideways (368px tall), any phone held sideways
   (docs/FOLDABLE_LAYOUT_PLAN.md W4): 8px of padding and 44px buttons (the tap minimum) make the bar 60px, not 76px. */
@media (max-width: 879px) and (orientation: landscape) and (max-height: 480px) {
    .giq-sticky { padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px)); }
    .giq-sticky a { min-height: 44px; padding: 6px 12px; }
    .giq-sticky-spacer { height: 60px; }
}
/* At ≤ 490 px the car page's floating location button sits at the bottom right (public/css/sitewide.css, and
   public/js/userLocation.js writes bottom: 20px inline) — exactly where the sticky bar is. Lift it above the bar
   whenever the bar is on the page; !important because the position is an inline style (layout check, Nov 10). */
@media (max-width: 490px) {
    .listing-details-page:has(.giq-sticky) .location-box { bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important; }
}

/* ── The seller's panel on the Messages page (/conversations) ───────────── */
.giq-panel {
    flex-shrink: 0; color-scheme: light;
    margin: 16px 16px 0; background: #ffffff; color: #0d1526;
    border: 1px solid #e5e7eb; border-radius: 12px; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
[data-theme="dark"] .giq-panel { background: #ffffff; border-color: rgba(255, 255, 255, 0.18); }
.giq-panel > summary {
    list-style: none; cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
    min-height: 48px; padding: 12px 16px; font-weight: 800; color: #0d1526;
}
.giq-panel > summary::-webkit-details-marker { display: none; }
.giq-panel > summary::after { content: "▾"; margin-left: auto; color: #374151; }
.giq-panel:not([open]) > summary::after { content: "▸"; }
.giq-panel > summary:focus-visible { outline: 3px solid #1d4ed8; outline-offset: -3px; border-radius: 12px; }
.giq-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 700; background: #fef3c7; color: #78350f; }
.giq-panel-body { padding: 0 16px 16px; border-top: 1px solid #e5e7eb; }
/* The Messages page is a viewport-high inbox (public/css/conversations.css .conv-layout). With the guest panel above
   it, the page grows instead of the panel scrolling inside a box (no clipped, hidden messages): the inbox keeps its
   own viewport-high, internally scrolling box below the panel. */
.conv-layout:has(> .giq-panel) { height: auto; min-height: calc(100vh - 80px); }
.conv-layout:has(> .giq-panel) > .inbox-page { flex: none; height: calc(100vh - 80px); margin-top: 16px; }
.giq-panel-note { font-size: 0.85rem; color: #374151; margin: 12px 0; line-height: 1.5; }
.giq-empty { font-size: 0.9rem; color: #374151; margin: 12px 0 0; }
.giq-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.giq-item { border: 1px solid #e5e7eb; border-radius: 10px; padding: 16px; background: #f8f9fb; }
.giq-item--answered { background: #ffffff; }
.giq-item-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 0 8px; }
.giq-item-name { font-weight: 800; color: #0d1526; }
.giq-item-time { font-size: 0.8rem; color: #4b5563; }
.giq-item-car { font-size: 0.85rem; color: #374151; margin: 0 0 8px; }
.giq-item-car a, .giq-item-contact a { color: #1d4ed8; font-weight: 600; }
.giq-item-contact { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.88rem; margin: 0 0 8px; }
.giq-item-msg { white-space: pre-line; overflow-wrap: anywhere; font-size: 0.92rem; color: #1f2937; margin: 0 0 8px; }
.giq-item-flag { font-size: 0.78rem; color: #4b5563; margin: 0 0 12px; }
.giq-item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.giq-item-state { font-size: 0.85rem; color: #065f46; font-weight: 600; }
.giq-answer-form { margin: 0; }
.giq-answer-btn,
[data-theme="dark"] .giq-answer-btn {
    min-height: 44px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
    font: inherit; font-size: 0.88rem; font-weight: 700; color: #ffffff; background: #1d4ed8; border: 1px solid #1d4ed8;
}
.giq-answer-btn:hover { background: #1e40af; }
.giq-answer-btn:focus-visible { outline: 3px solid #0d1526; outline-offset: 2px; }
/* Report as spam — secondary and red-outlined (a destructive-ish action, confirmed through the site dialog). */
.giq-spam-btn,
[data-theme="dark"] .giq-spam-btn {
    min-height: 44px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
    font: inherit; font-size: 0.88rem; font-weight: 700; color: #b91c1c; background: #ffffff; border: 1px solid #b91c1c;
}
.giq-spam-btn:hover { background: #fef2f2; }
.giq-spam-btn:focus-visible { outline: 3px solid #0d1526; outline-offset: 2px; }
