/* ==========================================================================
   GFPD Digital Assistant — Shared Styles (Inline Q&A, Ordinance Cards,
   Contact Pre-Check & Floating Corner Chat Widget)
   Matches GFPD Dark Charcoal (#111827 / #1f2937) + Police Gold/Amber (#f59e0b)
   ========================================================================== */

:root {
    --gfpd-bg-deep: #111827;
    --gfpd-bg-card: #1f2937;
    --gfpd-bg-elevated: #283548;
    --gfpd-border: #374151;
    --gfpd-border-subtle: rgba(255, 255, 255, 0.08);
    --gfpd-amber: #f59e0b;
    --gfpd-amber-hover: #fbbf24;
    --gfpd-amber-deep: #d97706;
    --gfpd-text-main: #f3f4f6;
    --gfpd-text-body: #d1d5db;
    --gfpd-text-muted: #9ca3af;
}

/* ─── Markdown Content Styling ─── */
.gfpd-md {
    color: var(--gfpd-text-body);
    font-size: 0.9375rem;
    line-height: 1.65;
    word-break: break-word;
}
.gfpd-md > *:first-child { margin-top: 0; }
.gfpd-md > *:last-child { margin-bottom: 0; }
.gfpd-md h1, .gfpd-md h2, .gfpd-md h3, .gfpd-md h4 {
    font-family: 'Oswald', sans-serif;
    color: var(--gfpd-amber-hover);
    letter-spacing: 0.02em;
    margin-top: 1rem;
    margin-bottom: 0.375rem;
    font-weight: 700;
}
.gfpd-md h3 { font-size: 1.15rem; }
.gfpd-md h4 { font-size: 1rem; color: #ffffff; }
.gfpd-md p { margin: 0.5rem 0; }
.gfpd-md ul, .gfpd-md ol {
    margin: 0.5rem 0 0.5rem 1.25rem;
    padding: 0;
}
.gfpd-md ul { list-style-type: disc; }
.gfpd-md ol { list-style-type: decimal; }
.gfpd-md li { margin-bottom: 0.3rem; }
.gfpd-md strong { color: #ffffff; font-weight: 700; }
.gfpd-md em { font-style: italic; }
.gfpd-md code {
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--gfpd-border);
    padding: 0.1rem 0.35rem;
    border-radius: 0.25rem;
    font-size: 0.85em;
    color: #fde68a;
}
.gfpd-md a {
    color: var(--gfpd-amber-hover);
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.15s ease;
}
.gfpd-md a:hover { color: #fde68a; }

.gfpd-md-compact {
    font-size: 0.84rem;
    line-height: 1.55;
}

/* ─── Structured Ordinance Cards (Inline & Chat) ─── */
.gfpd-ord-card {
    background: linear-gradient(180deg, rgba(31, 41, 55, 0.98) 0%, rgba(17, 24, 39, 0.98) 100%);
    border: 1px solid var(--gfpd-border);
    border-radius: 0.875rem;
    overflow: hidden;
    text-align: left;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.gfpd-ord-body {
    padding: 1.25rem 1.375rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.gfpd-ord-card--compact .gfpd-ord-body {
    padding: 0.875rem 1rem;
    gap: 0.75rem;
}

.gfpd-ord-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    align-self: flex-start;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-transform: uppercase;
}
.gfpd-ord-badge--town {
    background: rgba(16, 185, 129, 0.14);
    border: 1px solid rgba(52, 211, 153, 0.4);
    color: #6ee7b7;
}
.gfpd-ord-badge--county,
.gfpd-ord-badge--state {
    background: rgba(245, 158, 11, 0.14);
    border: 1px solid rgba(251, 191, 36, 0.4);
    color: #fcd34d;
}

.gfpd-ord-notice {
    border-radius: 0.5rem;
    padding: 0.65rem 0.85rem;
    font-size: 0.78rem;
    line-height: 1.45;
}
.gfpd-ord-notice--warn {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    color: #fde68a;
}
.gfpd-ord-notice--info {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(96, 165, 250, 0.32);
    color: #bfdbfe;
}
.gfpd-ord-notice--ok {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(52, 211, 153, 0.35);
    color: #a7f3d0;
}

.gfpd-ord-heading {
    font-family: 'Oswald', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gfpd-amber-hover);
    margin: 0 0 0.35rem 0;
}

.gfpd-ord-details {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}
.gfpd-ord-details li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.55;
    color: var(--gfpd-text-body);
}
.gfpd-ord-card--compact .gfpd-ord-details li {
    font-size: 0.8125rem;
}
.gfpd-ord-bullet {
    color: var(--gfpd-amber);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 0.05rem;
}

.gfpd-ord-source-wrap {
    border-top: 1px solid var(--gfpd-border);
    padding-top: 0.75rem;
}
.gfpd-ord-source-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--gfpd-text-muted);
    margin-bottom: 0.4rem;
}
.gfpd-ord-source-link {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--gfpd-border);
    color: var(--gfpd-text-main);
    padding: 0.4rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-decoration: none;
    max-width: 100%;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.gfpd-ord-source-link:hover {
    background: rgba(245, 158, 11, 0.15);
    border-color: rgba(245, 158, 11, 0.5);
    color: var(--gfpd-amber-hover);
}
.gfpd-ord-source-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ─── Town-Limits Address Checker inside Ordinance Card ─── */
.gfpd-limits-box {
    background: rgba(17, 24, 39, 0.85);
    border-top: 1px solid var(--gfpd-border);
    padding: 1rem 1.375rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.gfpd-limits-form {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.gfpd-limits-input {
    flex: 1 1 220px;
    background: #1f2937;
    border: 1px solid #4b5563;
    color: #f3f4f6;
    border-radius: 0.5rem;
    padding: 0.55rem 0.8rem;
    font-size: 0.875rem;
}
.gfpd-limits-input:focus {
    outline: none;
    border-color: var(--gfpd-amber);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.35);
}
.gfpd-limits-btn {
    background: var(--gfpd-amber);
    color: #111827;
    font-weight: 700;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: none;
    border-radius: 0.5rem;
    padding: 0.55rem 1rem;
    cursor: pointer;
    transition: background 0.15s ease;
}
.gfpd-limits-btn:hover:not(:disabled) {
    background: var(--gfpd-amber-hover);
}
.gfpd-limits-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Follow-up Suggestion Pills & Action Bar ─── */
.gfpd-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.85rem;
}
.gfpd-suggestion-pill {
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: #fcd34d;
    border-radius: 9999px;
    padding: 0.32rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.gfpd-suggestion-pill:hover {
    background: rgba(245, 158, 11, 0.22);
    border-color: var(--gfpd-amber-hover);
    color: #ffffff;
}

.gfpd-qa-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--gfpd-border);
}
.gfpd-btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: #374151;
    border: 1px solid #4b5563;
    color: #f3f4f6;
    font-size: 0.82rem;
    font-weight: 600;
    padding: 0.5rem 0.9rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.gfpd-btn-secondary:hover {
    background: #4b5563;
    border-color: #6b7280;
}
.gfpd-btn-amber {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--gfpd-amber);
    border: 1px solid var(--gfpd-amber);
    color: #111827;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 0.5rem 0.95rem;
    border-radius: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s ease;
}
.gfpd-btn-amber:hover {
    background: var(--gfpd-amber-hover);
}

