/* Tenant chat — Gemini-style (plain CSS, no Tailwind build required) */

.fi-chat-page .fi-page-header-main-ctn .fi-header {
    display: none;
}

.fi-chat-page .fi-page-main {
    padding-top: 0 !important;
}

body.tenant-chat-fullscreen .fi-page-main,
body.tenant-chat-fullscreen .fi-page-content {
    padding: 0 !important;
}

body.tenant-chat-fullscreen .fi-page-header-main-ctn {
    min-height: 0;
}

@media (max-width: 1023px) {
    body.tenant-chat-mobile-immersive .gemini-chat,
    body.tenant-chat-fullscreen .gemini-chat {
        min-height: 100%;
        height: 100%;
        margin-left: 0;
        margin-right: 0;
    }
}

.gemini-chat {
    position: relative;
    display: flex;
    min-height: calc(100vh - 4.5rem);
    flex-direction: column;
    margin-left: -1rem;
    margin-right: -1rem;
    background: #f0f4f9;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

@media (min-width: 768px) {
    .gemini-chat {
        margin-left: -1.5rem;
        margin-right: -1.5rem;
    }
}

@media (min-width: 1024px) {
    .gemini-chat {
        margin-left: -2rem;
        margin-right: -2rem;
    }
}

.dark .gemini-chat {
    background: #131314;
}

/* Toolbar */
.gemini-chat__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
}

@media (min-width: 640px) {
    .gemini-chat__toolbar {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.gemini-chat__brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.gemini-chat__brand-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #374151;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dark .gemini-chat__brand-name {
    color: #e5e7eb;
}

.gemini-chat__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.gemini-chat__icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.gemini-chat__icon-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.gemini-chat__icon-btn--active {
    background: rgba(37, 99, 235, 0.12);
    color: #2563eb;
}

.dark .gemini-chat__icon-btn {
    color: #9ca3af;
}

.dark .gemini-chat__icon-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
}

.gemini-chat__icon-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.dark .gemini-chat__icon-btn--active {
    background: rgba(37, 99, 235, 0.22);
    color: #93c5fd;
}

.gemini-chat__history {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    justify-content: flex-end;
    background: rgba(15, 23, 42, 0.35);
}

.gemini-chat__history-panel {
    display: flex;
    flex-direction: column;
    width: min(100%, 22rem);
    height: 100%;
    background: #fff;
    box-shadow: -8px 0 32px rgba(15, 23, 42, 0.12);
}

.gemini-chat__history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.gemini-chat__history-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
}

.gemini-chat__history-close {
    border: none;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
}

.gemini-chat__history-tabs {
    display: flex;
    gap: 0.375rem;
    padding: 0.625rem 1rem;
    border-bottom: 1px solid #e5e7eb;
}

.gemini-chat__history-tab {
    flex: 1;
    border: none;
    border-radius: 9999px;
    background: #f3f4f6;
    padding: 0.375rem 0.75rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
}

.gemini-chat__history-tab--active {
    background: #2563eb;
    color: #fff;
}

.gemini-chat__history-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0.75rem 1rem 1rem;
}

.gemini-chat__history-loading,
.gemini-chat__history-empty {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
    text-align: center;
    padding: 2rem 0.5rem;
}

.gemini-chat__history-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.5rem;
}

.gemini-chat__history-item-btn {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 0.75rem;
    background: #f9fafb;
    padding: 0.75rem;
    text-align: left;
    cursor: pointer;
    display: grid;
    gap: 0.375rem;
}

.gemini-chat__history-item--current .gemini-chat__history-item-btn {
    border-color: #93c5fd;
    background: #eff6ff;
}

.gemini-chat__history-item-title {
    font-size: 0.875rem;
    font-weight: 700;
    color: #111827;
}

.gemini-chat__history-item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.gemini-chat__history-item-preview {
    font-size: 0.8125rem;
    line-height: 1.4;
    color: #374151;
}

.gemini-chat__history-item-badge {
    display: inline-flex;
    width: fit-content;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 0.6875rem;
    font-weight: 700;
}

.dark .gemini-chat__history-panel {
    background: #1f2937;
}

.dark .gemini-chat__history-header,
.dark .gemini-chat__history-tabs {
    border-color: #374151;
}

.dark .gemini-chat__history-title,
.dark .gemini-chat__history-item-title {
    color: #f3f4f6;
}

.dark .gemini-chat__history-item-btn {
    background: #111827;
    border-color: #374151;
}

.dark .gemini-chat__history-item-preview {
    color: #d1d5db;
}

/* Messages area */
.gemini-chat__messages {
    flex: 1;
    overflow-x: hidden;
    overflow-y: auto;
    scroll-behavior: smooth;
    scroll-padding-bottom: 1.5rem;
    padding: 0 1rem 1rem;
}

