/* Curated Premium CSS Styling for Mahad AI Chat Widget */
.mahad-ai-widget-container {
    position: fixed;
    z-index: 999999;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.mahad-ai-position-bottom-right {
    bottom: 20px;
    right: 20px;
    align-items: flex-end;
}

.mahad-ai-position-bottom-left {
    bottom: 20px;
    left: 20px;
    align-items: flex-start;
}

/* Floating Trigger Button */
.mahad-ai-trigger-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.25s ease;
    outline: none;
}

.mahad-ai-trigger-btn:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}

.mahad-ai-trigger-icon {
    font-size: 28px;
    line-height: 1;
}

/* Chat Panel */
.mahad-ai-widget-panel {
    width: 380px;
    height: 520px;
    background: rgba(17, 24, 39, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 16px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.35);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), opacity 0.3s ease;
}

.mahad-ai-widget-panel.hidden {
    display: none;
    opacity: 0;
    transform: scale(0.9) translateY(20px);
    pointer-events: none;
}

/* Inline Widget container */
.mahad-ai-widget-inline-container {
    width: 100%;
    max-width: 600px;
    margin: 1.5rem 0;
}

.mahad-ai-widget-inline-container .mahad-ai-widget-panel {
    width: 100% !important;
    height: 500px !important;
    box-shadow: 0 4px 16px rgba(0,0,0,0.1);
}

/* Header */
.mahad-ai-chat-header {
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    color: white;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    position: relative;
    z-index: 10;
}

.mahad-ai-chat-avatar {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,0.18);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.1);
}

.mahad-ai-chat-title-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.mahad-ai-chat-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.2;
}

.mahad-ai-chat-role {
    font-size: 0.78rem;
    opacity: 0.85;
    margin-top: 2px;
}

.mahad-ai-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.mahad-ai-widget-lang-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.2);
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    width: auto !important;
    height: auto !important;
}

.mahad-ai-widget-lang-select option {
    background: #1f2937;
    color: white;
}

.mahad-ai-close-panel-btn {
    background: transparent;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    padding: 0 4px;
}

.mahad-ai-close-panel-btn:hover {
    opacity: 1;
}

/* Chat Body */
.mahad-ai-chat-body {
    flex: 1;
    background: #0f172a;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mahad-ai-messages-wrapper {
    flex: 1;
    padding: 1.2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.1) transparent;
}

.mahad-ai-messages-wrapper::-webkit-scrollbar {
    width: 6px;
}
.mahad-ai-messages-wrapper::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.1);
    border-radius: 3px;
}

/* Message Styles */
.mahad-ai-msg {
    max-width: 85%;
    padding: 0.7rem 0.9rem;
    border-radius: 12px;
    font-size: 0.88rem;
    line-height: 1.45;
}

.mahad-ai-msg-assistant {
    background: rgba(255,255,255,0.06);
    color: #f3f4f6;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    border: 1px solid rgba(255,255,255,0.05);
}

.mahad-ai-msg-user {
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.mahad-ai-msg-loading {
    background: rgba(255,255,255,0.03);
    color: #9ca3af;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    font-style: italic;
    animation: pulse 1.5s infinite ease-in-out;
}

@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

/* Input Area */
.mahad-ai-chat-input-wrapper {
    border-top: 1px solid rgba(255,255,255,0.08);
    padding: 0.8rem 1rem;
    display: flex;
    gap: 0.6rem;
    background: rgba(17, 24, 39, 0.9);
}

.mahad-ai-chat-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: white !important;
    padding: 0.6rem 0.9rem !important;
    font-size: 0.88rem !important;
    outline: none !important;
    box-shadow: none !important;
    height: auto !important;
    min-height: auto !important;
}

.mahad-ai-chat-input:focus {
    border-color: rgba(255,255,255,0.2) !important;
}

.mahad-ai-chat-send-btn {
    border: none;
    color: white;
    padding: 0.5rem 1.2rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.88rem;
    transition: all 0.2s ease;
}

.mahad-ai-chat-send-btn:hover {
    filter: brightness(1.1);
}

/* Disclosure */
.mahad-ai-chat-disclosure {
    font-size: 0.68rem;
    color: #9ca3af;
    text-align: center;
    padding: 0.5rem 1rem;
    background: rgba(10, 15, 30, 0.95);
    border-top: 1px solid rgba(255,255,255,0.04);
}

/* RTL Layout support for Arabic */
.mahad-ai-rtl {
    direction: rtl !important;
    text-align: right !important;
}

.mahad-ai-rtl .mahad-ai-chat-avatar {
    margin-left: 0.8rem;
    margin-right: 0;
}

.mahad-ai-rtl .mahad-ai-msg-assistant {
    align-self: flex-start;
    border-bottom-left-radius: 12px;
    border-bottom-right-radius: 2px;
}

.mahad-ai-rtl .mahad-ai-msg-user {
    align-self: flex-end;
    border-bottom-right-radius: 12px;
    border-bottom-left-radius: 2px;
}
