/* START OF MODIFIED FILE - Gemini-like Dark Theme */

/* Importing Google Fonts - Inter & Cairo */
@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700&display=swap');

:root {
  /* Dark Theme Color Palette (Inspired by Gemini) */
  --bg-dark-primary: #1e1f20; /* Body background */
  --bg-dark-secondary: #2d2e30; /* Main chat area background */
  --bg-dark-tertiary: #3a3b3c; /* Input field, bot message */
  --bg-user-message: #424f70;  /* User message background (Subtle blue/purple tint) */
  --text-primary: #e8eaed;     /* Primary light text */
  --text-secondary: #bdc1c6;   /* Secondary light text (icons, placeholders) */
  --text-accent: #8ab4f8;      /* Accent color (links, focus) */
  --border-color: #4a4b4f;     /* Subtle borders */
  --scrollbar-thumb: #5f6368;
  --scrollbar-track: var(--bg-dark-secondary);
  --hover-bg: rgba(232, 234, 237, 0.08); /* Subtle light hover */
}

*{
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Inter", "Cairo", sans-serif;
}

:lang(ar) {
  font-family: "Cairo", "Inter", sans-serif;
}

body{
    height: 100vh;
    overflow: hidden; /* Prevent body scroll */
    background-color: var(--bg-dark-primary); /* Dark body background */
    color: var(--text-primary); /* Default light text */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Chat Interface Container - Full Screen Dark Theme */
.chatbot-popup{
    width: 100%;
    height: 100vh;
    background-color: var(--bg-dark-secondary); /* Main dark background */
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Chat Header */
.chat-header{
    display: flex;
    align-items: center;
    /* Space between items if needed, but Gemini header is simple */
    /* justify-content: space-between; */
    justify-content: flex-start; /* Align items to the start */
    background-color: var(--bg-dark-secondary); /* Match container background */
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color); /* Subtle border */
    color: var(--text-primary);
    flex-shrink: 0;
    /* Center header content like chat body/footer */
    max-width: 940px; /* Max width similar to footer/body content */
    width: 100%;
    margin: 0 auto; /* Center */
}
.chat-header .header-info{
    display: flex;
    gap: 12px;
    align-items: center;
}
.header-info .chatbot-logo{
    height: 35px; /* Slightly smaller */
    width: 35px;
    object-fit: contain;
    border-radius: 50%;
    /* Remove white background, add subtle border if needed */
    /* background-color: #fff; */
    padding: 2px;
    /* border: 1px solid var(--border-color); */
}
.header-info .logo-text{
    font-size: 1.15rem; /* Adjust size as needed */
    font-weight: 600;
}
.chat-header #close-chatbot{
    display: none; /* Hide close button */
}

