/* /public/css/unibot.css */
/* UniBot - Centered Modal Chat Widget */

/* ========================
   Toggle Button (floating)
   ======================== */
#unibot-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #0D6EFD;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(13, 110, 253, 0.4);
    z-index: 9998 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#unibot-toggle:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(13, 110, 253, 0.5);
}

#unibot-toggle .unibot-chat-icon {
    display: block;
}

#unibot-toggle .unibot-close-icon {
    display: none;
}

#unibot-toggle.open .unibot-chat-icon {
    display: none;
}

#unibot-toggle.open .unibot-close-icon {
    display: block;
}

#unibot-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 18px;
    height: 18px;
    background: #dc3545;
    border-radius: 50%;
    border: 2px solid #fff;
    display: none;
}

/* ========================
   Modal Overlay
   ======================== */
#unibot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999 !important;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

#unibot-overlay.open {
    display: flex;
    animation: unibot-fade-overlay 0.2s ease;
}

@keyframes unibot-fade-overlay {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================
   Modal Container
   ======================== */
#unibot-modal {
    width: 100%;
    max-width: 620px;
    height: 85vh;
    max-height: 700px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    animation: unibot-modal-in 0.3s ease;
}

/* OPACITY ONLY - no transform to avoid stacking contexts */
@keyframes unibot-modal-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ========================
   Z-Index & Text Selection Fix
   Resets global * { z-index: 1 } and ensures
   no transforms create stacking contexts that
   break click-drag text selection.
   ======================== */
#unibot-overlay *,
#unibot-modal *,
.unibot-message,
.unibot-message * {
    z-index: auto !important;
    transform: none !important;
}

#unibot-overlay,
#unibot-overlay *,
#unibot-modal,
#unibot-modal * {
    -webkit-user-select: text !important;
    -moz-user-select: text !important;
    -ms-user-select: text !important;
    user-select: text !important;
}

#unibot-overlay button,
#unibot-overlay input {
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    user-select: none !important;
}

.unibot-message.bot {
    cursor: text;
}

/* ========================
   Header
   ======================== */
#unibot-header {
    background: #0D6EFD;
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

#unibot-header .unibot-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

#unibot-header .unibot-header-text h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.2;
}

#unibot-header .unibot-header-text p {
    margin: 0;
    font-size: 12px;
    opacity: 0.85;
    line-height: 1.3;
}

#unibot-back,
#unibot-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

#unibot-back:hover,
#unibot-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* ========================
   HOME VIEW: FAQ Categories
   ======================== */
#unibot-home {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

#unibot-home::-webkit-scrollbar {
    width: 5px;
}

#unibot-home::-webkit-scrollbar-track {
    background: transparent;
}

#unibot-home::-webkit-scrollbar-thumb {
    background: #d0d0d0;
    border-radius: 10px;
}

.unibot-home-greeting {
    text-align: center;
    margin-bottom: 24px;
}

.unibot-home-greeting h3 {
    margin: 0 0 6px 0;
    font-size: 22px;
    font-weight: 600;
    color: #1a1a1a;
}

.unibot-home-greeting p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

/* Category Groups */
.unibot-category {
    margin-bottom: 20px;
}

.unibot-category-label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    padding-left: 2px;
}

.unibot-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.unibot-pill {
    background: #f0f6ff;
    color: #0D6EFD;
    border: 1px solid #bdd4fc;
    border-radius: 24px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.3;
}

.unibot-pill:hover {
    background: #0D6EFD;
    color: #fff;
    border-color: #0D6EFD;
}

/* ========================
   CHAT VIEW
   ======================== */
#unibot-chat {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

#unibot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

#unibot-messages::-webkit-scrollbar {
    width: 5px;
}

#unibot-messages::-webkit-scrollbar-track {
    background: transparent;
}

#unibot-messages::-webkit-scrollbar-thumb {
    background: #c4c4c4;
    border-radius: 10px;
}

/* Message Bubbles - OPACITY-ONLY animation (no transform) */
.unibot-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 15px;
    line-height: 1.5;
    word-wrap: break-word;
    animation: unibot-fade-in 0.2s ease;
}