@media (min-width: 640px) {
    .gemini-chat__messages {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.gemini-chat__messages-inner {
    width: 100%;
    max-width: none;
    margin: 0;
    padding-bottom: 0.5rem;
    overflow: visible;
}

/* Empty state */
.gemini-chat__empty {
    display: flex;
    min-height: 50vh;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 2rem 0;
}

.gemini-chat__greeting {
    margin: 0;
    font-size: 2.25rem;
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

@media (min-width: 640px) {
    .gemini-chat__greeting {
        font-size: 3rem;
    }
}

.gemini-chat__greeting span {
    background: linear-gradient(90deg, #4285f4, #9b72cb, #d96570, #d96570);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.gemini-chat__subtitle {
    margin: 0.75rem 0 0;
    font-size: 1.125rem;
    color: #4b5563;
}

.dark .gemini-chat__subtitle {
    color: #9ca3af;
}

.gemini-chat__suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 2rem;
    width: 100%;
}

.gemini-chat__chip {
    border: 1px solid rgba(209, 213, 219, 0.8);
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.7);
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: #374151;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s, box-shadow 0.15s;
}

.gemini-chat__chip:hover {
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dark .gemini-chat__chip {
    border-color: #4b5563;
    background: #1e1f20;
    color: #e5e7eb;
}

.dark .gemini-chat__chip:hover {
    background: #282a2c;
}

/* Message list */
.gemini-chat__thread {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 1.5rem 0;
}

.gemini-chat__entry {
    width: 100%;
    overflow: visible;
    position: relative;
    z-index: 0;
}

.gemini-chat__entry:has(.gemini-chat__bubble-actions:hover),
.gemini-chat__entry:has(.gemini-chat__bubble-action:focus-visible) {
    z-index: 2;
}

.gemini-chat__entry:has(.gemini-chat__row--user) {
    display: flex;
    justify-content: flex-end;
}

.gemini-chat__row--user {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
}

.gemini-chat__user-stack {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: min(85%, 32rem);
    margin-left: auto;
    gap: 0.5rem;
    overflow: visible;
}

.gemini-chat__bubble-user {
    position: relative;
    z-index: 1;
    max-width: 100%;
    border-radius: 24px;
    background: #2563eb;
    padding: 0.75rem 1.25rem;
    font-size: 15px;
    line-height: 1.6;
    color: #ffffff;
    white-space: pre-wrap;
    word-break: break-word;
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
    overflow: visible;
}

.dark .gemini-chat__bubble-user {
    background: #1d4ed8;
    color: #f9fafb;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

.gemini-chat__bubble-assistant {
    position: relative;
    z-index: 1;
    max-width: 100%;
    border-radius: 24px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    padding: 0.4375rem 1.125rem 0.625rem;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.08);
    overflow: visible;
}

.dark .gemini-chat__bubble-assistant {
    background: #374151;
    border-color: #4b5563;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.gemini-chat__row--assistant {
    display: flex;
    gap: 1rem;
    width: 100%;
    max-width: min(85%, 32rem);
}

.gemini-chat__avatar {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    margin-top: 0.125rem;
}

.gemini-chat__avatar svg {
    width: 1.75rem;
    height: 1.75rem;
}

.gemini-chat__content {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    min-width: 0;
    padding-top: 0.125rem;
    overflow: visible;
}

.gemini-chat__text {
    font-size: 15px;
    line-height: 1.6;
    color: #1f2937;
    white-space: pre-wrap;
    word-break: break-word;
}

.dark .gemini-chat__text {
    color: #f3f4f6;
}

.gemini-chat__cursor {
    display: inline-block;
    width: 2px;
    height: 1.25rem;
    margin-left: 2px;
    vertical-align: middle;
    background: #3b82f6;
    animation: gemini-blink 1s step-end infinite;
}

@keyframes gemini-blink {
    50% { opacity: 0; }
}

.gemini-chat__bubble-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.375rem;
    flex-shrink: 0;
    width: 100%;
    padding-top: 0.125rem;
}

.gemini-chat__bubble-actions--user {
    justify-content: flex-end;
}

.gemini-chat__bubble-action {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.625rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    line-height: 1.25rem;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.gemini-chat__bubble-action:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
}

.gemini-chat__bubble-action--active {
    color: #2563eb;
    background: rgba(37, 99, 235, 0.08);
}

.gemini-chat__bubble-action svg {
    width: 0.875rem;
    height: 0.875rem;
}

.dark .gemini-chat__bubble-action {
    color: #9ca3af;
}

.dark .gemini-chat__bubble-action:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e7eb;
}

.dark .gemini-chat__bubble-action--active {
    color: #93c5fd;
    background: rgba(37, 99, 235, 0.15);
}

/* Typing indicator */
.gemini-chat__typing {
    display: flex;
    gap: 1rem;
}

.gemini-chat__typing-dots {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding-top: 0.5rem;
}

.gemini-chat__typing-dots span {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 9999px;
    background: #9ca3af;
    animation: gemini-bounce 1.2s infinite ease-in-out;
}

.gemini-chat__typing-dots span:nth-child(1) { animation-delay: -0.3s; }
.gemini-chat__typing-dots span:nth-child(2) { animation-delay: -0.15s; }

@keyframes gemini-bounce {
    0%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-4px); }
}