/* Chat Body */
.chat-body{
    padding: 25px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px; /* More gap */
    flex-grow: 1;
    overflow-y: auto;
    /* Center content area */
    max-width: 900px; /* Limit width for readability */
    width: 100%;
    margin: 0 auto; /* Center horizontally */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* ----- Suggested Prompts Styling ----- */
.suggested-prompts-container {
    display: flex;
    flex-wrap: wrap; /* Allow buttons to wrap to the next line */
    gap: 10px; /* Space between buttons */
    padding: 10px 20px; /* Padding around the container */
    padding-bottom: 5px; /* Less padding at the bottom */
    flex-shrink: 0; /* Prevent shrinking */
    overflow-x: auto; /* Allow horizontal scroll if needed on small screens */
    scrollbar-width: none; /* Hide scrollbar for FF */
    -ms-overflow-style: none; /* Hide scrollbar for IE/Edge */

    /* Centering like chat body/footer */
    max-width: 900px; /* Match max-width */
    width: 100%;
    margin: 0 auto; /* Center horizontally */
    margin-bottom: 5px; /* Space above the footer */
}
.suggested-prompts-container::-webkit-scrollbar {
    display: none; /* Hide scrollbar for Webkit */
}

.suggested-prompt-button {
    padding: 8px 16px;
    font-size: 0.88rem; /* Slightly smaller font */
    color: var(--text-secondary); /* Start with secondary text color */
    background-color: var(--bg-dark-tertiary); /* Use tertiary background */
    border: 1px solid var(--border-color); /* Subtle border */
    border-radius: 20px; /* Rounded corners */
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    white-space: nowrap; /* Prevent button text from wrapping */
    font-family: inherit; /* Use the main fonts */
    flex-shrink: 0; /* Prevent buttons from shrinking too much */
}

.suggested-prompt-button:hover {
    background-color: var(--hover-bg); /* Use standard hover effect */
    color: var(--text-primary); /* Make text primary on hover */
    border-color: var(--text-secondary); /* Slightly highlight border */
}

.suggested-prompt-button:active {
    background-color: rgba(232, 234, 237, 0.12); /* Slightly darker hover */
    transform: scale(0.98); /* Click feedback */
}

/* Responsive adjustments for prompts */
@media (max-width: 940px) {
    .suggested-prompts-container {
        max-width: 100%;
        margin: 0;
        padding-left: 15px;
        padding-right: 15px;
    }
}

@media (max-width: 600px) {
     .suggested-prompts-container {
        padding: 8px 10px;
        gap: 8px;
        margin-bottom: 3px;
     }
    .suggested-prompt-button {
        padding: 6px 12px;
        font-size: 0.8rem;
        border-radius: 16px;
    }
}
/* --- End Suggested Prompts Styling --- */

/* Existing RTL adjustments - ensure they cover new elements if needed */
:lang(ar) {
  /* Specific RTL adjustments if necessary, e.g., for text alignment */
  /* .suggested-prompt-button { text-align: right; } */ /* Usually not needed for buttons */
}

/* Scrollbar styling for Webkit browsers */
.chat-body::-webkit-scrollbar {
    width: 8px;
}
.chat-body::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
    border-radius: 4px;
}
.chat-body::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 4px;
    border: 2px solid var(--scrollbar-track);
}
.chat-body::-webkit-scrollbar-thumb:hover {
    background-color: #7f8388; /* Slightly lighter thumb on hover */
}

/* --- Placeholder for empty state --- */
/* Add a class like 'empty' to chat-body via JS when no messages */
.chat-body.empty::before {
    content: "Bonjour Hamda"; /* Or your desired welcome message */
    position: absolute;
    top: 40%; /* Adjust vertical position */
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    font-weight: 500;
    color: var(--text-secondary);
     /* Optional Gradient */
     background: linear-gradient(90deg, #8ab4f8, #f88a8a);
     -webkit-background-clip: text;
     -webkit-text-fill-color: transparent;
     background-clip: text;
     /*text-fill-color: transparent;*/

}

/* Messages */
.chat-body .message{
    display: flex;
    gap: 12px;
    align-items: flex-start;
    max-width: 85%; /* Max width relative to the centered chat-body */
    word-wrap: break-word;
}
.chat-body .bot-message {
    align-self: flex-start;
}
.chat-body .user-message {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.chat-body .message .message-text{
    padding: 10px 15px; /* Adjust padding */
    font-size: 0.95rem; /* Slightly smaller text */
    line-height: 1.6;
    border-radius: 18px; /* Gemini's rounded corners */
    box-shadow: none; /* Remove light theme shadow */
    color: var(--text-primary);
}
/* Text Selection Style */
.chat-body .message .message-text::selection {
  background-color: var(--text-accent);
  color: var(--bg-dark-primary);
}

/* Bot message styling */
.chat-body .bot-message .message-text{
    background: var(--bg-dark-tertiary);
    border-radius: 18px 18px 18px 4px; /* Bubble tail */
}
/* User message styling */
.chat-body .user-message .message-text{
    background: var(--bg-user-message);
    border-radius: 18px 18px 4px 18px; /* Bubble tail */
}

/* Code block styling inside messages */
.chat-body .message .message-text pre {
    background-color: var(--bg-dark-primary); /* Darker bg for code */
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin: 10px 0;
    overflow-x: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--bg-dark-primary);
}
.chat-body .message .message-text pre::-webkit-scrollbar { height: 6px; }
.chat-body .message .message-text pre::-webkit-scrollbar-track { background: var(--bg-dark-primary); }
.chat-body .message .message-text pre::-webkit-scrollbar-thumb { background-color: var(--scrollbar-thumb); border-radius: 3px; }

.chat-body .message .message-text code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: var(--text-secondary); /* Lighter code text */
}
.chat-body .message .message-text pre code {
    background: none;
    padding: 0;
    color: inherit; /* Inherit color from pre */
}
.chat-body .message .message-text :not(pre) > code { /* Inline code */
    background-color: rgba(232, 234, 237, 0.1); /* Subtle inline code bg */
    padding: 2px 5px;
    border-radius: 4px;
    color: var(--text-secondary);
}
/* Strong/Emphasis Styling */
.chat-body .message .message-text strong { font-weight: 600; color: var(--text-primary); }
.chat-body .message .message-text em { font-style: italic; color: var(--text-secondary); }


