/* ============================================================
   gemini-chat.css — Gemini AI Chat Widget for RealSearch
   Theme colour: #ef4f24
   ============================================================ */

:root {
    --gc-primary:    #ef4f24;
    --gc-primary-dk: #c73e1b;
    --gc-bg:         #ffffff;
    --gc-bg-alt:     #f5f5f5;
    --gc-text:       #202124;
    --gc-text-light: #5f6368;
    --gc-border:     #e0e0e0;
    --gc-radius:     12px;
    --gc-shadow:     0 4px 20px rgba(0,0,0,.18);
    --gc-z:          10100;
}

/* ── Bubble ─────────────────────────────────────────────────── */
#gc-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gc-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--gc-shadow);
    z-index: var(--gc-z);
    transition: transform .2s, background-color .2s;
    border: none;
    padding: 0;
}
#gc-bubble:hover { background: var(--gc-primary-dk); transform: scale(1.05); }
#gc-bubble svg,
#gc-bubble i    { font-size: 26px; pointer-events: none; }

/* Unread badge */
#gc-badge {
    position: absolute;
    top: 2px; right: 2px;
    background: #f44336;
    color: #fff;
    border-radius: 50%;
    width: 18px; height: 18px;
    font-size: 11px;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}
#gc-badge.visible { display: flex; }

/* ── Main modal ─────────────────────────────────────────────── */
#gc-modal {
    position: fixed;
    bottom: 96px;
    right: 24px;
    width: 400px;
    height: 620px;
    max-height: calc(100dvh - 110px);
    background: var(--gc-bg);
    border-radius: var(--gc-radius);
    box-shadow: var(--gc-shadow);
    z-index: var(--gc-z);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(.9) translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: transform .25s ease, opacity .25s ease;
}
#gc-modal.gc-open {
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* minimised state */
#gc-modal.gc-minimised {
    height: 52px;
    transform: scale(1) translateY(0);
    opacity: 1;
    pointer-events: auto;
}
#gc-modal.gc-minimised .gc-body,
#gc-modal.gc-minimised .gc-footer { display: none; }

/* maximised state — 80% width, 90% height, centred on screen */
#gc-modal.gc-maximised {
    width: 80%;
    height: 90vh;
    max-height: 90dvh;
    right: 10%;
    bottom: 5vh;
    border-radius: var(--gc-radius);
}
#gc-modal.gc-maximised .gc-msg-bubble  { font-size: 15px; line-height: 1.6; }
#gc-modal.gc-maximised .gc-tool-text   { font-size: 14px; line-height: 1.65; }
#gc-modal.gc-maximised #gc-input       { font-size: 15px; }

/* ── Header ─────────────────────────────────────────────────── */
.gc-header {
    background: var(--gc-primary);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.gc-header-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: rgba(255,255,255,.25);
    display: flex; align-items: center; justify-content: center;
}
.gc-header-info { flex: 1; min-width: 0; }
.gc-header-title {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.gc-header-sub {
    font-size: 11px;
    opacity: .85;
}
.gc-header-actions { display: flex; gap: 6px; }
.gc-header-btn {
    background: rgba(255,255,255,.2);
    border: none; color: #fff;
    width: 28px; height: 28px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}
.gc-header-btn:hover { background: rgba(255,255,255,.35); }

/* ── Body / panels ──────────────────────────────────────────── */
.gc-body {
    flex: 1;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* ── Sessions panel ─────────────────────────────────────────── */
#gc-sessions-panel {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: none;
}
#gc-sessions-panel.gc-active { display: block; }

.gc-sessions-header {
    font-size: 13px;
    font-weight: 600;
    color: var(--gc-text-light);
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 4px 6px 8px;
}

.gc-new-session-btn {
    width: 100%;
    background: var(--gc-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
    transition: background .15s;
}
.gc-new-session-btn:hover { background: var(--gc-primary-dk); }

.gc-session-item {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--gc-border);
    margin-bottom: 6px;
    transition: background .15s;
}
.gc-session-item:hover,
.gc-session-item.gc-active-session { background: #fff3f0; border-color: var(--gc-primary); }

.gc-session-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--gc-text);
}
.gc-session-meta {
    font-size: 11px;
    color: var(--gc-text-light);
    margin-top: 2px;
}

/* ── Chat panel ─────────────────────────────────────────────── */
#gc-chat-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Search bar */
.gc-search-bar {
    padding: 6px 10px;
    border-bottom: 1px solid var(--gc-border);
    display: none;
    flex-shrink: 0;
}
.gc-search-bar.gc-visible { display: block; }
.gc-search-input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--gc-border);
    border-radius: 20px;
    font-size: 13px;
    outline: none;
}
.gc-search-input:focus { border-color: var(--gc-primary); }

/* Messages */
.gc-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Date group divider */
.gc-date-divider {
    text-align: center;
    font-size: 11px;
    color: var(--gc-text-light);
    position: relative;
    margin: 4px 0;
}
.gc-date-divider::before,
.gc-date-divider::after {
    content: "";
    position: absolute;
    top: 50%;
    width: 30%;
    height: 1px;
    background: var(--gc-border);
}
.gc-date-divider::before { left: 0; }
.gc-date-divider::after  { right: 0; }

