/* ==============================
   CHAT WIDGET — Högalidsmäklarna
   ============================== */

/* Flytande knapp */
#chat-widget-btn {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9999;
    cursor: pointer;
}

.chat-widget-circle {
    width: 58px;
    height: 58px;
    background: #e04c38;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 18px rgba(224, 76, 56, 0.55);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#chat-widget-btn:hover .chat-widget-circle {
    transform: scale(1.07);
    box-shadow: 0 6px 24px rgba(224, 76, 56, 0.65);
}

.chat-widget-bubble {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #b02d1b;
    border-radius: 50%;
    border: 2px solid white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 10px;
    font-weight: 700;
    font-family: -apple-system, sans-serif;
}

/* Panel */
#chat-widget-panel {
    position: fixed;
    bottom: 100px;
    right: 28px;
    width: 320px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
    z-index: 9998;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    display: none;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
}

#chat-widget-panel.chat-open {
    display: block;
}

/* Header */
.chat-widget-header {
    background: #09326A;
    padding: 13px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1;
}

.chat-widget-header-logo {
    color: white;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 1px;
}

.chat-widget-header-nav {
    display: flex;
    gap: 10px;
}

.chat-widget-header-nav button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.75);
    font-size: 16px;
    cursor: pointer;
    padding: 0 2px;
    line-height: 1;
}

.chat-widget-header-nav button:hover {
    color: white;
}

/* Hero-bild */
.chat-widget-hero {
    height: 90px;
    background: url('/templates/bloom/images/chat-hero.png') center 60% / cover no-repeat;
}

/* Intro-rad med foto */
.chat-widget-intro {
    padding: 14px 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
    border-bottom: 1px solid #f0f0f0;
}

.chat-widget-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    background: url('/images/cache/600_800_Goran_foto_hemsidan_nytt_red.jpg') center 10% / cover no-repeat;
    border: 2px solid #e8e8e8;
}

.chat-widget-intro-text {
    font-size: 13px;
    color: #444;
    line-height: 1.5;
}

/* Alternativknappar */
.chat-widget-options {
    padding: 12px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-opt-btn {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    width: 100%;
    transition: opacity 0.15s;
}

.chat-opt-btn:hover { opacity: 0.88; }

.chat-opt-primary {
    background: #e04c38;
    color: white;
}

.chat-opt-secondary {
    background: white;
    color: #333;
    border: 1px solid #ddd;
}

.chat-opt-blue {
    background: #00538E;
    color: white;
}

.chat-opt-outline-blue {
    background: white;
    color: #00538E;
    border: 1px solid #00538E;
}

/* Konversationsflöde */
.chat-widget-conv {
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-user-bubble {
    background: #e04c38;
    color: white;
    padding: 8px 12px;
    border-radius: 14px 14px 2px 14px;
    font-size: 13px;
    align-self: flex-end;
    max-width: 80%;
    line-height: 1.4;
}

.chat-bot-row {
    display: flex;
    gap: 9px;
    align-items: flex-start;
}

.chat-bot-avatar-sm {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    background: url('/images/cache/600_800_Goran_foto_hemsidan_nytt_red.jpg') center 10% / cover no-repeat;
    border: 1px solid #e8e8e8;
}

.chat-bot-bubble {
    background: #f4f4f4;
    color: #333;
    padding: 8px 12px;
    border-radius: 2px 14px 14px 14px;
    font-size: 13px;
    max-width: 80%;
    line-height: 1.5;
}

/* Formulär */
.chat-widget-form {
    padding: 4px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-widget-form input,
.chat-widget-form textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: #fafafa;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.chat-widget-form input:focus,
.chat-widget-form textarea:focus {
    outline: none;
    border-color: #09326A;
    background: white;
}

.chat-widget-form input.uk-form-danger,
.chat-widget-form textarea.uk-form-danger {
    border-color: #e04c38;
    background: #fff8f7;
}

.chat-widget-form textarea {
    resize: none;
    height: 72px;
}

.chat-gdpr-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 12px;
    color: #666;
}

.chat-gdpr-row input[type="checkbox"] {
    width: auto;
    margin-top: 2px;
    flex-shrink: 0;
}

.chat-gdpr-row input.uk-form-danger {
    outline: 2px solid #e04c38;
}

.chat-form-submit {
    background: #e04c38;
    color: white;
    padding: 11px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    border: none;
    width: 100%;
    transition: opacity 0.15s;
}

.chat-form-submit:hover { opacity: 0.88; }
.chat-form-submit:disabled { opacity: 0.6; cursor: default; }

.chat-form-sending {
    text-align: center;
    color: #888;
    font-size: 12px;
    padding: 4px 0;
    display: none;
}

/* Bekräftelse */
.chat-widget-confirm {
    padding: 32px 16px;
    text-align: center;
}

.chat-widget-confirm-icon {
    font-size: 40px;
    margin-bottom: 12px;
}

.chat-widget-confirm-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 6px;
}

.chat-widget-confirm-sub {
    font-size: 12px;
    color: #888;
    line-height: 1.5;
}

/* Mobilanpassning */
@media (max-width: 400px) {
    #chat-widget-panel {
        width: calc(100vw - 24px);
        right: 12px;
        bottom: 90px;
    }
    #chat-widget-btn {
        right: 16px;
        bottom: 20px;
    }
}