/* Avatar */
.chat-body .bot-message .bot-avatar{
    height: 32px; /* Smaller avatar */
    width: 32px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-top: 4px;
    border: none; /* Remove white border */
    box-shadow: none;
}
/* Attachment Styling */
.chat-body .message .attachment {
    max-width: 100%;
    border-radius: 12px;
    margin-top: 10px;
    border: 1px solid var(--border-color); /* Add subtle border */
}
.chat-body .message .image-attachment {
    display: block;
    max-height: 250px; /* Adjust height */
    width: auto;
    cursor: pointer;
    transition: opacity 0.2s ease; /* Changed transition */
}
.chat-body .message .image-attachment:hover {
    opacity: 0.9; /* Slight opacity change on hover */
    transform: none; /* Remove scale effect */
}

/* File attachment specific styles */
.chat-body .message .file-attachment {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background-color: rgba(232, 234, 237, 0.05); /* Darker subtle bg */
    border: 1px solid var(--border-color);
    border-radius: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    cursor: default;
}
.chat-body .user-message .file-attachment {
     background-color: rgba(138, 180, 248, 0.1); /* Subtle blue tint for user file */
     border-color: rgba(138, 180, 248, 0.3);
     color: var(--text-secondary);
}
.chat-body .message .file-attachment .material-symbols-outlined {
    font-size: 1.4rem;
    color: var(--text-secondary);
}
/* User message file icon color (can be same or slightly different) */
/* .chat-body .user-message .file-attachment .material-symbols-outlined { } */
.chat-body .message .file-attachment span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

/* Thinking Indicator */
.chat-body .bot-message.thinking .message-text{
    padding: 8px 16px; /* Adjusted padding */
    min-height: 40px; /* Adjust height */
    display: flex;
    align-items: center;
    background: var(--bg-dark-tertiary); /* Same as regular bot message */
}
.chat-body .bot-message .thinking-indicator{
    display: flex;
    gap: 5px;
    padding-block: 0; /* Remove extra padding */
}
.chat-body .bot-message .thinking-indicator .dot{
    height: 8px;
    width: 8px;
    border-radius: 50%;
    background: var(--text-secondary); /* Use secondary text color */
    animation: dotPulse 1.4s cubic-bezier(0.4, 0, 0.6, 1) infinite; /* Adjusted timing */
}
.chat-body .bot-message .thinking-indicator .dot:nth-child(1){ animation-delay: 0.0s; }
.chat-body .bot-message .thinking-indicator .dot:nth-child(2){ animation-delay: 0.2s; }
.chat-body .bot-message .thinking-indicator .dot:nth-child(3){ animation-delay: 0.4s; }

@keyframes dotPulse{
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}


