/* ============================================================
   SE TICKETS — AI Chat Widget Stylesheet
   ============================================================ */

:root {
    --se-chat-color: #2E486B;
}

/* ---------- Chat Bubble ---------- */
#se-chat-bubble {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--se-chat-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 99998;
    border: none;
}

#se-chat-bubble:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,0,0,0.25);
}

#se-chat-bubble.se-chat-bubble-hidden {
    transform: scale(0);
    opacity: 0;
    pointer-events: none;
}

/* ---------- Chat Panel ---------- */
#se-chat-panel {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 400px;
    height: 560px;
    max-height: calc(100vh - 48px);
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(16px) scale(0.95);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

#se-chat-panel.se-chat-panel-open {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* ---------- Chat Header ---------- */
#se-chat-header {
    background: var(--se-chat-color);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.se-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.se-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.se-chat-header-title {
    font-size: 15px;
    font-weight: 600;
}

.se-chat-header-status {
    font-size: 12px;
    opacity: 0.85;
    display: flex;
    align-items: center;
    gap: 6px;
}

.se-chat-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    display: inline-block;
}

#se-chat-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: background 0.2s;
}

#se-chat-close:hover {
    background: rgba(255,255,255,0.25);
}

/* ---------- Messages Area ---------- */
#se-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f9fafb;
}

.se-chat-msg {
    display: flex;
    gap: 8px;
    max-width: 88%;
    animation: se-msg-in 0.25s ease-out;
}

.se-chat-msg-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.se-chat-msg-assistant {
    align-self: flex-start;
}

.se-chat-msg-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--se-chat-color);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    margin-top: 2px;
}

.se-chat-msg-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 14px;
    line-height: 1.55;
    word-wrap: break-word;
}

.se-chat-msg-user .se-chat-msg-content {
    background: var(--se-chat-color);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.se-chat-msg-assistant .se-chat-msg-content {
    background: #ffffff;
    color: #1a1d26;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.se-chat-msg-content code {
    background: rgba(0,0,0,0.06);
    padding: 2px 5px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
}

.se-chat-msg-user .se-chat-msg-content code {
    background: rgba(255,255,255,0.15);
}

@keyframes se-msg-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------- Typing Indicator ---------- */
.se-chat-typing-dots {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.se-chat-typing-dots span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ca3af;
    animation: se-typing 1.2s infinite;
}

.se-chat-typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.se-chat-typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes se-typing {
    0%, 60%, 100% { opacity: 0.3; transform: scale(0.85); }
    30% { opacity: 1; transform: scale(1); }
}

/* ---------- Escalation Bar ---------- */
#se-chat-escalation {
    padding: 12px 16px;
    background: #fffbeb;
    border-top: 1px solid #fde68a;
    flex-shrink: 0;
}

.se-chat-escalation-inner {
    text-align: center;
}

.se-chat-escalation-inner p {
    font-size: 13px;
    color: #92400e;
    margin: 0 0 10px;
    line-height: 1.4;
}

.se-chat-escalation-inner p i {
    margin-right: 4px;
}

.se-chat-btn-ticket {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--se-chat-color);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.se-chat-btn-ticket:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 12px rgba(0,0,0,0.15);
}

/* ---------- Input Area ---------- */
#se-chat-input-area {
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    background: #fff;
    flex-shrink: 0;
}

.se-chat-input-wrap {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px 4px 4px 14px;
}

#se-chat-input {
    flex: 1;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    padding: 8px 0;
    resize: none;
    outline: none;
    max-height: 100px;
    min-height: 20px;
}

#se-chat-input::placeholder {
    color: #9ca3af;
}

#se-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: var(--se-chat-color);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    transition: all 0.2s;
}

#se-chat-send:hover {
    transform: scale(1.05);
}

.se-chat-footer {
    display: flex;
    justify-content: center;
    padding-top: 8px;
}

.se-chat-footer-link {
    background: none;
    border: none;
    color: #6b7280;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.se-chat-footer-link:hover {
    color: var(--se-chat-color);
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    #se-chat-panel {
        width: calc(100vw - 16px);
        height: calc(100vh - 16px);
        bottom: 8px;
        right: 8px;
        border-radius: 12px;
    }

    #se-chat-bubble {
        bottom: 16px;
        right: 16px;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }
}

/* ---------- Left position variant ---------- */
.se-chat-left #se-chat-bubble,
.se-chat-left #se-chat-panel {
    right: auto;
    left: 24px;
}

@media (max-width: 480px) {
    .se-chat-left #se-chat-panel {
        left: 8px;
    }
    .se-chat-left #se-chat-bubble {
        left: 16px;
    }
}