/* ─── Contact Form Instant-Answer Intercept Card ─── */
.gfpd-intercept-card {
    background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.4);
}
.gfpd-intercept-answer {
    background: rgba(17, 24, 39, 0.9);
    border: 1px solid var(--gfpd-border);
    border-radius: 0.625rem;
    padding: 1rem 1.15rem;
    max-height: 22rem;
    overflow-y: auto;
    margin: 1rem 0;
}

/* ─── Floating Corner Chat Widget ─── */
.gfpd-chat-root {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 60;
    font-family: 'Roboto', sans-serif;
    transition: bottom 0.25s ease;
}

/* Automatic collision avoidance with Floating Album Switcher on events.html */
body:has(.album-switcher.visible) .gfpd-chat-root,
.gfpd-chat-root.gfpd-chat-root--raised {
    bottom: 6.5rem;
}

.gfpd-chat-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #111827;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-radius: 9999px;
    padding: 0.7rem 1.15rem 0.7rem 0.85rem;
    font-family: 'Oswald', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(245, 158, 11, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}
.gfpd-chat-launcher:hover {
    transform: translateY(-2px);
    filter: brightness(1.06);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.6), 0 0 16px rgba(245, 158, 11, 0.35);
}
.gfpd-chat-launcher:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}
.gfpd-chat-launcher-badge {
    width: 1.75rem;
    height: 1.75rem;
    object-fit: contain;
    flex-shrink: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
}

.gfpd-chat-panel {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    width: min(25rem, calc(100vw - 1.5rem));
    height: min(38rem, calc(100dvh - 2.5rem));
    background: #111827;
    border: 1px solid #374151;
    border-radius: 1rem;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 70;
}
.gfpd-chat-panel[hidden] {
    display: none !important;
}