/* Chat Footer */
.chat-footer{
    padding: 15px 20px 20px; /* Adjust padding */
    background-color: var(--bg-dark-secondary); /* Match container background */
    border-top: 1px solid var(--border-color); /* Subtle border */
    flex-shrink: 0;
}
.chat-footer .chat-form{
    display: flex;
    align-items: flex-end; /* Align items to bottom */
    position: relative;
    background: var(--bg-dark-tertiary); /* Input area background */
    border-radius: 28px; /* Gemini's roundness */
    border: 1px solid var(--border-color); /* Subtle border */
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    padding: 8px 10px 8px 15px; /* Adjust padding (less vertical, more horizontal start) */
    /* Center the form */
    max-width: 900px; /* Max width like Gemini */
    margin: 0 auto; /* Center horizontally */
}
.chat-footer .chat-form:focus-within{
    border-color: var(--text-accent); /* Accent color border on focus */
    box-shadow: none; /* Remove default focus ring */
}
/* Remove rounded corners change on expansion */
/* .chat-footer .chat-form.input-expanded { border-radius: 18px; } */

/* Message Input Area */
.chat-form .message-input {
    flex-grow: 1;
    border: none;
    outline: none;
    background: transparent;
    min-height: 26px; /* Adjust min height */
    max-height: 150px; /* Allow more lines if needed */
    width: 100%;
    resize: none;
    font-size: 0.95rem; /* Adjust font size */
    padding: 8px 10px; /* Adjust padding within textarea */
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-primary); /* Light text color */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--bg-dark-tertiary); /* Input scrollbar color */
}
/* Placeholder Text */
.chat-form .message-input::placeholder {
    color: var(--text-secondary);
    opacity: 1; /* Ensure visibility */
}

/* Webkit scrollbar for textarea */
.chat-form .message-input::-webkit-scrollbar {
    width: 6px;
}
.chat-form .message-input::-webkit-scrollbar-track {
    background: var(--bg-dark-tertiary);
    border-radius: 3px;
}
.chat-form .message-input::-webkit-scrollbar-thumb {
    background-color: var(--scrollbar-thumb);
    border-radius: 3px;
}

/* Controls Area */
.chat-form .chat-controls{
    display: flex;
    align-items: flex-end; /* Align icons to bottom */
    padding-bottom: 3px; /* Fine-tune vertical alignment */
    gap: 5px; /* Adjust gap */
    padding-right: 5px;
    flex-shrink: 0;
}
.chat-form .chat-controls button{
    height: 40px; /* Adjust button size */
    width: 40px;
    border: none;
    font-size: 1.4rem; /* Adjust icon size */
    cursor: pointer;
    color: var(--text-secondary); /* Icon color */
    background: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.chat-form .chat-controls button:hover{
    background: var(--hover-bg); /* Subtle hover */
    color: var(--text-primary); /* Lighter icon on hover */
}
/* Send Button */
.chat-form .chat-controls #send-message{
    color: var(--text-secondary); /* Same color as other icons initially */
    background: none;
    display: none; /* Initially hidden, shown via JS */
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
}
.chat-form .chat-controls #send-message:hover{
    background: var(--hover-bg); /* Same hover as others */
    color: var(--text-accent); /* Accent color on hover for send */
}
.chat-form .chat-controls #send-message:active {
    transform: scale(0.95); /* Click feedback */
}
/* JS should add display: flex; to show */


/* File Upload Wrapper */
.chat-form .file-upload-wrapper{
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 40px; /* Match button height */
    width: 40px;  /* Match button width */
}
/* Elements inside the wrapper */
.chat-form .file-upload-wrapper > * {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease, transform 0.2s ease;
}
/* File preview image */
.chat-form .file-upload-wrapper img{
    width: 32px; /* Adjust size */
    height: 32px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid var(--border-color); /* Use theme border */
    opacity: 0;
    pointer-events: none;
}
/* File name preview (for non-images) */
.chat-form .file-upload-wrapper #file-name-preview {
    font-size: 0.7rem; /* Smaller font */
    color: var(--text-primary);
    background: var(--border-color); /* Darker bg */
    padding: 2px 5px;
    border-radius: 4px;
    max-width: 34px; /* Adjust size */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
}
/* Cancel button */
.chat-form .file-upload-wrapper #file-cancel{
    color: var(--text-primary); /* Light icon */
    background: rgba(217, 48, 37, 0.7); /* Darker red, semi-transparent */
    /* backdrop-filter: blur(2px); */ /* Remove blur if not desired */
    font-size: 0.9rem; /* Adjust icon size */
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 2;
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.2); /* Optional subtle border */
}
/* Upload button (the attach_file icon) */
.chat-form .file-upload-wrapper #file-upload {
    opacity: 1;
    z-index: 1;
    transition: opacity 0.2s ease, color 0.2s ease, background-color 0.2s ease;
     /* Ensure it inherits button styling */
    height: 40px;
    width: 40px;
    font-size: 1.4rem;
    color: var(--text-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.chat-form .file-upload-wrapper #file-upload:hover {
     background: var(--hover-bg);
     color: var(--text-primary);
}


