/* LexBot - AI Assistant Styling */

#lexai-screen {
    background: #ffffff;
    color: #1e293b;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0 !important;
    /* Force zero padding to override content-screen */
}

/* Header fixes for white background */
#lexai-screen .screen-header {
    background: #ffffff;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 20px;
    /* Move back button away from edge */
}

/* Match the global back btn style (dark circle with white arrow) */
#lexai-screen .back-btn {
    background: #1e293b;
    /* Dark circle */
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

#lexai-screen .back-btn:hover {
    background: #334155;
    transform: scale(1.05);
}

#lexai-screen .back-btn:active {
    transform: scale(0.95) !important;
}

#lexai-screen .back-icon {
    width: 24px;
    height: 24px;
    fill: #ffffff;
    /* White arrow inside the dark circle */
}

.lexai-container {
    height: calc(100% - 70px);
    display: flex;
    flex-direction: column;
    padding: 0;
    /* Zero padding to match edges */
    background: white;
    box-sizing: border-box;
    overflow: hidden;
}

/* Fix Centering of title */
.lexai-title-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    color: #1a1a1a;
    pointer-events: none;
    white-space: nowrap;
}

#lexai-status-badge {
    position: absolute;
    left: 20px;
    /* far left */
    z-index: 11;
}

/* Status Badge */
.status-badge {
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-right: 15px;
}

.status-open {
    background: rgba(34, 197, 94, 0.2);
    color: #4ade80;
    border: 1px solid #22c55e;
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.3);
}

.status-closed {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
    border: 1px solid #ef4444;
}

/* Usage Info */
.lexai-usage-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: #475569;
    /* Darker text for white bg */
    margin-bottom: 15px;
    background: #f1f5f9;
    /* Light gray background */
    padding: 10px 15px;
    border-radius: 10px;
    font-weight: bold;
    border: 1px solid #e2e8f0;
}

/* Chat Box */
.chat-box {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-bottom: 10px;
    /* Reduced margin */
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.1) transparent;
    -webkit-overflow-scrolling: touch;
    direction: rtl;
    /* Ensure chat flow is right-to-left */
}

.message {
    max-width: 92%;
    /* Expanded even more for full screen feel */
    padding: 12px 16px;
    border-radius: 15px;
    line-height: 1.5;
    font-size: 0.95rem;
    position: relative;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-msg-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    /* Increased gap */
    margin-bottom: 10px;
    /* Increased bottom margin */
    align-self: flex-start;
    max-width: 90%;
}

.bot-avatar {
    width: 35px !important;
    height: 35px !important;
    min-width: 35px !important;
    max-width: 35px !important;
    flex-shrink: 0 !important;
    border-radius: 50% !important;
    background-color: transparent;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    -webkit-clip-path: circle(50% at 50% 50%);
    clip-path: circle(50% at 50% 50%);
}

.bot-msg {
    background: #f8fafc;
    /* Very light gray for bot message */
    border: 1px solid #e2e8f0;
    border-bottom-left-radius: 2px;
    color: #1e293b;
    /* Dark text */
    font-weight: 500;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.user-msg {
    align-self: flex-end;
    background: linear-gradient(135deg, #e3006a 0%, #aa00a8 40%, #ff4b2b 100%);
    color: white;
    /* White text for contrast against gradient */
    border-bottom-right-radius: 2px;
    box-shadow: 0 4px 15px rgba(227, 0, 106, 0.3);
    font-weight: bold;
    margin-bottom: 10px;
    /* Added spacing between messages */
    margin-left: 20px;
    /* Added left margin so it doesn't touch the left side if it wraps */
}

/* Input Area */
.chat-input-area {
    display: flex;
    gap: 10px;
    background: #f8fafc;
    padding: 12px;
    border-radius: 15px;
    border: 1px solid #cbd5e1;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    margin-bottom: 5px;
    /* Small buffer for navigation bars */
    flex-shrink: 0;
    /* Important: don't let it shrink! */
}

#lexai-input {
    flex: 1;
    background: transparent;
    border: none;
    color: #1e293b;
    font-size: 1rem;
    outline: none;
}

#lexai-input:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

#lexai-send-btn {
    background: #00d2ff;
    color: white;
    border: none;
    width: 45px;
    height: 45px;
    min-width: 45px;
    /* Ensure it stays a square */
    flex-shrink: 0;
    /* Prevent distortion on small screens */
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

#lexai-send-btn:hover:not(:disabled) {
    background: #3a7bd5;
    transform: scale(1.05);
}

#lexai-send-btn:disabled {
    background: #475569;
    cursor: not-allowed;
}

/* Typing indicator */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 5px;
}

.dot {
    width: 8px;
    height: 8px;
    background: #94a3b8;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) {
    animation-delay: -0.32s;
}

.dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1.0);
    }
}

/* RTL Adjustment */
[dir="rtl"] .bot-msg {
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 2px;
}

[dir="rtl"] .user-msg {
    border-bottom-right-radius: 15px;
    border-bottom-left-radius: 2px;
}