/* Message bubble */
.gc-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    min-width: 0;
}
.gc-msg.gc-msg-user  { align-self: flex-end;  align-items: flex-end;   }
.gc-msg.gc-msg-bot   { align-self: flex-start; align-items: flex-start; }

/* Tool result messages span full available width */
.gc-msg.gc-msg-tool {
    max-width: 100%;
    width: 100%;
}

.gc-msg-bubble {
    padding: 10px 13px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
    max-width: 100%;
    box-sizing: border-box;
}
.gc-msg-user .gc-msg-bubble {
    background: var(--gc-primary);
    color: #fff;
    border-radius: 16px 16px 4px 16px;
}
.gc-msg-bot .gc-msg-bubble {
    background: var(--gc-bg-alt);
    color: var(--gc-text);
    border-radius: 16px 16px 16px 4px;
}

/* highlighted search term */
.gc-highlight { background: #fff176; border-radius: 2px; padding: 0 1px; }

/* Meta row: copy button + timestamp */
.gc-msg-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
    padding: 0 2px;
}

/* Copy button — visible on message hover */
.gc-copy-btn {
    background: none;
    border: none;
    color: var(--gc-text-light);
    cursor: pointer;
    padding: 1px 4px;
    border-radius: 4px;
    font-size: 11px;
    opacity: 0;
    transition: opacity .15s, color .15s;
    line-height: 1;
}
.gc-msg:hover .gc-copy-btn { opacity: 1; }
.gc-copy-btn:hover { color: var(--gc-primary); }
.gc-copy-btn.gc-copied { color: #4CAF50; opacity: 1; }

/* Timestamp */
.gc-msg-time {
    font-size: 10px;
    color: var(--gc-text-light);
}

/* Typing indicator */
.gc-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 8px 13px;
    background: var(--gc-bg-alt);
    border-radius: 16px 16px 16px 4px;
    align-self: flex-start;
}
.gc-typing-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--gc-text-light);
    animation: gc-bounce .9s infinite;
}
.gc-typing-dot:nth-child(2) { animation-delay: .15s; }
.gc-typing-dot:nth-child(3) { animation-delay: .30s; }
@keyframes gc-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40%           { transform: translateY(-6px); }
}

/* ── Tool result: markdown-rendered text ─────────────────────── */
.gc-tool-text {
    background: #fff8f6;
    border-left: 3px solid var(--gc-primary);
    border-radius: 4px 12px 12px 4px;
    padding: 10px 13px;
    font-size: 13px;
    line-height: 1.6;
    color: var(--gc-text);
    max-width: 100%;
    overflow-wrap: break-word;
}

/* ── Markdown elements (tool text + bot bubbles) ─────────────── */
#gc-modal h1.gc-md-h,
#gc-modal h2.gc-md-h,
#gc-modal h3.gc-md-h,
#gc-modal h4.gc-md-h {
    font-weight: 600;
    line-height: 1.3;
    margin: 10px 0 4px;
    color: var(--gc-text);
}
#gc-modal h1.gc-md-h { font-size: 15px; border-bottom: 1px solid var(--gc-border); padding-bottom: 4px; }
#gc-modal h2.gc-md-h { font-size: 14px; color: var(--gc-primary); }
#gc-modal h3.gc-md-h { font-size: 13px; }
#gc-modal h4.gc-md-h { font-size: 12px; color: var(--gc-text-light); text-transform: uppercase; letter-spacing: .3px; }

/* First heading in a block needs no top gap */
#gc-modal .gc-md-content > h1.gc-md-h:first-child,
#gc-modal .gc-md-content > h2.gc-md-h:first-child,
#gc-modal .gc-md-content > h3.gc-md-h:first-child { margin-top: 0; }

#gc-modal .gc-md-hr {
    border: none;
    border-top: 1px solid var(--gc-border);
    margin: 8px 0;
}

#gc-modal .gc-md-ul,
#gc-modal .gc-md-ol {
    margin: 4px 0 6px;
    padding-left: 18px;
}
#gc-modal .gc-md-ul li,
#gc-modal .gc-md-ol li { margin-bottom: 3px; }

#gc-modal .gc-md-bq {
    border-left: 3px solid var(--gc-primary);
    margin: 4px 0;
    padding: 3px 10px;
    color: var(--gc-text-light);
    font-style: italic;
    background: rgba(239,79,36,.05);
    border-radius: 0 4px 4px 0;
}

/* Inline code inside any message */
#gc-modal .gc-msg-bubble code,
#gc-modal .gc-tool-text code {
    background: rgba(0,0,0,.08);
    border-radius: 3px;
    padding: 1px 5px;
    font-family: monospace;
    font-size: .88em;
}

/* User bubble overrides — keep code readable on coloured bg */
#gc-modal .gc-msg-user .gc-msg-bubble code {
    background: rgba(255,255,255,.25);
    color: #fff;
}

/* ── Page label for load-more results ──────────────────────── */
.gc-page-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--gc-text-light);
    text-transform: uppercase;
    letter-spacing: .4px;
    padding: 0 2px 6px;
}