/* Visibility states controlled by JS adding classes */
.file-upload-wrapper.file-uploaded.file-is-image img { opacity: 1; }
.file-upload-wrapper.file-uploaded.file-is-other #file-name-preview { opacity: 1; }
.file-upload-wrapper.file-uploaded #file-upload { opacity: 0; pointer-events: none; }
.file-upload-wrapper.file-uploaded:hover #file-cancel {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
}


/* Emoji Picker Container */
.emoji-picker-container {
    position: absolute;
    bottom: calc(100% + 10px);
    /* Position relative to the centered chat form */
    left: 15px; /* Align with form padding start */
    right: auto;
    z-index: 1010;
    visibility: hidden;
    opacity: 0;
    transform: translateY(10px);
    transition: visibility 0s linear 0.2s, opacity 0.2s ease, transform 0.2s ease;
}
/* Emoji Picker Component */
em-emoji-picker{
    /* Attempt basic dark theme styling if component uses CSS variables */
    /* These might not work depending on the component */
    --background: var(--bg-dark-tertiary);
    --border-color: var(--border-color);
    --text-color: var(--text-primary);
    --secondary-text-color: var(--text-secondary);
    --input-background-color: var(--bg-dark-secondary);
    --input-text-color: var(--text-primary);
    --input-border-color: var(--border-color);
    --category-icon-color: var(--text-secondary);
    --category-icon-active-color: var(--text-primary);
    /* Default styling */
    width: 330px; /* Adjust width */
    max-width: 90vw;
    max-height: 380px; /* Adjust height */
    box-shadow: 0 8px 25px rgba(0,0,0,0.3); /* Darker shadow */
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    /* Force dark theme if component supports it */
    /* color-scheme: dark; */
}
/* Show Emoji Picker */
body.show-emoji-picker .emoji-picker-container {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0s;
}

/* Media Query for Smaller Screens */
@media (max-width: 940px) { /* Adjust breakpoint for centering */
    .chat-header,
    .chat-body,
    .chat-footer .chat-form {
        max-width: 100%; /* Use full width */
        margin: 0; /* Reset centering */
    }
     .chat-header {
        padding-left: 15px;
        padding-right: 15px;
    }
     .chat-body {
        padding-left: 15px;
        padding-right: 15px;
    }
     .chat-footer {
        padding-left: 10px;
        padding-right: 10px;
    }
    .chat-body.empty::before {
      font-size: 1.5rem; /* Smaller welcome text */
    }

}

/* ... (الأنماط السابقة) ... */

/* --- Drag & Drop Styles --- */
.chatbot-popup.drag-over-active {
    /* تغيير طفيف لخلفية الحاوية الرئيسية كدليل */
    background-color: rgba(138, 180, 248, 0.03); /* لون خفيف جداً من لون التمييز */
    border: 2px dashed var(--border-color); /* حدود متقطعة للإشارة لمنطقة السحب */
    /* يمكنك اختيارياً إضافة فلتر سطوع أو تأثير آخر */
    /* filter: brightness(1.05); */
}

/* إضافة تأثير أوضح لمنطقة الإدخال عند السحب فوق الحاوية */
.chatbot-popup.drag-over-active .chat-form {
    border-color: var(--text-accent); /* تغيير لون حدود منطقة الإدخال */
    box-shadow: 0 0 8px rgba(138, 180, 248, 0.3); /* إضافة توهج خفيف */
}

/* تغيير مؤشر منطقة الإدخال ليكون أكثر وضوحاً */
.chatbot-popup.drag-over-active .message-input::placeholder {
    color: var(--text-accent);
    opacity: 0.8;
}
/* --- End Drag & Drop Styles --- */

