/* ──────────────────────────────────────────────────────────────────
   Volnyn Shared Chat Widget
   Loaded across volnyn (main), freelancer, property.
   Scoped to .vchat-* — should not collide with host page styles.
   ────────────────────────────────────────────────────────────────── */

.vchat-fab,
.vchat-panel,
.vchat-panel * {
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Floating bubble */
.vchat-fab {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border: none;
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
    cursor: pointer;
    z-index: 2147483600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.vchat-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(99, 102, 241, 0.5); }
.vchat-fab svg { width: 26px; height: 26px; }

/* Panel */
.vchat-panel {
    position: fixed;
    right: 20px;
    bottom: 88px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 120px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(0, 0, 0, 0.04);
    z-index: 2147483601;
    display: none;
    flex-direction: column;
    overflow: hidden;
}
.vchat-panel.open { display: flex; }

.vchat-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.vchat-header-title {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}
.vchat-provider {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-size: 12px;
    padding: 4px 6px;
    cursor: pointer;
}
.vchat-provider option { color: #111; }
.vchat-close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    line-height: 1;
    padding: 4px 6px;
    border-radius: 6px;
}
.vchat-close:hover { background: rgba(255,255,255,0.15); }

/* Account strip */
.vchat-account {
    padding: 10px 14px;
    border-bottom: 1px solid #eef0f4;
    background: #fafbff;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 44px;
}
.vchat-account-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}
.vchat-account-email {
    flex: 1;
    color: #4b5563;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.vchat-signout {
    background: transparent;
    color: #6366f1;
    border: 0;
    cursor: pointer;
    font-size: 12px;
}
.vchat-signin-slot {
    flex: 1;
    min-height: 32px;
}
.vchat-guest-note {
    font-size: 12px;
    color: #6b7280;
}

/* Messages */
.vchat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.vchat-msg {
    max-width: 85%;
    padding: 9px 12px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.45;
    word-wrap: break-word;
    white-space: pre-wrap;
}
.vchat-msg.user {
    align-self: flex-end;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff;
    border-bottom-right-radius: 4px;
}
.vchat-msg.assistant {
    align-self: flex-start;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.vchat-msg.system {
    align-self: center;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
}
.vchat-msg.error {
    align-self: center;
    background: #fee2e2;
    color: #991b1b;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
}
.vchat-msg .vchat-img {
    display: block;
    max-width: 100%;
    border-radius: 8px;
    margin-top: 4px;
}
.vchat-tool {
    align-self: flex-start;
    background: #ede9fe;
    color: #5b21b6;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.vchat-typing { display: inline-block; opacity: 0.6; animation: vchat-blink 1s infinite; }
@keyframes vchat-blink { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.9; } }

/* Composer */
.vchat-composer {
    border-top: 1px solid #eef0f4;
    padding: 10px;
    background: #fff;
}
.vchat-previews {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.vchat-preview {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #e5e7eb;
}
.vchat-preview img { width: 100%; height: 100%; object-fit: cover; }
.vchat-preview button {
    position: absolute;
    top: 0; right: 0;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: 0;
    width: 16px; height: 16px;
    border-radius: 50%;
    font-size: 11px;
    line-height: 1;
    cursor: pointer;
}
.vchat-input-row {
    display: flex;
    align-items: flex-end;
    gap: 6px;
}
.vchat-attach,
.vchat-send {
    background: transparent;
    border: 0;
    color: #6366f1;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
}
.vchat-attach:hover, .vchat-send:hover { background: #eef2ff; }
.vchat-attach svg, .vchat-send svg { width: 20px; height: 20px; display: block; }
.vchat-textarea {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 8px 10px;
    font-size: 14px;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 38px;
    font-family: inherit;
}
.vchat-textarea:focus { border-color: #6366f1; box-shadow: 0 0 0 3px rgba(99,102,241,0.15); }

/* Mobile */
@media (max-width: 500px) {
    .vchat-panel {
        right: 8px;
        left: 8px;
        bottom: 78px;
        width: auto;
        height: calc(100vh - 100px);
    }
}