/* ── Tool HTML wrapper ──────────────────────────────────────── */
.gc-tool-html-wrap {
    max-width: 100%;
    overflow: hidden;
    box-sizing: border-box;
}

/* ── Property cards ─────────────────────────────────────────── */
.gc-property-results {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
}

.gc-property-card {
    display: flex;
    gap: 10px;
    background: #fff;
    border: 1px solid var(--gc-border);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .2s, transform .2s;
    cursor: pointer;
    max-width: 100%;
    box-sizing: border-box;
}
.gc-property-card:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,.12);
    transform: translateY(-2px);
}

.gc-prop-image {
    width: 110px;
    min-width: 110px;
    height: 90px;
    object-fit: cover;
    flex-shrink: 0;
    background: #eee;
}

.gc-prop-body {
    padding: 8px 10px 8px 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
}

.gc-prop-price {
    font-size: 15px;
    font-weight: 600;
    color: var(--gc-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gc-prop-address {
    font-size: 12px;
    color: var(--gc-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gc-prop-specs {
    display: flex;
    gap: 10px;
    font-size: 12px;
    color: var(--gc-text-light);
}
.gc-prop-specs i { color: var(--gc-primary); margin-right: 2px; }

.gc-prop-inspection,
.gc-prop-auction {
    font-size: 11px;
    color: var(--gc-text-light);
}
.gc-prop-inspection i { color: #4CAF50; }
.gc-prop-auction    i { color: #f57c00; }

.gc-prop-view {
    font-size: 11px;
    font-weight: 500;
    color: var(--gc-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.gc-prop-view i { font-size: 10px; }

/* ── Footer / Input ─────────────────────────────────────────── */
.gc-footer {
    border-top: 1px solid var(--gc-border);
    padding: 8px 10px;
    display: flex;
    align-items: flex-end;
    gap: 8px;
    flex-shrink: 0;
    background: var(--gc-bg);
}

.gc-input-wrap {
    flex: 1;
    background: var(--gc-bg-alt);
    border-radius: 20px;
    padding: 8px 14px;
    display: flex;
    align-items: center;
}

#gc-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    resize: none;
    min-height: 20px;
    max-height: 100px;
    overflow-y: auto;
    line-height: 1.4;
    color: var(--gc-text);
}

#gc-send {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--gc-primary);
    border: none;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 16px;
    transition: background .15s;
}
#gc-send:hover   { background: var(--gc-primary-dk); }
#gc-send:disabled { background: #ccc; cursor: default; }

/* Quick chips */
.gc-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 10px 8px;
    flex-shrink: 0;
}
.gc-chip {
    background: #fff3f0;
    border: 1px solid var(--gc-primary);
    color: var(--gc-primary);
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s;
    white-space: nowrap;
}
.gc-chip:hover { background: var(--gc-primary); color: #fff; }

/* ── "No sessions" placeholder ──────────────────────────────── */
.gc-no-sessions {
    text-align: center;
    padding: 24px 16px;
    color: var(--gc-text-light);
    font-size: 13px;
}

/* ── Load-more button inside property results ────────────────── */
.gc-load-more-wrap {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
}

.gc-load-more-btn {
    background: #fff3f0;
    border: 1px solid var(--gc-primary);
    color: var(--gc-primary);
    border-radius: 20px;
    padding: 6px 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.gc-load-more-btn:hover   { background: var(--gc-primary); color: #fff; }
.gc-load-more-btn:disabled { background: #eee; border-color: #ccc; color: #999; cursor: default; }

/* ── Error toast ─────────────────────────────────────────────── */
.gc-error-toast {
    background: #fdecea;
    border: 1px solid #f44336;
    color: #b71c1c;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0;
    align-self: stretch;
}
.gc-error-toast i { flex-shrink: 0; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
    #gc-modal {
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
        max-height: 100dvh;
        border-radius: 0;
    }
    /* On mobile the modal is already full-screen — maximised is the same */
    #gc-modal.gc-maximised {
        width: 100%;
        height: 100%;
        max-height: 100dvh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    #gc-bubble {
        bottom: 16px;
        right: 16px;
    }
}

.gc-msg table,
.gc-md-table {
  border-collapse: collapse;
  width: 100%;
  margin: 8px 0;
  font-size: 0.9em;
}

.gc-msg th, .gc-msg td,
.gc-md-table th, .gc-md-table td {
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: left;
}

.gc-md-table thead tr {
  background: #f0f4ff;
  font-weight: 600;
}

.gc-md-table tbody tr:nth-child(even) {
  background: #f9f9f9;
}

.gc-md-table tbody tr:hover {
  background: #eef2ff;
}

.gc-md-pre {
  background: #1e1e2e;
  color: #cdd6f4;
  border-radius: 8px;
  padding: 12px 14px;
  margin: 8px 0;
  overflow-x: auto;
  font-size: 0.85em;
  line-height: 1.5;
}

.gc-md-pre code {
  background: none;
  color: inherit;
  padding: 0;
  font-family: 'Consolas', 'Monaco', monospace;
  white-space: pre;
}

.gc-msg ul {
    margin-left: 15px;
}