/* ... (بقية أنماط CSS) ... */

@media (max-width: 600px){
    /* Further adjustments for very small screens */
    .chat-header{
        padding: 10px 12px;
    }
    .header-info .logo-text {
        font-size: 1.05rem;
    }
    .header-info .chatbot-logo {
        height: 30px;
        width: 30px;
    }
    .chat-body{
        padding: 15px 10px;
        gap: 15px;
    }
     .chat-body.empty::before {
       font-size: 1.3rem; /* Smaller welcome text */
     }
    .chat-body .message {
        max-width: 92%;
    }
    .chat-body .message .message-text {
      padding: 8px 12px;
      font-size: 0.9rem;
      border-radius: 16px; /* Adjust radius */
    }
    .chat-body .message .message-text pre {
        padding: 10px;
    }

    .chat-footer{
        padding: 8px 8px 10px; /* Adjust padding */
    }
    .chat-footer .chat-form {
        padding: 6px 8px 6px 10px; /* Adjust padding */
        border-radius: 24px; /* Slightly less round */
    }
    .chat-form .message-input {
        padding: 6px 8px;
        font-size: 0.9rem;
        min-height: 24px;
        max-height: 120px;
    }
    .chat-form .chat-controls {
        padding-bottom: 2px;
        gap: 3px;
    }
    .chat-form .chat-controls button,
    .chat-form .file-upload-wrapper,
    .chat-form .file-upload-wrapper #file-upload {
        height: 36px;
        width: 36px;
        font-size: 1.3rem;
    }
     .chat-form .file-upload-wrapper img{
        width: 28px; height: 28px;
     }
     .chat-form .file-upload-wrapper #file-cancel {
         width: 18px; height: 18px; font-size: 0.8rem;
     }

    /* Emoji picker position on mobile */
    .emoji-picker-container {
        left: 50%;
        transform: translateX(-50%) translateY(10px);
        bottom: calc(100% + 5px);
        width: 90vw;
    }
    body.show-emoji-picker .emoji-picker-container {
       transform: translateX(-50%) translateY(0);
    }
    em-emoji-picker {
         max-height: 300px;
         width: 100%;
    }
}

/* Chat Header */
.chat-header{
    display: flex;
    align-items: center;
    justify-content: space-between; /* Pushes title left, button right */
    background-color: var(--bg-dark-secondary);
    padding: 14px 20px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    flex-shrink: 0;
    max-width: 940px;
    width: 100%;
    margin: 0 auto;
}
.chat-header .header-info{
    display: flex;
    gap: 12px;
    align-items: center;
}
/* ... other header-info styles ... */

/* --- Clear Chat Button Styles --- */
#clear-chat-button {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.6rem; /* Adjust size as needed */
    cursor: pointer;
    padding: 5px; /* Add clickable area */
    border-radius: 50%;
    width: 40px;  /* Consistent button size */
    height: 40px; /* Consistent button size */
    display: flex; /* Center icon */
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease, transform 0.1s ease;
    flex-shrink: 0; /* Prevent shrinking */
}

#clear-chat-button:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary); /* Or var(--text-accent) if preferred */
}

#clear-chat-button:active {
    transform: scale(0.95);
}
/* --- End Clear Chat Button Styles --- */


/* ... rest of your CSS ... */

/* Adjust header padding on smaller screens if needed */
@media (max-width: 600px){
    .chat-header{
        padding: 10px 12px; /* Existing style */
    }
    #clear-chat-button {
        width: 36px;
        height: 36px;
        font-size: 1.4rem;
    }
     /* ... other responsive styles ... */
}
.katex {
    direction: ltr !important;      /* فرض الاتجاه من اليسار إلى اليمين */
    display: inline-block; /* يساعد في عزل عرض الرياضيات المضمنة ومنع تداخل RTL */
    text-align: left !important;    /* ضمان محاذاة المحتوى الداخلي للمعادلة لليسار */
    unicode-bidi: embed;   /* يساعد في إنشاء سياق اتجاه معزول */
}