/* =============================================
   GOHO Booking-Chat-Widget v1.1.0 – Frontend
   ============================================= */

/* ---- Widget container ---- */
#goho-bcw-widget {
    position: fixed;
    z-index: 99999;
    font-family: Arial, 'Helvetica Neue', sans-serif;
}

/* Bottom positions */
.goho-bcw-position-right { right: 20px; bottom: 20px; }
.goho-bcw-position-left  { left:  20px; bottom: 20px; }

/* Middle positions (vertically centred) */
.goho-bcw-position-right-middle { right: 20px; top: 50%; transform: translateY(-50%); }
.goho-bcw-position-left-middle  { left:  20px; top: 50%; transform: translateY(-50%); }

/* ---- Toggle button ---- */
#goho-bcw-toggle {
    min-width: 60px;
    min-height: 60px;
    border-radius: 50px;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
    padding: 0 16px;
    transition: box-shadow .2s ease, transform .15s ease;
}
#goho-bcw-toggle:hover  { box-shadow: 0 6px 20px rgba(0,0,0,.35); transform: translateY(-1px); }
#goho-bcw-toggle:active { transform: translateY(0); }
#goho-bcw-toggle img    { width: 26px; height: 26px; flex-shrink: 0; }
#goho-bcw-toggle svg    { width: 26px; height: 26px; fill: currentColor; flex-shrink: 0; }
#goho-bcw-toggle span   { white-space: nowrap; }

/* ---- Chat panel ---- */
#goho-bcw-frame-wrapper {
    position: fixed;
    width: 400px;
    height: 600px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 40px rgba(0,0,0,.2);
    background: #f2f4f8;
    display: none;
    flex-direction: column;
    opacity: 0;
    transform: scale(.88);
    transition: transform .3s cubic-bezier(.4,0,.2,1),
                opacity  .3s cubic-bezier(.4,0,.2,1);
}
#goho-bcw-frame-wrapper.show { transform: scale(1); opacity: 1; }

/* Panel positions – bottom */
.goho-bcw-position-right #goho-bcw-frame-wrapper { right: 20px; bottom: 90px; transform-origin: bottom right; }
.goho-bcw-position-left  #goho-bcw-frame-wrapper { left:  20px; bottom: 90px; transform-origin: bottom left;  }

/* Panel positions – middle (opens to the side) */
.goho-bcw-position-right-middle #goho-bcw-frame-wrapper {
    right: 90px;
    top: 50%;
    transform: translateY(-50%) scale(.88);
    transform-origin: right center;
}
.goho-bcw-position-right-middle #goho-bcw-frame-wrapper.show { transform: translateY(-50%) scale(1); }

.goho-bcw-position-left-middle #goho-bcw-frame-wrapper {
    left: 90px;
    top: 50%;
    transform: translateY(-50%) scale(.88);
    transform-origin: left center;
}
.goho-bcw-position-left-middle #goho-bcw-frame-wrapper.show  { transform: translateY(-50%) scale(1); }

/* ---- Header ---- */
#goho-bcw-header {
    color: #fff;
    padding: 12px 16px;
    font-weight: bold;
    font-size: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}
.goho-bcw-header-buttons { display: flex; gap: 4px; }
#goho-bcw-fullscreen,
#goho-bcw-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s;
}
#goho-bcw-fullscreen:hover,
#goho-bcw-close:hover { background: rgba(255,255,255,.18); }

/* ---- Message list ---- */
#goho-bcw-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scroll-behavior: smooth;
}

/* ---- Messages ---- */
.goho-bcw-message {
    max-width: 85%;
    padding: 10px 14px;
    font-size: .9rem;
    line-height: 1.55;
    word-wrap: break-word;
    overflow-wrap: break-word;
}
.goho-bcw-message a {
    color: inherit;
    text-decoration: underline;
}

.goho-bcw-message--bot {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #e4e7ef;
    border-radius: 4px 14px 14px 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.goho-bcw-message--user {
    align-self: flex-end;
    background: var(--goho-color, #00b894);
    color: #fff;
    border-radius: 14px 4px 14px 14px;
}

/* ---- Embedded content (URLs with ?embed=1) ---- */
.goho-bcw-embed {
    width: 100%;
    margin-top: 10px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #dde1ea;
    background: #fff;
}
.goho-bcw-embed iframe {
    display: block;
    width: 100%;
    height: 340px;
    border: none;
}

/* ---- Typing indicator ---- */
.goho-bcw-typing {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 12px 14px;
}
.goho-bcw-typing span {
    display: block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #adb5bd;
    animation: goho-bcw-bounce 1.3s infinite ease-in-out;
}
.goho-bcw-typing span:nth-child(2) { animation-delay: .18s; }
.goho-bcw-typing span:nth-child(3) { animation-delay: .36s; }

@keyframes goho-bcw-bounce {
    0%, 80%, 100% { transform: scale(.55); opacity: .5; }
    40%           { transform: scale(1);   opacity: 1;  }
}

/* ---- Input area ---- */
#goho-bcw-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e4e7ef;
    flex-shrink: 0;
}
#goho-bcw-input {
    flex: 1;
    border: 1px solid #d0d5dd;
    border-radius: 20px;
    padding: 9px 14px;
    font-size: .9rem;
    font-family: inherit;
    line-height: 1.45;
    outline: none;
    resize: none;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color .15s;
}
#goho-bcw-input:focus { border-color: var(--goho-color, #00b894); }

#goho-bcw-send {
    flex-shrink: 0;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity .15s, transform .15s;
}
#goho-bcw-send:hover  { opacity: .88; transform: scale(1.05); }
#goho-bcw-send:active { transform: scale(.96); }
#goho-bcw-send svg    { width: 16px; height: 16px; fill: currentColor; }

/* ---- Fullscreen ---- */
#goho-bcw-frame-wrapper.fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width:  100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
    transform: scale(1) !important;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    #goho-bcw-frame-wrapper {
        width:  calc(100vw - 20px) !important;
        height: 72vh !important;
        left:   10px !important;
        right:  10px !important;
        bottom: 10px !important;
        top:    auto !important;
        transform: scale(.88) !important;
        transform-origin: bottom center !important;
    }
    #goho-bcw-frame-wrapper.show { transform: scale(1) !important; }
}