.gfpd-chat-header {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    border-bottom: 1px solid #374151;
    padding: 0.75rem 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.gfpd-chat-header-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}
.gfpd-chat-header-logo {
    width: 2.1rem;
    height: 2.1rem;
    object-fit: contain;
    flex-shrink: 0;
}
.gfpd-chat-header-title {
    font-family: 'Oswald', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #ffffff;
    line-height: 1.15;
    margin: 0;
}
.gfpd-chat-header-sub {
    font-size: 0.7rem;
    color: var(--gfpd-amber-hover);
    margin: 0.1rem 0 0 0;
}
.gfpd-chat-header-controls {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}
.gfpd-chat-icon-btn {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: #d1d5db;
    border-radius: 0.45rem;
    padding: 0.32rem 0.5rem;
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.gfpd-chat-icon-btn:hover {
    background: rgba(245, 158, 11, 0.2);
    color: #ffffff;
}
.gfpd-chat-icon-btn--active {
    background: rgba(245, 158, 11, 0.22);
    border-color: rgba(245, 158, 11, 0.55);
    color: #fcd34d;
}

.gfpd-chat-911 {
    background: rgba(127, 29, 29, 0.45);
    border-bottom: 1px solid rgba(239, 68, 68, 0.32);
    padding: 0.38rem 0.9rem;
    font-size: 0.72rem;
    color: #fecaca;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}
.gfpd-chat-911 a {
    color: #ffffff;
    font-weight: 700;
    text-decoration: underline;
    white-space: nowrap;
}

.gfpd-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    background: #111827;
}

.gfpd-msg {
    display: flex;
    flex-direction: column;
    max-width: 90%;
}
.gfpd-msg--user {
    align-self: flex-end;
    align-items: flex-end;
}
.gfpd-msg--assistant {
    align-self: flex-start;
    align-items: flex-start;
    max-width: 94%;
}

.gfpd-bubble {
    padding: 0.7rem 0.9rem;
    border-radius: 0.875rem;
    font-size: 0.85rem;
    line-height: 1.55;
}
.gfpd-msg--user .gfpd-bubble {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #111827;
    font-weight: 500;
    border-bottom-right-radius: 0.25rem;
}
.gfpd-msg--assistant .gfpd-bubble {
    background: #1f2937;
    border: 1px solid #374151;
    color: #e5e7eb;
    border-bottom-left-radius: 0.25rem;
}

.gfpd-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: #1f2937;
    border: 1px solid #374151;
    color: #fcd34d;
    padding: 0.55rem 0.85rem;
    border-radius: 0.75rem;
    font-size: 0.8rem;
}
.gfpd-spinner {
    width: 0.95rem;
    height: 0.95rem;
    border: 2px solid rgba(245, 158, 11, 0.25);
    border-top-color: #f59e0b;
    border-radius: 50%;
    animation: gfpd-spin 0.75s linear infinite;
    flex-shrink: 0;
}
@keyframes gfpd-spin {
    to { transform: rotate(360deg); }
}

.gfpd-chat-footer {
    background: #1f2937;
    border-top: 1px solid #374151;
    padding: 0.7rem 0.8rem;
}
.gfpd-chat-form {
    display: flex;
    gap: 0.45rem;
}
.gfpd-chat-input {
    flex: 1;
    background: #111827;
    border: 1px solid #4b5563;
    border-radius: 0.6rem;
    padding: 0.6rem 0.8rem;
    color: #ffffff;
    font-size: 0.875rem;
}
.gfpd-chat-input:focus {
    outline: none;
    border-color: var(--gfpd-amber);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.3);
}
.gfpd-chat-send {
    background: var(--gfpd-amber);
    color: #111827;
    border: none;
    border-radius: 0.6rem;
    padding: 0 0.9rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}
.gfpd-chat-send:hover:not(:disabled) {
    background: var(--gfpd-amber-hover);
}
.gfpd-chat-send:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.gfpd-chat-disclaimer {
    margin: 0.4rem 0 0 0;
    font-size: 0.65rem;
    color: #9ca3af;
    text-align: center;
}

@media (max-width: 640px) {
    .gfpd-chat-panel {
        right: 0.5rem;
        left: 0.5rem;
        bottom: 0.5rem;
        width: auto;
        height: min(36rem, calc(100dvh - 1rem));
    }
    .gfpd-chat-launcher-text {
        font-size: 0.85rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .gfpd-spinner { animation: none; }
    .gfpd-chat-launcher, .gfpd-chat-root { transition: none; }
}
