/* =============================================
   Booking-Chat-Widget v1.5.0 – Frontend
   ============================================= */

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

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

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

/* ---- Toggle button ---- */
#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;
}
#bcw-toggle:hover  { box-shadow: 0 6px 20px rgba(0,0,0,.35); transform: translateY(-1px); }
#bcw-toggle:active { transform: translateY(0); }
#bcw-toggle img    { width: 26px; height: 26px; flex-shrink: 0; }
#bcw-toggle svg    { width: 26px; height: 26px; fill: currentColor; flex-shrink: 0; }
#bcw-toggle span   { white-space: nowrap; }

/* ---- Floating chat panel ---- */
#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);
}
#bcw-frame-wrapper.show { transform: scale(1); opacity: 1; }

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

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

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

/* ---- Inline / shortcode container ---- */
.bcw-inline-container {
    position: relative;
    width: 100%;
    /* height set inline via shortcode attribute, default 600px */
    min-height: 300px;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0,0,0,.15);
    background: #f2f4f8;
    display: flex;
    flex-direction: column;
    font-family: Arial, 'Helvetica Neue', sans-serif;
}

/* ---- Header (shared by widget and inline) ---- */
#bcw-header,
#bcw-inline-header {
    color: #fff;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.bcw-header-left {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.bcw-title {
    font-weight: bold;
    font-size: 15px;
    line-height: 1.3;
}

.bcw-credit {
    font-size: 10px;
    font-weight: normal;
    opacity: 0.8;
    line-height: 1.3;
}
.bcw-credit a {
    color: inherit;
    text-decoration: underline;
}
.bcw-credit a:hover {
    opacity: 0.9;
}

.bcw-header-buttons { display: flex; gap: 4px; flex-shrink: 0; }

#bcw-fullscreen,
#bcw-close,
#bcw-inline-fullscreen {
    background: none;
    border: none;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 4px;
    line-height: 1;
    transition: background .15s;
}
#bcw-fullscreen:hover,
#bcw-close:hover,
#bcw-inline-fullscreen:hover { background: rgba(255,255,255,.18); }

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

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

.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);
}
.bcw-message--user {
    align-self: flex-end;
    background: var(--bcw-color, #00b894);
    color: #fff;
    border-radius: 14px 4px 14px 14px;
}

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

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

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

/* ---- Input area (shared) ---- */
#bcw-input-area,
#bcw-inline-input-area {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #e4e7ef;
    flex-shrink: 0;
}

#bcw-input,
#bcw-inline-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;
}
#bcw-input:focus,
#bcw-inline-input:focus { border-color: var(--bcw-color, #00b894); }

#bcw-send,
#bcw-inline-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;
}
#bcw-send:hover,
#bcw-inline-send:hover  { opacity: .88; transform: scale(1.05); }
#bcw-send:active,
#bcw-inline-send:active { transform: scale(.96); }
#bcw-send svg,
#bcw-inline-send svg    { width: 16px; height: 16px; fill: currentColor; }

/* ---- Fullscreen (floating widget) ---- */
#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;
}

/* ---- Fullscreen (inline / shortcode) ---- */
.bcw-inline-container.fullscreen {
    position: fixed !important;
    inset: 0 !important;
    width:  100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 999999 !important;
}

/* ---- Mobile ---- */
@media (max-width: 480px) {
    #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;
    }
    #bcw-frame-wrapper.show { transform: scale(1) !important; }

    .bcw-inline-container {
        border-radius: 8px;
    }
}
