/* Scoped chatbot styles — all rules live under #egt-chatbot to avoid site CSS conflicts */

#egt-chatbot {
    --egt-navy: #13284B;
    --egt-orange: #E69016;
    --egt-orange-dark: #c97a10;
    --egt-bg: #f4f6f9;
    --egt-text: #1a1a2e;
    --egt-muted: #6b7280;
    --egt-radius: 16px;
    --egt-shadow: 0 8px 32px rgba(19, 40, 75, 0.18);
    font-family: "Segoe UI", Calibri, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    position: relative;
    z-index: 9990;
}

#egt-chatbot *,
#egt-chatbot *::before,
#egt-chatbot *::after {
    box-sizing: border-box;
}

/* ---- Toggle button ---- */
#egt-chatbot .egt-chatbot__toggle {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 58px;
    height: 58px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--egt-orange) 0%, var(--egt-orange-dark) 100%);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 4px 16px rgba(230, 144, 22, 0.45);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#egt-chatbot .egt-chatbot__toggle:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow: 0 6px 22px rgba(230, 144, 22, 0.55);
}

#egt-chatbot .egt-chatbot__toggle-icon {
    font-size: 24px;
    line-height: 1;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

#egt-chatbot .egt-chatbot__toggle-icon--close {
    position: absolute;
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}

#egt-chatbot.egt-chatbot--open .egt-chatbot__toggle-icon--open {
    opacity: 0;
    transform: rotate(90deg) scale(0.6);
}

#egt-chatbot.egt-chatbot--open .egt-chatbot__toggle-icon--close {
    opacity: 1;
    transform: rotate(0) scale(1);
}

/* ---- Panel ---- */
#egt-chatbot .egt-chatbot__panel {
    position: fixed;
    right: 24px;
    bottom: 96px;
    width: 380px;
    max-width: calc(100vw - 32px);
    height: 560px;
    max-height: calc(100vh - 130px);
    background: #fff;
    border-radius: var(--egt-radius);
    box-shadow: var(--egt-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    opacity: 0;
    transform: translateY(16px) scale(0.97);
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
}

#egt-chatbot.egt-chatbot--open .egt-chatbot__panel {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

#egt-chatbot .egt-chatbot__panel[hidden] {
    display: flex !important;
}

/* ---- Header ---- */
#egt-chatbot .egt-chatbot__header {
    background: linear-gradient(135deg, var(--egt-navy) 0%, #1a3560 100%);
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
}

#egt-chatbot .egt-chatbot__header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

#egt-chatbot .egt-chatbot__header-logo {
    background: #fff;
    border-radius: 10px;
    padding: 6px 12px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
}

#egt-chatbot .egt-chatbot__header-logo img {
    height: 38px;
    width: auto;
    max-width: none;
    display: block;
    object-fit: contain;
}

#egt-chatbot .egt-chatbot__title {
    margin: 0;
    padding: 0;
    font-size: 15px;
    font-weight: 700;
    color: #fff !important;
    line-height: 1.3;
}

#egt-chatbot .egt-chatbot__status {
    margin: 2px 0 0;
    padding: 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8) !important;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1.3;
}

#egt-chatbot .egt-chatbot__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    animation: egt-pulse 2s ease-in-out infinite;
}

@keyframes egt-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

#egt-chatbot .egt-chatbot__close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s ease;
}

#egt-chatbot .egt-chatbot__close:hover {
    background: rgba(255, 255, 255, 0.22);
}

/* ---- Body ---- */
#egt-chatbot .egt-chatbot__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: var(--egt-bg);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

#egt-chatbot .egt-chatbot__body::-webkit-scrollbar {
    width: 5px;
}

#egt-chatbot .egt-chatbot__body::-webkit-scrollbar-thumb {
    background: #c5cdd8;
    border-radius: 10px;
}

/* ---- Messages ---- */
#egt-chatbot .egt-chatbot__msg-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 10px;
    max-width: 100%;
}

#egt-chatbot .egt-chatbot__msg-row--user {
    justify-content: flex-end;
}

