#ogc-chat-widget {
    position: fixed;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.4;
    box-sizing: border-box;
}
#ogc-chat-widget *,
#ogc-chat-widget *::before,
#ogc-chat-widget *::after {
    box-sizing: border-box;
}
#ogc-chat-widget.ogc-position-right { right: 20px; }
#ogc-chat-widget.ogc-position-left  { left: 20px; }

#ogc-chat-toggle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--ogc-color, #2563eb);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    transition: transform 0.15s ease;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 2;
}
#ogc-chat-toggle:hover { transform: scale(1.06); }
#ogc-chat-toggle svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

#ogc-chat-window {
    position: absolute;
    bottom: 70px;
    width: 340px;
    max-width: calc(100vw - 40px);
    height: 460px;
    max-height: min(70vh, calc(100vh - 100px));
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 35px rgba(0,0,0,0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1;
}
.ogc-position-right #ogc-chat-window { right: 0; }
.ogc-position-left  #ogc-chat-window { left: 0; }

#ogc-chat-header {
    background: var(--ogc-color, #2563eb);
    color: #fff;
    padding: 12px 16px;
    font-weight: 600;
    font-size: 15px;
    flex-shrink: 0;
    line-height: 1.3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}
#ogc-chat-header span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
#ogc-chat-clear {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    flex-shrink: 0;
}
#ogc-chat-clear:hover {
    opacity: 1;
    background: rgba(255,255,255,0.15);
}

#ogc-chat-messages {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 12px 14px;
    background: #f7f8fa;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ogc-msg {
    max-width: 82%;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    word-wrap: break-word;
}
.ogc-msg-user {
    align-self: flex-end;
    background: var(--ogc-color, #2563eb);
    color: #fff;
    border-bottom-right-radius: 4px;
    white-space: pre-wrap;
}
.ogc-msg-bot {
    align-self: flex-start;
    background: #fff;
    color: #222;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}
.ogc-msg-bot a {
    color: var(--ogc-color, #2563eb);
    text-decoration: underline;
}
.ogc-msg-bot strong { font-weight: 600; }
.ogc-msg-bot em { font-style: italic; }

.ogc-msg-typing {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 10px 14px;
    border-radius: 14px;
    border-bottom-left-radius: 4px;
}
.ogc-typing-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 3px;
    border-radius: 50%;
    background: #9ca3af;
    animation: ogc-blink 1.2s infinite ease-in-out;
}
.ogc-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.ogc-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes ogc-blink {
    0%, 80%, 100% { opacity: 0.3; }
    40% { opacity: 1; }
}

#ogc-chat-input-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

#ogc-chat-input {
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    height: 40px !important;
    min-height: 40px !important;
    max-height: 80px !important;
    resize: none;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: 13.5px;
    line-height: 1.35;
    font-family: inherit;
    outline: none;
    background: #fff;
    color: #222;
    margin: 0;
    box-shadow: none;
    overflow-y: auto;
}
#ogc-chat-input:focus {
    border-color: var(--ogc-color, #2563eb);
}

#ogc-chat-send {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border-radius: 50%;
    background: var(--ogc-color, #2563eb) !important;
    color: #fff !important;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
    line-height: 0;
}
#ogc-chat-send svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: #fff !important;
    color: #fff !important;
    pointer-events: none;
    flex-shrink: 0;
}
#ogc-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#ogc-chat-send:hover:not(:disabled) {
    filter: brightness(1.08);
}

@media (max-width: 480px) {
    #ogc-chat-window {
        width: calc(100vw - 24px);
        height: min(75vh, calc(100vh - 90px));
        bottom: 66px;
    }
    #ogc-chat-widget.ogc-position-right { right: 12px; }
    #ogc-chat-widget.ogc-position-left  { left: 12px; }
}
