/* =============================================
   PRESENTS Salon — AI Booking Chatbot Widget
   ============================================= */

/* Widget container */
.chatbot-widget {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 360px;
    /* Never taller than the space between its bottom anchor and the top of the viewport */
    max-height: min(580px, calc(100vh - 120px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18), 0 4px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    z-index: 1100;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
    overflow: hidden;
    font-family: 'Montserrat', sans-serif;
}

.chatbot-widget.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #25D366, #128C7E);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.chatbot-header-avatar {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.chatbot-header-info {
    flex: 1;
}

.chatbot-header-name {
    font-family: 'Oswald', sans-serif;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: 1px;
}

.chatbot-header-status {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.85);
    margin-top: 2px;
}

.chatbot-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.chatbot-close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: #f0f0f0;
    /* WhatsApp-style chat background */
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23c8e6c9' fill-opacity='0.4'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    min-height: 180px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 4px;
}

/* Chat bubbles */
.chatbot-msg {
    max-width: 82%;
    padding: 10px 13px;
    border-radius: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: bubbleIn 0.25s ease;
}

@keyframes bubbleIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-msg {
    background: #fff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.user-msg {
    background: #dcf8c6;
    color: #333;
    align-self: flex-end;
    border-bottom-right-radius: 3px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* Options */
.chatbot-options {
    padding: 8px 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
    /* No independent scroll — messages area absorbs height */
}

.chatbot-option-btn {
    background: #fff;
    border: 1.5px solid #e8126a;
    color: #e8126a;
    border-radius: 20px;
    padding: 8px 16px;
    min-height: 40px;
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.chatbot-option-btn:hover,
.chatbot-option-btn:active {
    background: #e8126a;
    color: #fff;
    transform: translateY(-1px);
}

.opt-price {
    font-size: 10px;
    opacity: 0.7;
    font-weight: 400;
    margin-left: 4px;
}

/* Time slot grid */
.chatbot-option-btn.time-slot {
    padding: 6px 12px;
    font-size: 11px;
}

/* Text input */
.chatbot-text-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

.chatbot-text-input-area input {
    flex: 1;
    border: 1.5px solid #e0e0e0;
    border-radius: 24px;
    padding: 9px 14px;
    font-size: 16px;
    /* must be 16px — iOS Safari zooms page if < 16px */
    font-family: 'Montserrat', sans-serif;
    outline: none;
    color: #333;
    background: #f9f9f9;
    transition: border-color 0.2s;
}

.chatbot-text-input-area input:focus {
    border-color: #25D366;
    background: #fff;
}

.chatbot-text-input-area button {
    width: 38px;
    height: 38px;
    background: #25D366;
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s;
}

.chatbot-text-input-area button:hover {
    background: #128C7E;
}

/* Date input */
.chatbot-date-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

/* Custom visible wrapper — always renders correctly on all browsers */
.date-picker-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    padding: 10px 12px;
    background: #f9f9f9;
    cursor: pointer;
    min-height: 44px;
    overflow: hidden;
    transition: border-color 0.2s, background 0.2s;
}

.date-picker-wrapper:focus-within {
    border-color: #25D366;
    background: #fff;
}

.date-picker-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
    pointer-events: none;
}

.date-picker-label {
    font-size: 14px;
    font-family: 'Montserrat', sans-serif;
    color: #aaa;
    flex: 1;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.date-picker-label.has-value {
    color: #333;
    font-weight: 600;
}

/* Native input: invisible but stretched over the whole wrapper so tapping anywhere opens the picker */
.date-picker-wrapper input[type="date"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    background: transparent;
    font-size: 16px;
    /* prevents iOS Safari auto-zoom */
    -webkit-appearance: none;
    appearance: none;
}

.chatbot-date-input-area button {
    background: #25D366;
    border: none;
    border-radius: 10px;
    color: #fff;
    padding: 9px 14px;
    font-size: 12px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
    white-space: nowrap;
    transition: background 0.2s;
}

.chatbot-date-input-area button:hover {
    background: #128C7E;
}

/* Summary card */
.chatbot-summary {
    background: #f8f8f8;
    border-radius: 10px;
    padding: 10px;
    margin-top: 4px;
    font-size: 12.5px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 5px 0;
    border-bottom: 1px solid #eee;
    gap: 8px;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row span {
    color: #666;
    flex-shrink: 0;
}

.summary-row strong {
    color: #333;
    text-align: right;
    font-size: 12px;
}

/* ---- Backdrop overlay ---- */
.chatbot-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.50);
    z-index: 1090;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

.chatbot-backdrop.active {
    display: block;
}

/* Hide the whole float wrapper while chatbot is open */
body.chatbot-open .float-wa-wrapper {
    display: none !important;
}

/* ---- Mobile bottom-sheet (covers iPhone SE 375px and all smaller) ---- */
@media (max-width: 480px) {
    .chatbot-widget {
        /* Bottom-sheet: full-width, anchored to bottom */
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        border-radius: 20px 20px 0 0;
        /* Use dvh for correct height accounting for browser chrome */
        max-height: 88dvh;
        max-height: 88vh;
        /* fallback */
        max-height: 88dvh;
        /* Slide in from bottom instead of scale */
        transform: translateY(100%);
        transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.2s ease;
        opacity: 1;
        /* Keep messages scrollable, options wrap freely */
    }

    .chatbot-widget.active {
        transform: translateY(0);
        opacity: 1;
    }

    /* Pill handle at top of sheet */
    .chatbot-widget::before {
        content: '';
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(0, 0, 0, 0.2);
        border-radius: 2px;
        margin: 8px auto 0;
        flex-shrink: 0;
    }

    /* Slightly larger option buttons on touch */
    .chatbot-option-btn {
        font-size: 13px;
        padding: 9px 16px;
    }

    .chatbot-option-btn.time-slot {
        font-size: 12px;
        padding: 8px 13px;
    }
}