#egt-chatbot .bot-message {
    background: #fff;
    color: var(--egt-text) !important;
    padding: 10px 14px;
    border-radius: 14px;
    max-width: 82%;
    line-height: 1.45;
    font-size: 13.5px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    word-break: break-word;
}

#egt-chatbot .bot-message.bot-error {
    background: #fef2f2;
    color: #b91c1c !important;
    border: 1px solid #fecaca;
}

#egt-chatbot .user-message {
    background: var(--egt-navy);
    color: #fff !important;
    padding: 10px 14px;
    border-radius: 14px 14px 4px 14px;
    max-width: 82%;
    line-height: 1.45;
    font-size: 13.5px;
    word-break: break-word;
}

/* ---- Option buttons ---- */
#egt-chatbot .option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0 10px 38px;
    max-width: calc(100% - 38px);
}

#egt-chatbot .option-btn {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid var(--egt-orange);
    border-radius: 10px;
    background: #fff;
    color: var(--egt-text) !important;
    cursor: pointer;
    text-align: left;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.4;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#egt-chatbot .option-btn:hover,
#egt-chatbot .option-btn:focus {
    background: var(--egt-orange);
    color: #fff !important;
    border-color: var(--egt-orange);
    outline: none;
}

/* ---- Typing indicator ---- */
#egt-chatbot .egt-chatbot__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px 8px;
    background: var(--egt-bg);
    flex-shrink: 0;
}

#egt-chatbot .egt-chatbot__typing[hidden] {
    display: none !important;
}

#egt-chatbot .egt-chatbot__typing-bubble {
    background: #fff;
    padding: 10px 14px;
    border-radius: 14px;
    display: flex;
    gap: 4px;
    align-items: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

#egt-chatbot .egt-chatbot__typing-bubble span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: egt-typing 1.2s ease-in-out infinite;
}

#egt-chatbot .egt-chatbot__typing-bubble span:nth-child(2) { animation-delay: 0.15s; }
#egt-chatbot .egt-chatbot__typing-bubble span:nth-child(3) { animation-delay: 0.3s; }

@keyframes egt-typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
    30% { transform: translateY(-4px); opacity: 1; }
}

/* ---- Footer ---- */
#egt-chatbot .egt-chatbot__footer {
    background: #fff;
    border-top: 1px solid #e5e7eb;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

#egt-chatbot .egt-chatbot__footer input {
    flex: 1;
    height: 42px;
    border: 1.5px solid #d1d5db !important;
    border-radius: 21px;
    padding: 0 16px;
    outline: none;
    font-size: 13.5px;
    font-family: inherit;
    color: var(--egt-text);
    background: #fff;
    transition: border-color 0.15s ease;
}

#egt-chatbot .egt-chatbot__footer input:focus {
    border-color: var(--egt-orange) !important;
}

#egt-chatbot .egt-chatbot__footer button {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: var(--egt-orange);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    transition: background 0.15s ease, transform 0.15s ease;
}

#egt-chatbot .egt-chatbot__footer button:hover {
    background: var(--egt-orange-dark);
    transform: scale(1.05);
}

#egt-chatbot .egt-chatbot__powered {
    text-align: center;
    padding: 6px 0 8px;
    margin: 0;
    font-size: 10px;
    color: var(--egt-muted);
    background: #fff;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

#egt-chatbot .egt-chatbot__powered span {
    color: var(--egt-orange);
    font-weight: 700;
}

/* ---- Plans table ---- */
#egt-chatbot .plans-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 4px;
    font-size: 12px;
}

#egt-chatbot .plans-table th,
#egt-chatbot .plans-table td {
    border: 1px solid #e5e7eb;
    padding: 7px 10px;
    text-align: left;
}

#egt-chatbot .plans-table th {
    background: var(--egt-navy);
    color: #fff !important;
    font-weight: 600;
}

#egt-chatbot .plans-table td:last-child {
    text-align: right;
    font-weight: 600;
    color: var(--egt-orange);
}

/* ---- Mobile ---- */
@media (max-width: 575px) {
    #egt-chatbot .egt-chatbot__panel {
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
    }

    #egt-chatbot .egt-chatbot__toggle {
        right: 18px;
        bottom: 18px;
        width: 54px;
        height: 54px;
    }
}