.gemini-chat__avatar--pulse svg {
    animation: gemini-pulse 1.5s ease-in-out infinite;
}

@keyframes gemini-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Composer */
.gemini-chat__composer-wrap {
    position: relative;
    z-index: 3;
    flex-shrink: 0;
    padding: 0.75rem 1rem 1.25rem;
    background: #f0f4f9;
    border-top: 1px solid rgba(229, 231, 235, 0.8);
}

.dark .gemini-chat__composer-wrap {
    background: #131314;
    border-top-color: rgba(75, 85, 99, 0.6);
}

.fi-chat-page .gemini-chat__composer-wrap {
    position: sticky;
    bottom: 0;
}

@media (min-width: 640px) {
    .gemini-chat__composer-wrap {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

.gemini-chat__composer {
    width: 100%;
    max-width: none;
    margin: 0;
}

.gemini-chat__input-shell {
    border-radius: 28px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(60, 64, 67, 0.3), 0 2px 6px 2px rgba(60, 64, 67, 0.15);
    transition: box-shadow 0.15s;
}

.gemini-chat__input-shell:focus-within {
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.3), 0 4px 8px 3px rgba(60, 64, 67, 0.15);
}

.dark .gemini-chat__input-shell {
    background: #1e1f20;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 2px 6px 2px rgba(0, 0, 0, 0.25);
}

.gemini-chat__input-row {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.gemini-chat__textarea {
    flex: 1;
    min-height: 1.75rem;
    max-height: 10rem;
    resize: none;
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    color: #111827;
}

.gemini-chat__textarea::placeholder {
    color: #6b7280;
}

.dark .gemini-chat__textarea {
    color: #f3f4f6;
}

.dark .gemini-chat__textarea::placeholder {
    color: #9ca3af;
}

.gemini-chat__mic-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    margin-bottom: 0.125rem;
    border: none;
    border-radius: 9999px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.gemini-chat__mic-btn:hover:not(:disabled) {
    background: #eef2f7;
    color: #374151;
}

.gemini-chat__mic-btn--active {
    background: #fee2e2;
    color: #dc2626;
}

.gemini-chat__mic-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.gemini-chat__mic-btn svg {
    width: 1.15rem;
    height: 1.15rem;
}

.gemini-chat__send-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    margin-bottom: 0.125rem;
    border: none;
    border-radius: 9999px;
    background: #dde3ea;
    color: #374151;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}

.gemini-chat__send-btn:hover:not(:disabled) {
    background: #c9d1da;
}

.gemini-chat__send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.dark .gemini-chat__send-btn {
    background: #444746;
    color: #e5e7eb;
}

.dark .gemini-chat__send-btn:hover:not(:disabled) {
    background: #5e5e5e;
}

.gemini-chat__send-btn svg {
    width: 1.25rem;
    height: 1.25rem;
}

.gemini-chat__error {
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: 0.875rem;
    color: #dc2626;
}

.gemini-chat__disclaimer {
    margin: 0.5rem 0 0;
    text-align: center;
    font-size: 0.75rem;
    color: #6b7280;
}

.gemini-chat__voice-settings {
    display: grid;
    gap: 0.5rem;
    margin-top: 0.625rem;
    padding-top: 0.625rem;
    border-top: 1px solid rgba(229, 231, 235, 0.7);
}

.gemini-chat__voice-settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.gemini-chat__voice-settings-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}

.gemini-chat__voice-gender {
    display: inline-flex;
    padding: 0.125rem;
    border-radius: 9999px;
    background: #e5e7eb;
}

.gemini-chat__voice-gender-btn {
    border: none;
    background: transparent;
    padding: 0.25rem 0.625rem;
    border-radius: 9999px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    color: #4b5563;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.gemini-chat__voice-gender-btn--active {
    background: #fff;
    color: #1d4ed8;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.gemini-chat__voice-tone {
    display: grid;
    gap: 0.375rem;
}

.gemini-chat__voice-tone-value {
    margin-left: 0.375rem;
    font-weight: 500;
    color: #9ca3af;
}

.gemini-chat__voice-tone input[type='range'] {
    width: 100%;
    accent-color: #2563eb;
}

.dark .gemini-chat__voice-settings {
    border-top-color: rgba(75, 85, 99, 0.6);
}

.dark .gemini-chat__voice-gender {
    background: #374151;
}

.dark .gemini-chat__voice-gender-btn {
    color: #d1d5db;
}

.dark .gemini-chat__voice-gender-btn--active {
    background: #1f2937;
    color: #93c5fd;
}

.dark .gemini-chat__disclaimer {
    color: #6b7280;
}

[x-cloak] {
    display: none !important;
}

.gemini-chat__send-btn .animate-spin {
    animation: gemini-spin 1s linear infinite;
}

@keyframes gemini-spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
