/* Floating Chat Widget Stylesheet */

/* Chat Toggle Button */
#chat-widget-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    background-color: #00796b;
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    border: none;
    outline: none;
    z-index: 9999;
    transition: transform 0.3s ease, background-color 0.3s ease;
}

#chat-widget-toggle:hover {
    transform: scale(1.08);
    background-color: #004d40;
}

#chat-widget-toggle i {
    font-size: 24px;
    transition: transform 0.3s ease;
}

#chat-widget-toggle.active i {
    transform: rotate(90deg);
}

/* Pulse animation to draw attention */
#chat-widget-toggle.pulse::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid #00796b;
    opacity: 0.8;
    animation: chat-pulse 2s infinite ease-out;
}

@keyframes chat-pulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    100% {
        transform: scale(1.4);
        opacity: 0;
    }
}

/* Chat Widget Container */
#chat-widget-container {
    position: fixed;
    bottom: 95px;
    right: 25px;
    width: 380px;
    height: 520px;
    max-width: calc(100vw - 50px);
    max-height: calc(100vh - 140px);
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.1, 0.8, 0.25, 1), transform 0.3s cubic-bezier(0.1, 0.8, 0.25, 1);
}

#chat-widget-container.active {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Chat Header */
.chat-widget-header {
    background-color: #00796b;
    color: #ffffff;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-widget-header .chat-info {
    display: flex;
    flex-direction: column;
}

.chat-widget-header .chat-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
}

.chat-widget-header .chat-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 2px;
}

.chat-widget-header .chat-status::before {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background-color: #2ec93f;
    border-radius: 50%;
}

.chat-widget-header .close-chat-btn {
    background: transparent;
    border: none;
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    transition: opacity 0.2s;
    outline: none;
}

.chat-widget-header .close-chat-btn:hover {
    opacity: 0.8;
}

/* Chat Body (Messages List) */
.chat-widget-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background-color: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Bubbles */
.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeInBubble 0.25s ease-out forwards;
}

@keyframes fadeInBubble {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.user {
    align-self: flex-end;
}

.chat-message.bot,
.chat-message.admin {
    align-self: flex-start;
}

.chat-message-bubble {
    padding: 10px 14px;
    font-size: 14px;
    line-height: 1.45;
    word-break: break-word;
    white-space: pre-wrap;
}

.chat-message.user .chat-message-bubble {
    background-color: #00796b;
    color: #ffffff;
    border-radius: 14px 14px 0 14px;
}

.chat-message.bot .chat-message-bubble,
.chat-message.admin .chat-message-bubble {
    background-color: #e9ecef;
    color: #212529;
    border-radius: 14px 14px 14px 0;
}

.chat-message-time {
    font-size: 10px;
    color: #868e96;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}

.chat-message.user .chat-message-time {
    align-self: flex-end;
}

.chat-message.bot .chat-message-time,
.chat-message.admin .chat-message-time {
    align-self: flex-start;
}

/* Special styling for message actions (Buttons inside messages) */
.chat-message-action-btn {
    margin-top: 10px;
    background-color: #ffffff;
    color: #00796b;
    border: 1px solid #00796b;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    transition: background-color 0.2s, color 0.2s;
    outline: none;
}

.chat-message-action-btn:hover {
    background-color: #00796b;
    color: #ffffff;
}

/* Scheduling Inline Wrapper */
.chat-scheduling-wrapper {
    background-color: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: fadeInBubble 0.3s ease-out;
}

.chat-scheduling-title {
    font-size: 13px;
    font-weight: 700;
    color: #495057;
    margin: 0;
}

.chat-scheduling-form label {
    font-size: 11px;
    font-weight: 600;
    color: #868e96;
    text-transform: uppercase;
}

.chat-scheduling-form input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 13px;
    margin-top: 4px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-scheduling-form input[type="date"]:focus {
    border-color: #00796b;
}

.chat-scheduling-slots-container {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-scheduling-slots-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    max-height: 120px;
    overflow-y: auto;
    padding: 2px;
}

.chat-slot-btn {
    background-color: rgba(0, 121, 107, 0.08);
    color: #00796b;
    border: none;
    border-radius: 6px;
    padding: 6px 0;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
    outline: none;
}

.chat-slot-btn:hover {
    background-color: #00796b;
    color: #ffffff;
}

.chat-scheduling-cancel-btn {
    background: transparent;
    border: none;
    color: #e63946;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    align-self: center;
    margin-top: 4px;
    outline: none;
}

/* Chat Footer (Input Form) */
.chat-widget-footer {
    padding: 12px 16px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-input-wrapper {
    flex: 1;
    background-color: #f1f3f5;
    border-radius: 24px;
    padding: 6px 16px;
    display: flex;
    align-items: center;
}

.chat-widget-footer input[type="text"] {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    outline: none;
    padding: 6px 0;
    color: #212529;
}

.chat-widget-footer input[type="text"]::placeholder {
    color: #adb5bd;
}

.chat-send-btn {
    background-color: #00796b;
    color: #ffffff;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    outline: none;
}

.chat-send-btn:hover {
    background-color: #004d40;
}

.chat-send-btn:active {
    transform: scale(0.95);
}

.chat-send-btn i {
    font-size: 15px;
    margin-left: 2px; /* Visual centering adjustment for send icon */
}

/* Closed State Panel */
.chat-closed-panel {
    width: 100%;
    padding: 10px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
}

.chat-closed-text {
    font-size: 13px;
    font-weight: 600;
    color: #868e96;
}

.chat-restart-btn {
    background-color: #00796b;
    color: #ffffff;
    border: none;
    border-radius: 20px;
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
    outline: none;
}

.chat-restart-btn:hover {
    background-color: #004d40;
}

/* Loading indicator inside chat */
.chat-loading-bubble {
    align-self: flex-start;
    background-color: #e9ecef;
    border-radius: 14px 14px 14px 0;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    gap: 4px;
    width: fit-content;
}

.chat-loading-dot {
    width: 6px;
    height: 6px;
    background-color: #868e96;
    border-radius: 50%;
    animation: chat-loading-bounce 1.4s infinite ease-in-out both;
}

.chat-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.chat-loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes chat-loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

/* Responsive adjustment for Mobile screens */
@media (max-width: 480px) {
    #chat-widget-container {
        bottom: 0;
        right: 0;
        width: 100vw;
        height: 100vh;
        max-width: 100vw;
        max-height: 100vh;
        border-radius: 0;
    }
    
    #chat-widget-toggle {
        bottom: 15px;
        right: 15px;
    }
}