@keyframes unibot-fade-in {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

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

.unibot-message.user {
    background: #0D6EFD;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.unibot-message.bot a {
    color: #0D6EFD !important;
    text-decoration: underline !important;
    cursor: pointer !important;
}

.unibot-message.bot ol,
.unibot-message.bot ul {
    margin: 8px 0 4px 0;
    padding-left: 22px;
}

.unibot-message.bot li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Typing Indicator - opacity-based bounce */
.unibot-typing {
    display: flex;
    gap: 5px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    align-self: flex-start;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.unibot-typing span {
    width: 8px;
    height: 8px;
    background: #b0b0b0;
    border-radius: 50%;
    animation: unibot-bounce 1.2s infinite;
}

.unibot-typing span:nth-child(2) {
    animation-delay: 0.2s;
}

.unibot-typing span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes unibot-bounce {

    0%,
    60%,
    100% {
        opacity: 0.4;
    }

    30% {
        opacity: 1;
    }
}

/* ========================
   Feedback
   ======================== */
.unibot-feedback-wrap {
    align-self: flex-start;
    max-width: 80%;
    animation: unibot-fade-in 0.2s ease;
}

.unibot-feedback {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0 2px 0;
}

.unibot-feedback-label {
    font-size: 13px;
    color: #888;
}

.unibot-thumb {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #dee2e6;
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.15s;
}

.unibot-thumb:hover {
    background: #f0f6ff;
    border-color: #0D6EFD;
}

.unibot-thumb.selected[data-vote="up"] {
    background: #d4edda;
    border-color: #28a745;
}

.unibot-thumb.selected[data-vote="down"] {
    background: #f8d7da;
    border-color: #dc3545;
}

.unibot-thumb.voted:not(.selected) {
    opacity: 0.3;
}

.unibot-thumb:disabled {
    cursor: default;
}

/* Follow-up */
.unibot-followup {
    padding: 0;
    margin-top: -2px;
}

.unibot-another-btn {
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    color: #0D6EFD;
    font-size: 14px;
    cursor: pointer;
    padding: 2px 0 !important;
    margin: 0;
    font-family: inherit;
    text-decoration: underline;
    transition: color 0.15s;
    display: block;
}

.unibot-another-btn:hover {
    color: #0b5ed7;
}

/* Browse Topics button in chat */
.unibot-browse-btn {
    background: #f0f6ff;
    color: #0D6EFD;
    border: 1px solid #bdd4fc;
    border-radius: 24px;
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.unibot-browse-btn:hover {
    background: #0D6EFD;
    color: #fff;
}

/* ========================
   Override Global Button Styles
   (global: button { border-radius: 40px !important; padding-left: 20px !important; ... })
   ======================== */
#unibot-overlay button,
#unibot-toggle {
    border-radius: 50% !important;
}

#unibot-overlay .unibot-pill {
    border-radius: 24px !important;
}

#unibot-overlay .unibot-another-btn,
#unibot-overlay .unibot-browse-btn {
    padding-left: 0 !important;
    padding-right: 0 !important;
}

#unibot-overlay .cta-button {
    border-radius: 24px !important;
}

#unibot-overlay #unibot-send {
    border-radius: 50% !important;
}

#unibot-overlay #unibot-back,
#unibot-overlay #unibot-close {
    border-radius: 6px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
}

/* ========================
   Input Area
   ======================== */
#unibot-input-area {
    padding: 14px 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    align-items: center;
    background: #fff;
    flex-shrink: 0;
}

#unibot-input {
    flex: 1;
    border: 1px solid #dee2e6;
    border-radius: 24px !important;
    padding: 12px 18px !important;
    font-size: 15px;
    outline: none;
    font-family: inherit;
    resize: none;
    max-height: 80px;
    line-height: 1.4;
}

#unibot-input:focus {
    border-color: #0D6EFD;
    box-shadow: 0 0 0 2px rgba(13, 110, 253, 0.15);
}

#unibot-input::placeholder {
    color: #adb5bd;
}

#unibot-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0D6EFD;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

#unibot-send:hover {
    background: #0b5ed7;
}

#unibot-send:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* ========================
   Footer
   ======================== */
#unibot-footer {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: #adb5bd;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

/* ========================
   Mobile Responsive
   ======================== */
@media (max-width: 640px) {
    #unibot-overlay {
        padding: 0;
    }

    #unibot-modal {
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        border-radius: 0;
    }

    #unibot-toggle {
        bottom: 16px;
        right: 16px;
    }

    .unibot-pill {
        font-size: 13px;
        padding: 8px 14px;
    }
}

/* ========================
   Contact Page CTA Banner
   ======================== */
.unibot-cta-banner {
    background: linear-gradient(135deg, #0D6EFD 0%, #0b5ed7 100%);
    color: #fff;
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.unibot-cta-banner .cta-icon {
    width: 52px;
    height: 52px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.unibot-cta-banner .cta-text h4 {
    margin: 0 0 4px 0;
    font-size: 18px;
    font-weight: 600;
}

.unibot-cta-banner .cta-text p {
    margin: 0;
    font-size: 14px;
    opacity: 0.9;
}

.unibot-cta-banner .cta-button {
    margin-left: auto;
    background: #fff;
    color: #0D6EFD;
    border: none;
    border-radius: 24px !important;
    padding: 10px 24px !important;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.unibot-cta-banner .cta-button:hover {
    transform: scale(1.04);
}

@media (max-width: 576px) {
    .unibot-cta-banner {
        flex-direction: column;
        text-align: center;
    }

    .unibot-cta-banner .cta-button {
        margin-left: 0;
        width: 100%;
    }
}

/* ========================
   Homepage Tout
   ======================== */
.unibot-homepage-tout {
    background: #f0f6ff;
    border: 1px solid #bdd4fc;
    border-radius: 12px;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.unibot-homepage-tout:hover {
    background: #e0ecff;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.12);
}

.unibot-homepage-tout .tout-icon {
    width: 44px;
    height: 44px;
    background: #0D6EFD;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.unibot-homepage-tout .tout-text h5 {
    margin: 0 0 2px 0;
    font-size: 15px;
    font-weight: 600;
    color: #0D6EFD;
}

.unibot-homepage-tout .tout-text p {
    margin: 0;
    font-size: 13px;
    color: #656565;
}