* {
    font-family: 'Tajawal', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    unicode-bidi: normal !important;
    /* cursor: default; */
}

body {
    background-color: #f9f9f9;
    color: var(--text-color);
    overflow: hidden;
    height: 100vh;
    font-size: 0.90rem;
}

[data-theme="night"]{
    background-color: #18202b !important;
}


hr {
    margin: 1rem 0;
    max-width: 35%;
}

.hljs {
    direction: ltr;
    text-align: initial;
  }

/* تنسيق الحاوية الرئيسية */
/* .app {
    display: flex;
    height: 100vh;
    position: relative;
    flex-direction: column;
    justify-content: space-between;
    gap: 200px;
} */

[data-theme="night"] a{
    /* color: var(--text-color); */
    color: var(--gray-text);
}

.app {
    display: flex;
    height: 100vh;
    position: relative;
    flex-direction: column;
    justify-content: flex-start;
}

/* .app-header {
    background-color: var(--chat-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0px 20px;
    display: flex;
    height: 7%;
    justify-content: space-between;
    align-items: center;
} */

.app-header {
    background-color: var(--chat-bg);
    border-bottom: 1px solid var(--border-color);
    padding: 0 20px;
    display: flex;
    max-height: 40px;
    min-height: 40px;
    justify-content: space-between;
    align-items: center;
}

.app-header-right, .app-header-left, .app-header-middle{
    flex-grow: 1;
    display: flex;
    position: relative;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 10px;
    max-width: 33%;
}
.app-header-right{
    justify-content: flex-start;
    gap: 20px;
}

.app-header-left{
    justify-content: flex-end;
}


.app-header-title span{
    font-size: 1.2rem;
    font-weight: 500;
}

/* .app-container {
    display: flex;
    height: 93%;
    position: relative;
    align-items: center;
    justify-content: space-between;
} */

.error-messages {
 color: red;   
}

.app-container {
    display: flex;
    flex: 1;
    position: relative;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    margin-top: 4px;
}

/* تنسيق الشريط الجانبي */
.sidebar {
    display: none;
    /* width: 280px; */
    width: 15%;
    height: 100%;
    background: var(--chat-bg);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);

    flex-direction: column;
    transition: all 0.3s ease;
    z-index: 10;
    position: relative;
    overflow: hidden;
    scrollbar-width: thin;
}

.sidebar::-webkit-scrollbar {
    width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}


.right-sidebar {
    border-left: 1px solid var(--border-color);
    border-right: none;
    box-shadow: 0 2px 10px rgba(var(--primary-color-rgb), 0.05);
    border-radius: 25px 0px 0px 25px;
}

.right-sidebar.collapsed {
    width: 0;
    box-shadow: none;
} 

.left-sidebar {
    border-right: 1px solid var(--border-color);
    border-left: none;
    box-shadow: 0 2px 10px rgba(var(--primary-color-rgb), 0.05);
    border-radius: 0px 25px 25px 0px;
    left: 0;
}


.left-sidebar.collapsed {
    width: 0;
    box-shadow: none;
}


.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    border-bottom: 1px solid var(--border-color);
}

.btn-toggle-sidebar {
    display: none;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    color: var(--text-color);
    cursor: pointer;
    font-size: 16px;
    width: 30px;
    height: 30px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    position: fixed;
    z-index: 10;
    top: 50%;
}

#toggleLeftSidebar{
    /* left: 260px; */
    left: 14%;
}

#toggleRightSidebar{
    /* right: 260px; */
    top: 3%;
    right: 12.5%;
}

.left-sidebar.collapsed + #toggleLeftSidebar {
    left: -10px;
    transform: rotate(180deg);
}

.right-sidebar.collapsed + #toggleRightSidebar {
    right: -10px;
    transform: rotate(180deg);
}

.btn-toggle-sidebar:hover {
    /* background-color: var(--hover-color); */
    /* background-color: rgba(var(--primary-color-rgb), 0.5); */
    background-color: rgba(0, 0, 0, 0.10);
}

/* تنسيق زر الدردشة الجديدة */
.btn-new-chat {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    flex-grow: 1;
    margin-left: 10px;
}

.btn-new-chat:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.sidebar-section{
    padding: 15px;
    display: flex;
    flex-direction: column;
    /* gap: 5px; */
}

/* تنسيق قائمة سجل المحادثات */
.chat-history {
    flex-grow: 1;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chat-history::-webkit-scrollbar {
    width: 4px;
}

.chat-history::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.sidebar-item {
    display: flex;
    align-items: center;
    padding: 10px 10px;
    margin-bottom: 10px;  
    cursor: pointer;

    /* border-radius: var(--border-radius); */
    cursor: pointer;
    transition: all 0.2s;

}

.sidebar-item:hover{
    background-color: rgba(var(--primary-color-rgb), 0.05);
    border-inline-start: 4px solid var(--primary-color);
}

.sidebar-item.active{
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-inline-start: 4px solid var(--primary-color);
    border-radius: 0;
}


.chat-history-header{
    border-bottom: 1px solid var(--border-color); 
    padding: 0 0 10px 0;
}

.chat-history-header:hover{
    background-color: transparent;
    /* border: none; */
    border-bottom: 1px solid var(--border-color);
    border-inline-start: 0px solid var(--primary-color);
}

.sidebar-item i {
    margin-inline-end: 10px; 
    /* font-size: 1.1em; */
    color: var(--text-color);
}

.sidebar-item h3 {
    margin: 0;
    font-size: 1rem;
    /* font-weight: 600; */
    color: var(--text-color);
    flex-grow: 1;

    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    min-width: 0;
}

.sidebar-item .fas.fa-chevron-up {
    margin-inline-start: 10px;
    /* font-size: 0.9em; */
    color: var(--text-color);
    transition: transform 0.2s ease-in-out;

    /* background-color: var(--gray-light);
    border-radius: 50%;
    padding: 0.3rem; */
}

.sidebar-item .num-in-item{
    color: var(--text-color);
    font-size: 0.75em;
    padding: 3px 6px;
    border-radius: 6px;
    background-color: color-mix(in srgb, var(--gray-medium) 30%, transparent);
    margin-inline-start: 3px;
    /* text-decoration: none; */
    /* margin: 0 1px; */
}

.sidebar-item .num-in-item.inbox-messages-count{
    margin-inline-end: 5px;
}

.chat-history ul {
    list-style: none;
    padding: 0;
}

.chat-history .chat-history-list{
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    max-height: 0;
    animation: fadeOutCollapse 0.8s ease;
    overflow-y: auto;
    scrollbar-width: thin;
}

.chat-history .chat-history-list::-webkit-scrollbar {
    width: 4px;
}

.chat-history .chat-history-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.chat-history .chat-history-list.expanded{
    max-height: 5000px;
    transition: max-height 0.5s ease-in;
    animation: fadeInCollapse 0.5s ease;
}

.chat-history li {
    padding: 10px 10px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    position: relative;
    gap: 2px;
    min-width: 0; /* لمنع تجاوز العناصر للحاوية */
}

.chat-history li:hover {
    background-color: rgba(0, 0, 0, 0.1);
}

.chat-history li.active {
    background-color: rgba(var(--primary-color-rgb), 0.1);
    font-weight: 500;
}

.chat-history li i {
    margin-left: 8px;
    color: var(--primary-color);
    flex-shrink: 0; /* لمنع تقلص الأيقونة */
}

.chat-history li span {
    white-space:nowrap;
    overflow:hidden;
    text-overflow: ellipsis;
    /* width: 100%; */
    flex-grow: 1;
    min-width: 0; /* لضمان عمل text-overflow */
}

.chat-history li .chat-time {
    font-size: 0.75rem;
    color: color-mix(in srgb, var(--text-color) 40%, transparent);
    white-space: nowrap;
    flex-shrink: 0; /* لمنع تقلص التوقيت */
    margin-right: 0; /* إزالة الهامش السابق */
    text-align: end;
}

/* إضافة تنسيقات زر حذف المحادثة */
.chat-history li .chat-remove {
    position: absolute;
    left: 6px;
    right: auto;
    /* color: #ff5252; */
    opacity: 0;
    transition: opacity 0.3s ease;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-history li:hover .chat-remove {
    opacity: 1;
}

.chat-history li:hover .chat-time {
    opacity: 0;
}

.chat-history li .chat-time {
    transition: opacity 0.3s ease;
    opacity: 1;
}

/* تنسيق منطقة المحادثة */
.chat-container {
    flex-grow: 1;
    /* display: flex; */
    display: none;
    flex-direction: column;
    height: 100%;
    background-color: var(--chat-bg);
    position: relative;
    max-width: 65vw;
    /* box-shadow: 0 2px 10px rgba(var(--primary-color-rgb), 0.15); */
    box-shadow: 0 2px 10px rgba(185, 185, 185, 0.15);
    /* border-radius: 25px 25px 25px 25px; */
    border-radius: 0px 0px 25px 25px;
    transition: all 0.3s ease-in-out;
    margin-left: 10px;  /* هامش افتراضي على اليسار */
    margin-right: 10px; /* هامش افتراضي على اليمين */
}



.wellcome-container {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    /* flex-grow: 1; */
    padding: 2rem;
    margin: 1rem;
    text-align: center;
    opacity: 0;
    max-height: 0;
    overflow: hidden;

    align-items: center;
    flex-direction: column;
    justify-content: flex-end;
}

.welcome-content {
    max-width: 600px;
}

.welcome-title {
    font-size: 3.0rem;
    font-weight: 600;
    margin-bottom: 1rem;
    /* color: var(--primary-color); */
    background: linear-gradient(0deg, var(--gradient-start), var(--gradient-end));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    display: inline-block; /* مهم لضمان عمل التدرج بشكل صحيح */
    text-shadow: 0px 2px 5px rgba(0, 0, 0, 0.1);
}

.welcome-text {
    font-size: 1.5rem;
    color: var(--text-color);
    opacity: 0.8;
}



[data-theme="night"] .chat-container{
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
}

.app-container.one-sidebar-collapsed .chat-container {
    max-width: 75vw;
}

.app-container.both-sidebars-collapsed .chat-container {
    max-width: 80vw;
}

.chat-container.drag-over {
    border: 2px dashed var(--primary-color);
    background-color: rgba(74, 144, 226, 0.1);
}

.chat-container .drop-icon {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: var(--primary-color);
    z-index: 1000;
}

.chat-container.drag-over .drop-icon {
    display: block;
}

.chat-container.drag-over .chat-header,
.chat-container.drag-over .chat-messages,
.chat-container.drag-over .chat-input-container {
    opacity: 0.5;
    background-color: rgba(74, 144, 226, 0.1);
}



/* تنسيق رأس المحادثة */
.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 2.0rem;
    /* background-color: var(--chat-header-bg, rgba(var(--primary-color-rgb), 0.05)); */
    /* background-color: var(--gray-light); */
    /* background-color: var(--gray-medium); */
    /* background-color: var(--gray-text); */
    /* background-color: var(--chat-bg); */
    border-bottom: 3px solid var(--border-color);
    /* border-radius: 25px 25px 0 0; */
    background-color: color-mix(in srgb, var(--gray-medium) 30%, transparent);
}

.chat-header:hover,
.chat-header.expanded {
    padding: 0.5rem 2.0rem;
}

.chat-header:hover .chat-title,
.chat-header.expanded .chat-title {
    font-size: 1.1em;
}

.chat-header:hover .chat-actions button,
.chat-header.expanded .chat-actions button {
    padding: 0.6rem;
}

.chat-title {
    /* font-size: 1.1rem; */
    font-size: 1.05em;
    font-weight: 500;
    color: var(--text-color);
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all 0.3s ease;
    cursor: default;
}

.chat-actions {
    display: flex;
    gap: 1rem;
}

.header-btn {
    background: none;
    border: none;
    padding: 0.55rem;
    border-radius: 8px;
    color: var(--text-color);
    cursor: pointer;
    background: transparent;
    background-color: var(--gray-light);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    /* width: 36px;
    height: 36px; */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.header-btn:hover {
    /* background-color: var(--hover-color);
    color: var(--primary-color); */
    background-color: rgba(0, 0, 0, 0.15);
    /* background-color: rgba(var(--primary-color-rgb), 0.4) !important; */
}


[data-theme="night"] .header-btn:hover {
    background-color: rgba(var(--primary-color-rgb), 0.4) !important;
}


.header-btn i {
    font-size: 0.9rem;
}


.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 2px;
}

/* إضافة خاصية الانتقال للعناصر */
.chat-messages, .chat-header, .wellcome-container, .chat-input-container {
    transition: all 0.3s ease-in-out;
}


.chat-container.new-chat-active{
    box-shadow: none;
    background-color: transparent;
    max-width: 60vw !important;
}
.chat-container.new-chat-active .chat-messages,
.chat-container.new-chat-active .chat-header{
    /* display: none; */
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    margin: 0;
    padding: 0;
}


.chat-container.new-chat-active .wellcome-container{
    display: flex;
    opacity: 1;
    max-height: 40%; /* قيمة كبيرة بما يكفي للمحتوى */
    min-height: 40%;
}

.chat-container.drag-over .wellcome-container {
    opacity: 0.5;
}

.chat-container.new-chat-active .chat-input-container {
    /* display: flex; */
    border-radius: 25px 25px 25px 25px;
    /* margin-top: auto; */
}

.message {
    display: flex;
    margin-bottom: 15px;
}

.message.user {
    justify-content: flex-end;
}

.message.assistant {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: var(--border-radius);
    position: relative;
    /* white-space: break-spaces; */
    white-space: wrap;
    /* white-space: pre-wrap; */
    /* word-break: break-word; */
    overflow-wrap: break-word;
    min-width: 180px;
    /* box-shadow: 0 0px 0px rgba(0, 0, 0, 0); */
}

.message.user .message-content {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    border-radius: 15px 15px 15px 0;
    white-space: pre-wrap;
}

[data-theme="night"] .message.user .message-content {
    background: var(--gray-light);
}

[data-theme="night"] .file-attachment {
    background-color: var(--gray-medium);
}


.message.user .message-action-btn:hover {
    background-color: rgba(var(--primary-color-rgb), 0.75);
  }

.message.assistant .message-content {
    /* background-color: #f1f5f9; */
    background-color: var(--gray-light);
    color: var(--text-color);
    border-radius: 15px 15px 0 15px;
    min-width: 270px;
}

.message-time {
    font-size: 12px;
    margin-top: 5px;
    opacity: 0.6;
    text-align: left;
}

.message.user .message-time {
    color: white;
}


/* تنسيقات أزرار الرسالة */
.message-actions {
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    display: flex;
    gap: 0px;
    opacity: 0;
    transition: opacity 0.2s ease;
    justify-content: flex-start;
    padding: 5px;
    /* border-radius: 8px; */
    /* background-color: var(--gray-light); */
    /* box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); */
}

/* .message.user .message-actions {
    justify-content: flex-end;
} */


.message-content:hover {
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}
.message-content:hover .message-actions {
    opacity: 0.8;
}

.message-action-btn {
    background: none;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    color: var(--text-color);
    font-size: 0.85em;
    border-radius: 4px;
    display: flex;
    align-items: center;
    /* gap: 5px; */
    transition: background-color 0.2s ease;
}

.message-action-btn:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.message.user .message-action-btn {
    color: #e5e5e5;
}

.message .message-action-btn:hover {
    /* background-color: rgba(var(--gray-light), 0.1); */
    /* background-color: var(--gray-light); */
    background-color: rgba(var(--primary-color-rgb), 0.75);
}

.message .message-action-btn:hover i {
    /* background-color: rgba(var(--gray-light), 0.1); */
    /* background-color: var(--gray-light); */
    color:  white;
}



.message-action-btn i {
    font-size: 0.9em;
}

.message-action-btn.good,
.message-action-btn.good:hover {
    background-color: #28a745;
}

.message-action-btn.good i {
    color: white;
}

.message-action-btn.bad,
.message-action-btn.bad:hover {
    background-color: #dc3545;
}

.message-action-btn.bad i{
    color: white;
}

.message.assistant.thinking{
    margin-bottom: 0;
}

.message.assistant.thinking .message-content{
    background-color: transparent;
    padding: 0;
    box-shadow: none;
}

.message.assistant.thinking .message-content .think-container{
    margin-bottom: 0;
    /* border: 1px solid var(--border-color); */
    border: 0px solid var(--border-color);
}

.message.assistant.thinking .message-content .think-container .think-header{
    background: var(--gray-light);
}
.message.assistant.thinking .message-content .think-container .think-header:hover{
    background: var(--gray-light);
}

.message.assistant.thinking .message-content .think-container.expanded .think-header{
    background: var(--gray-medium);
}

.message.assistant.thinking .message-content .think-container .think-body{
    background-color: var(--gray-light);
}

/* .message.user .message-action-btn {
    color: var(--text-color);
} */

/* تنسيق منطقة إدخال الرسائل */
.chat-input-container {
    /* padding: 5px 40px 30px 40px; */
    padding: 10px 80px 20px 80px;
    border-top: 1px solid var(--border-color);
    background-color: var(--chat-bg);
    display: flex;
    /* align-items: center; */
    flex-direction: column;
    gap: 5px;
    border-radius: 0px 0px 25px 25px;
    position: relative;
}

.message-input-wrapper {
    display: flex;
    flex-grow: 1;
    /* background-color: #f1f5f9; */
    background-color: var(--gray-light);
    border-radius: 20px;
    padding: 8px 15px;
    align-items: center;
}

/* منطقة عرض الملفات المرفقة */
.attachments-container {
    display: none;
    overflow-x: auto;
    gap: 10px;
    padding: 5px 10px;
    max-width: 100%;
    scrollbar-width: thin;
}


/* طبق هذه الأنماط فقط إذا كانت الحاوية تحتوي على أي عنصر ابن مباشر (*) */
.attachments-container:has(*) {
    /* أظهر الحاوية واجعلها flex */
    display: flex;
}

.attachment-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    /* background-color: #f1f5f9; */
    background-color: var(--gray-light);
    border-radius: 8px;
    padding: 2px 8px;
    min-width: 100px;
    max-width: 170px;
    gap: 5px;
    border: 1px solid var(--border-color);
}

/* if has .upload-progress in its children */
.attachment-item:has(.upload-progress) {
    width: 100%;
}

/* if not has .upload-progress in its children */
.attachment-item:not(:has(.upload-progress)) {
    cursor: pointer;
}

.attachment-icon {
    font-size: 24px;
    color: var(--primary-color);
    /* margin-bottom: 5px; */
}

.attachment-name {
    font-size: 12px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
}

.attachment-remove {
    position: absolute;
    top: -5px;
    right: -8px;
    background: rgba(var(--primary-color-rgb), 0.8);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.attachment-remove:hover {
    background: rgba(var(--primary-color-rgb), 1);
}

.attachment-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    /* border: 1px solid var(--border-color); */
}

[data-theme="night"] .attachment-loading {
    background: rgba(1,1,1, 0.8);
}

.attachment-loading .spinner {
    flex-shrink: 0; /* منع الانكماش */
    min-width: 20px; /* الحد الأدنى للعرض */
    min-height: 20px; /* الحد الأدنى للارتفاع */
    width: 20px;
    height: 20px;
    border: 3px solid rgba(var(--primary-color-rgb), 0.3);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin2 1s linear infinite;
    margin-right: 8px;
}

@keyframes spin2 {
    to { transform: rotate(360deg); }
}


input {
    background-color: var(--gray-light) !important;
    color: var(--text-color) !important;
}

#messageInput {
    flex-grow: 1;
    border: none;
    background: transparent;
    outline: none;
    resize: none;
    padding: 4px 8px;
    max-height: 150px;
    overflow-y: auto;
    color: var(--text-color);
}


.input-buttons {
    display: flex;
    align-items: center;
}

.input-buttons-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-upload, .btn-thinking-mode, .btn-web-search, .btn-more-options, .btn-send {
    /* background: transparent; */
    background-color: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-upload:hover, .btn-thinking-mode:hover, .btn-web-search:hover, .btn-more-options:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

[data-theme="night"] .btn-upload, .btn-thinking-mode, .btn-web-search, .btn-more-options, .btn-send {
    background-color: rgba(0, 0, 0, 0.10);

}

[data-theme="night"] .btn-upload:hover, .btn-thinking-mode:hover, .btn-web-search:hover, .btn-more-options:hover {
    background-color: rgba(0, 0, 0, 0.20);
}


.btn-send {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.btn-send:hover {
    opacity: 0.9;
}

.btn-abort {
    /* background: var(--gradient-end); */
    background: #d70707;
    color: white;
    position: relative;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-abort:hover {
    opacity: 0.9;
}

.loading-spinner-abort {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تنسيق زر الأوامر الجاهزة */
.btn-ready-commands {
    position: relative;
    /* display: flex; */
    display: none;
    align-items: center;
    gap: 6px;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid transparent;
    color: var(--text-color);
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 18px;
    /* transition: background-color 0.2s; */
    transition: all 0.3s ease;
    white-space: nowrap;
    background-clip: padding-box;
}

.btn-ready-commands::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: 18px;
    padding: 1px;
    background: linear-gradient(
        var(--rotate, 0deg),
        var(--gradient-start),
        var(--gray-light)
        /* rgba(var(--gradient-end), 0.3) */
    );
    -webkit-mask: 
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    mask:
        linear-gradient(#fff 0 0) content-box,
        linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity 0.3s ease;
}

@property --rotate {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}

.btn-ready-commands[style*="display: flex"]::before {
    opacity: 1;
    animation: 
        spin-gradient 0.5s linear 4,
        fade-out 0.5s linear 2s forwards;
    /* animation-fill-mode: forwards; */
}

@keyframes spin-gradient {
    from {
        --rotate: 0deg;
    }
    to {
        --rotate: 360deg;
    }
}

@keyframes fade-out {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.btn-ready-commands:hover {
    background-color: rgba(0, 0, 0, 0.15);
}

[data-theme="night"] .btn-ready-commands {
    background-color: rgba(0, 0, 0, 0.10);
}

[data-theme="night"] .btn-ready-commands:hover {
    background-color: rgba(0, 0, 0, 0.20);
}

.ready-commands-dropdown {
    position: absolute;
    margin-bottom: 25px;
    bottom: 100%;
    left: auto;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    z-index: 100;
    display: none;
    padding: 10px 5px;
    scrollbar-width: thin;
    width: 300px;
    max-height: 300px;
    min-height: 150px;
    overflow-y: auto;
}

.ready-commands-dropdown::-webkit-scrollbar {
    width: 4px;
}

.ready-commands-dropdown::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.ready-commands-dropdown.show {
    display: block;
    animation: fadeIn 0.3s ease;
}


.commands-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.command-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.command-item:hover {
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.command-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
}

.command-info {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.command-name {
    font-weight: 500;
    font-size: 15px;
}

.command-description {
    font-size: 13px;
    color: var(--gray-text);
    /* opacity: 0.7; */
    white-space: pre-wrap;
    text-align: start;
}

/* تنسيق العنصر المضاف في textarea */
.task-tag {
    position: relative;
    display: flex;
    align-items: center;
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border-radius: 8px;
    padding: 6px 4px;
    margin: 0 6px;
    white-space: nowrap;
    transition: all 0.2s;
}

[data-theme="night"] .task-tag {
    background-color: rgba(var(--primary-color-rgb), 0.25);
}

.task-tag:hover {
    padding: 6px 8px;
    background-color: rgba(var(--primary-color-rgb), 0.2);
}

[data-theme="night"] .task-tag:hover {
    background-color: rgba(var(--primary-color-rgb), 0.4);
}

.task-tag-icon {
    /* margin-right: 4px; */
    margin-inline-end: 6px;
    margin-inline-start: 8px;
}

.task-tag-name {
    font-weight: 500;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 100%;
    cursor: default;
    margin-inline-end: 8px;
}

.task-tag-remove {
    /* margin-left: 4px;
    cursor: pointer;
    font-size: 0.9em;
    color: var(--text-color);
    transition: transform 0.2s ease-in-out; */

    /* margin-inline-start: 6px; */
    position: absolute;
    top: -5px;
    right: -8px;
    background: rgba(var(--primary-color-rgb), 0.8);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
}



.task-tag-settings {
    opacity: 0;
    margin-left: 0px;
    cursor: pointer;
    margin-inline-start: 0px;
    font-size: 0.9em;
    color: var(--text-color);
    transition: all 0.2s ease-in-out;
}


.task-tag:hover .task-tag-settings {
    opacity: 1;
    /* margin-left: 4px; */
    margin-inline-start: 12px;
}


.task-tag.no-active {
    background-color: var(--gray-light);
    max-width: inherit;
    padding: 6px 12px;
    margin: 0px 0px;
    min-width: 210px;
}

[data-theme="night"] .task-tag.no-active {
    background-color: var(--gray-medium);
}

.task-tag.no-active:hover {
    background-color: var(--gray-light);
}

[data-theme="night"] .task-tag.no-active:hover {
    background-color: var(--gray-medium);
}

.task-tag-name.no-active {
    color: var(--assistant-text);
}

.task-tag-icon.no-active {
    color: var(--gray-text);
    margin-inline-start: 0px;
}

.code-icon-container {
    position: relative;
    display: inline-block;
    /* margin-right: 8px; */
    margin-left: 10px;
}

/* .code-icon-container .fas.fa-code {
    font-size: 18px;
    position: relative;
    z-index: 2;
} */

.code-icon-container .loading-spinner-2 {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 28px;
    height: 28px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top: 2px solid var(--text-color);
    border-radius: 50%;
    animation: spin3 1s linear infinite;
    z-index: 1;
}

@keyframes spin3 {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

.user-profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* border-left: 1px solid var(--border-color); */
    /* min-width: 200px; */
    /* padding-left: 5px; */

    padding: 15px 20px;
    background-color: rgba(var(--primary-color-rgb), 0.05);
    margin-top: 5px;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.user-profile-header:hover {
    /* padding: 11px 20px; */
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

/* تنسيق معلومات المستخدم */
.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-grow: 1;
    /* position: relative; */
}

.user-profile:hover {
    /* background-color: rgba(0, 0, 0, 0.1); */
    cursor: pointer;
}

.user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.user-info {
    display: flex;
    flex-direction: column;
}

#userName {
    font-weight: 500;
    font-size: 17px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
    min-width: 130px;
}

.user-menu {
    position: relative;
}

.btn-menu {
    background: transparent;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.btn-menu:hover {
    /* background-color: var(--hover-color); */
    background-color: rgba(0, 0, 0, 0.1);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    min-width: 200px;
    z-index: 1000;
    display: none;
    padding: 10px 5px;
}

.dropdown-menu.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    cursor: pointer;
    transition: background-color 0.2s;
    text-align: right;
    
}

.dropdown-item:hover {
    /* background-color: rgba(0, 0, 0, 0.15); */
    /* opacity: 0.9; */
    color: var(--text-color);
    background-color: rgba(var(--primary-color-rgb), 0.1);
}

.dropdown-item i {
    font-size: 14px;
}


/* تنسيقات القائمة المنسدلة للخيارات المتقدمة */
.model-options-dropdown {
    min-width: 200px;
    right: auto;
    left: 0;
    bottom: 70px;
    top: auto;
    margin-bottom: 10px;
    padding: 15px;
    color: var(--text-color);
}

.dropdown-header {
    font-weight: bold;
    margin-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
    text-align: center;
    padding: 0;
    color: var(--text-color);
    padding: .5rem 0rem;
}

.model-options-dropdown .setting-item-info {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
}

.model-options-dropdown .setting-item {
    margin-bottom: 15px;
}



/* تنسيق قسم الإعدادات */
.settings-container {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px;
    scrollbar-width: thin;
}

.settings-container::-webkit-scrollbar {
    width: 4px;
}

.settings-container::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 4px;
}

.settings-container h3 {
    font-size: 18px;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-section {
    /* background-color: #f8f9fa; */
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 20px;
}

.settings-section h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    color: var(--text-color);
}

.setting-item-info {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 10px;
    direction: ltr;
}


.setting-item {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 5px;
}

/* .setting-item label {
    margin-left: 10px;
} */

/* .setting-item input[type="range"] {
    flex-grow: 1;
    margin: 0 5px;
    overflow: auto;
    direction: ltr;
} */

.setting-item input[type="range"] {
    flex-grow: 1;
    margin: 0 5px;
    overflow: auto;
    direction: ltr;
    /* -webkit-appearance: none; */
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: var(--gray-medium);
    outline: none;
}

/* تخصيص Track (الممر الذي يتحرك فيه المؤشر) */
.setting-item input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 5px;
    border-radius: 5px;
}

/* تخصيص Thumb (المؤشر الذي يمكن سحبه) */
.setting-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    margin-top: -5px; /* لضبط الموضع العمودي */
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

/* تخصيص Track في Firefox */
.setting-item input[type="range"]::-moz-range-track {
    width: 100%;
    height: 5px;
    border-radius: 5px;
    background: var(--gray-medium);
}

/* تخصيص الجزء الممتلئ في Firefox */
.setting-item input[type="range"]::-moz-range-progress {
    height: 5px;
    border-radius: 5px;
    background: var(--primary-color);
}

/* تخصيص Thumb في Firefox */
.setting-item input[type="range"]::-moz-range-thumb {
    width: 15px;
    height: 15px;
    border-radius: 50%;
    background: var(--primary-color);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

/* لون التدرج للكروم لمحاكاة الجزء الممتلئ */
.setting-item input[type="range"] {
    background: linear-gradient(to right, var(--primary-color) var(--range-progress, 0%), var(--gray-medium) var(--range-progress, 0%));
}

/* تنسيق مختار السمات */
.theme-selector {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
    gap: 12px;
    padding: 10px;
}

.theme-btn {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, 
        var(--gradient-start) 0%, 
        var(--gradient-end) 100%
    );
}

.theme-btn-night{
    background: linear-gradient(135deg, 
    #475569 0%, 
    #334155 100%
    );  
}

.theme-btn-slate{
    background: linear-gradient(135deg, 
    #a6a6a6 0%, 
    #7f7f7f 100%
    );  
}

.theme-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

.theme-btn.active {
    border: 4px solid white;
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.3);
}

.app-header-actions {
    position: relative;
}

/* تنسيق قائمة السمات المنسدلة في الهيدر */
.theme-dropdown-menu {
    position: absolute;
    top: 45px;
    right: 5px;
    width: 200px;
    background: var(--chat-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    /* padding: 10px; */
    z-index: 1000;
    display: none;
    animation: fadeOut 0.3s ease;
  }
  
  .theme-dropdown-menu.show {
    display: block;
    animation: fadeIn 0.3s ease;
  }
  
  .header-theme-selector {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    padding: 10px;
  }
  
  /* @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  } */

/* تنسيق النوافذ المنبثقة */
.modal-content {
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
    border: none;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 15px 20px;
}

.modal-body {
    padding: 20px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    border: none;
}

.btn-primary:hover {
    opacity: 0.9;
}

/* إضافة طبقة التعتيم */
.backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
}

.backdrop.show {
    display: block;
}

.backdrop-chat {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.0);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 999;
}

.backdrop-chat.show {
    display: block;
}

/* حاوية دائرة التحميل */
.loading-spinner-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
  }
  
  /* دائرة التحميل */
  .loading-spinner {
    width: 40px;
    height: 40px;
    /* border: 4px solid rgba(var(--border-color), 1.0); */
    border: 4px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color, #4285f4);
    animation: spin 1s linear infinite;
  }
  
  /* تحريك دائرة التحميل */
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

/* تأثيرات الظهور */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-7px); }
}

/* تأثيرات الظهور */
@keyframes fadeInCollapse {
    from { opacity: 0; transform: translateY(-7px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutCollapse {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-7px); }
}


.message {
    animation: fadeIn 0.3s ease-out;
}

/* تنسيق شريط التمرير */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    /* background: #cbd5e1; */
    background: var(--gray-medium);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    /* background: #94a3b8; */
    background: var(--gray-medium);
}

/* تنسيقات الاستجابة */
@media (max-width: 992px) {
    .sidebar {
        position: absolute;
        top: 0;
        height: 100%;
        z-index: 1000;
    }
    
    .right-sidebar {
        right: 0;
        transform: translateX(100%);
    }
    
    .left-sidebar {
        left: 0;
        transform: translateX(-100%);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

.file-attachments {
    display: grid;
    align-items: center;
    gap: 6px;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    overflow: hidden;
}

/* تنسيق الملفات المرفقة */
.file-attachment {
    display: flex;
    align-items: center;
    /* background-color: #f1f5f9; */
    background-color: var(--gray-light);
    border-radius: 6px;
    padding: 8px 12px;
    margin-top: 2px;
    gap: 6px;
    cursor: pointer;
}

.file-attachment i {
    color: var(--primary-color);
}

[data-theme="night"] .file-attachment i {
    /* color: var(--assistant-text); */
    color: var(--gray-text);
}

.file-name {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* color: #484848; */
    color: var(--assistant-text);
    max-width: 200px;
    font-size: 14px;
}

.file-size {
    flex-grow: 1;
    font-size: 12px;
    /* color: #64748b; */
    color: var(--gray-text);
    direction: ltr;
    white-space: nowrap;
    flex-shrink: 0;
    /* text-align: end; */
}

.file-with-preview-attachment {
    display: flex;
    align-items: normal;
    flex-direction: column;
    /* background-color: #f1f5f9; */
    background-color: var(--gray-light);
    border-radius: 8px;
    padding: 4px 4px;
    margin-top: 5px;
    gap: 0px;
    cursor: pointer;
}

.file-preview-attachment {
    display: flex;
    align-items: center;
    flex-direction: column;
    /* background-color: #f1f5f9; */
    /* border-radius: 8px; */
    /* padding: 4px 4px; */
    /* margin-top: 0px; */
    /* gap: 0px; */
  }

.file-preview {
    /* min-width: 300px;
    max-width: 300px; */
    min-width: 100%;
    max-width: 100%;
    max-height: 150px;
    min-height: 150px;
    border-radius: 8px;
    object-fit: cover;
    margin: 2px 2px;
}

/* تنسيق  الزر المفعل */
.button-active {
    background-color: rgba(var(--primary-color-rgb), 0.1) !important;
    color: var(--primary-color) !important;
}

[data-theme="night"] .button-active {
    background-color: rgba(var(--primary-color-rgb), 0.4) !important;
    /* color: var(--primary-color) !important; */
    color: var(--text-color) !important;
}

/* تحويل متغيرات الألوان إلى RGB للاستخدام في الشفافية */
:root {
    --purple-primary-color-rgb: 139, 38, 246;
    --ocean-primary-color-rgb: 14, 165, 233;
    --nature-primary-color-rgb: 16, 185, 129;
    --rose-primary-color-rgb: 236, 72, 153;
    --slate-primary-color-rgb: 71, 85, 105;
    --gold-primary-color-rgb: 180, 83, 9;
    --turquoise-primary-color-rgb: 13, 148, 136;
    --night-primary-color-rgb: 124, 58, 237;
}

[data-theme="purple"] {
    --primary-color-rgb: var(--purple-primary-color-rgb);
}

[data-theme="ocean"] {
    --primary-color-rgb: var(--ocean-primary-color-rgb);
}

[data-theme="nature"] {
    --primary-color-rgb: var(--nature-primary-color-rgb);
}

[data-theme="rose"] {
    --primary-color-rgb: var(--rose-primary-color-rgb);
}

[data-theme="slate"] {
    --primary-color-rgb: var(--slate-primary-color-rgb);
}

[data-theme="gold"] {
    --primary-color-rgb: var(--gold-primary-color-rgb);
}

[data-theme="turquoise"] {
    --primary-color-rgb: var(--turquoise-primary-color-rgb);
}

[data-theme="night"] {
    --primary-color-rgb: var(--night-primary-color-rgb);
}

/* code { 
    font-family: monospace; 
}

pre { 
    background-color: #f4f4f4; 
    padding: 10px; 
    border-radius: 5px; 
    overflow-x: auto; 
} */

/* تنسيقات أساسية للـ Markdown */
.message-content h1,
.message-content h2 {
    font-size: 1.25em;
    margin-top: 1em;
    margin-bottom: 1em;
    /* color: #1a1a1a; */
}

.message-content h3,
.message-content h4 {
    font-size: 1.2em;
    margin-top: 1em;
    margin-bottom: 1em;
    /* color: #1a1a1a; */
}

.message-content h5,
.message-content h6 {
    font-size: 1.15em;
    margin-top: 1em;
    margin-bottom: 1em;
    /* color: #1a1a1a; */
}

/* .message-content h1 { border-bottom: 2px solid rgba(var(--primary-color-rgb), 0.2); padding-bottom: 1.0em; }
.message-content h2 { border-bottom: 2px solid rgba(var(--primary-color-rgb), 0.2); padding-bottom: 1.0em; } */

.message-content p {
    margin-bottom: 1em;
    /* margin-top: 1em; */
    white-space: pre-wrap;
}

.message-content ul,
.message-content ol {
    margin-left: 20px;
    margin-right: 0;  
    padding-left: 0;   
    padding-right: 20px; 
    margin-bottom: 1em;
}

.message-content li {
    margin-bottom: 1em;
    margin-top: 0.5em;
}

.message-content blockquote {
    border-right: 4px solid rgba(var(--primary-color-rgb), 0.2);
    border-left: none;
    padding-right: 15px; 
    padding-left: 5px;
    margin-right: 5px; 
    margin-left: 5px;
    /* color: #6a737d; */
}

.message-content code:not(pre code) {
    /* background-color: #f0f0f0; */
    /* padding: 1em 1em; */
    display: inline-block;
    padding: 0.2em 0.2em;
    margin: 0;
    /* font-size: 85%; */
    border-radius: 4px;
    font-family: "SFMono-Regular", Consolas, monospace, "Liberation Mono", Menlo, Courier;
}

[data-theme="night"] code {
    color: #e5ae45;
}

.message-content pre {
    /* background-color: #2d2d2d;
    color: #f8f8f2; */
    padding: 2em;
    overflow-x: auto;
    border-radius: 8px;
    margin-bottom: 1em;
}

.message-content pre code.hljs {
    display: block;
    overflow-x: auto;
    padding: 1em;
    /* background: #2d2d2d;
    color: #f8f8f2; */
}


.message-content table {
    border-collapse: collapse;
    margin-bottom: 1em;
    width: auto; 
}

.message-content th,
.message-content td {
    border: 1px solid rgba(var(--primary-color-rgb), 0.2);
    padding: 6px 13px;
}

.message-content th {
    font-weight: bold;
    background-color: rgba(var(--primary-color-rgb), 0.1);
}


/* 
[data-theme="night"] .message-content th {
    background-color: rgba(var(--chat-bg), 0.1);
}

[data-theme="night"] .message-content th,
.message-content td {
    border: 1px solid rgba(var(--chat-bg), 0.2);
} */



.media-container {
    /* background: var(--gray-medium); */
    /* background-color: rgba(0, 0, 0, 0.1); */
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 15px;
    /* overflow: hidden; */
    /* min-width: 100%; */
    max-width: 80%;
    cursor: pointer;
}

/* .image-container img { */
.message-media {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: fill;
    /* margin: 2px 2px; */
}

.think-container {
    /* background: var(--gray-medium); */
    /* background-color: rgba(0, 0, 0, 0.1); */
    border: 2px solid var(--border-color);
    border-radius: 12px;
    margin-bottom: 15px;
    overflow: hidden;
    max-width: 70%;
    min-width: 70%;
    width: 95%;
}

.think-header {
    display: flex;
    align-items: center;
    /* padding: 10px 15px; */
    padding: 7px 15px;
    /* background: var(--gray-medium); */
    background: var(--gray-medium);
    cursor: pointer;
    transition: background-color 0.3s ease;
    user-select: none;
    /* min-width: 100%; */
    /* width: 100%; */
    min-width: 35%;
    width: 35%;
    border-radius: 12px;
}

.think-header:hover {
    /* background: var(--hover-color-darker); */
    /* background: var(--gray-medium); */
    background-color: rgba(0, 0, 0, 0.1);
}

.think-header i {
    /* margin-left: 8px; */
    /* font-size: 1.1em; */
    font-size: 95%;
    /* color: var(--text-color-secondary); */
    /* color: var(--primary-color); */
    color: var(--text-color);
}



.think-header span {
    flex-grow: 1;
}

.think-header .fa-chevron-down {
    margin-right: auto;
    margin-left: 0;
    transition: transform 0.3s ease;
}

.think-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out;
    padding: 0 15px;
    direction: ltr;
    white-space: wrap;
    overflow-wrap: break-word;
    min-width: 100%;
    width: 100%;
    background-color: rgba(0, 0, 0, 0.05);
    /* animation: fadeOut 0.8s ease */
    animation: fadeOutCollapse 0.5s ease;
    border: 0px solid var(--border-color);
}

.think-container.expanded .think-body {
    max-height: 5000px;
    padding: 15px;
    transition: max-height 0.5s ease-in;
    /* animation: fadeIn 0.5s ease; */
    background-color: rgba(0, 0, 0, 0.05);
    /* background: var(--gray-light); */
    animation: fadeInCollapse 0.8s ease;
    border: 1px solid var(--border-color);
}

.response-content {
    margin-top: 15px;
    padding: 0 2px;
}

/* .think-body p:first-child {
    margin-top: 0;
}

.think-body p:last-child {
    margin-bottom: 0;
} */


/* أنماط جدول البيانات */
.table-container {
    margin: 15px 0;
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
    padding: 15px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.table-toolbar {
    display: flex;
    justify-content: flex-end;
    /* margin-bottom: 15px; */
}

.export-buttons {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.export-btn {
    padding: 4px 14px;
    border: none;
    border-radius: 6px;
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: opacity 0.2s;
}

.export-btn:hover {
    opacity: 0.9;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
}

.data-table th {
    background-color: var(--gray-light);
    color: var(--text-color);
    font-weight: 600;
    padding: 12px;
    text-align: right;
    border-bottom: 2px solid var(--border-color);
}

.data-table td {
    padding: 10px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-color);
}

.data-table tbody tr:hover {
    background-color: var(--gray-light);
}

/* تخصيص DataTables */
.dataTables_wrapper {
    direction: rtl;
}

.dataTables_filter,
.dataTables_info,
.dataTables_length {
    margin: 10px 0;
    color: var(--text-color);
}

.dataTables_paginate {
    margin-top: 15px;
}

.paginate_button {
    padding: 5px 10px;
    margin: 0 3px;
    border-radius: 4px;
    cursor: pointer;
    color: var(--text-color);
}

.paginate_button.current {
    background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
    color: white;
}

.dataTables_scrollBody {
    border-bottom: 1px solid var(--border-color);
}

/* أنماط شريط تقدم رفع الملفات */
.upload-progress {
    width: 100%;
    height: 4px;
    background-color: var(--gray-medium);
    border-radius: 2px;
    margin-top: 8px;
    position: relative;
    margin-right: 15px;
    margin-left: 10px;
}

[data-theme="night"] .upload-progress {
    background-color: var(--gray-light);
}

.upload-progress .progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.upload-progress .progress-text {
    position: absolute;
    right: 0;
    top: -20px;
    font-size: 12px;
    color: var(--text-color);
    cursor: default;
    /* white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 300px;
    width: 100%;
    min-width: 200px; */
}


#chatFilesSection {
    background-color: transparent;
}

/* تنسيق قسم الملفات المرفقة في القائمة الجانبية */
/* .chat-files-container { */
    /* max-height: 300px; */
    /* overflow-y: auto; */
    /* scrollbar-width: thin; */
    /* scrollbar-color: var(--primary-color) var(--gray-medium); */
/* } */

.chat-file-item {
    /* background-color: var(--gray-medium); */
    background-color: var(--gray-light);
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* .chat-file-item:hover {
    opacity: 0.8;
} */

.chat-file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: -10px;
    padding: 0px 6px;
}

.chat-file-name {
    /* font-weight: 500; */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* max-width: 80%; */
    font-size: 0.9rem;
    /* font-weight: 500; */
}

.chat-file-toggle {
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9rem;
}

.chat-file-pages {
    /* display: none; */
    margin-top: 12px;
    /* padding-right: 10px; */
    padding: 0 6px;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    max-height: 0;
    animation: fadeOutCollapse 0.8s ease;
}

.chat-file-pages.expanded {
    /* display: block; */
    max-height: 5000px;
    transition: max-height 0.7s ease-in;
    animation: fadeInCollapse 0.5s ease;
}

.chat-file-page {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    margin-bottom: 8px;
    border-radius: var(--border-radius);
    background-color: var(--gray-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-file-page:hover {
    background-color: var(--gray-medium);
    /* opacity: 0.9; */
}

.chat-file-page.active {
    /* background-color: var(--gray-medium); */
    background-color: rgba(var(--primary-color-rgb), 0.1);
    border: 1px solid var(--gradient-start);
}

.page-thumbnail {
  width: 25px;
  height: 25px;
  margin-left: 4px;
  object-fit: cover;
  border-radius: 4px;
}

.page-number {
    font-size: 0.85rem;
}

/* تنسيق عارض الصفحة بملء الشاشة */
.fullscreen-viewer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.fullscreen-viewer-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
}

.fullscreen-viewer-title {
    color: white;
    font-size: 1.2rem;
}

.fullscreen-viewer-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
}

.fullscreen-viewer-content {
    max-width: 90%;
    max-height: 80%;
    overflow: auto;
}

/* .fullscreen-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
} */

.fullscreen-viewer-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    cursor: grab;
    transition: transform 0.1s ease-out;
    /* منع السحب الافتراضي */
    user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; -webkit-user-drag: none;
}

.fullscreen-viewer-image.grabbing {
    cursor: grabbing;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 25px;
    gap: 15px;
}

.zoom-slider {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    /* -webkit-appearance: none; */
}

.zoom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
}

.zoom-slider::-moz-range-thumb {
    width: 15px;
    height: 15px;
    background: white;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.zoom-value {
    color: white;
    font-size: 0.9rem;
    min-width: 45px;
    text-align: center;
}

.zoom-button {
    background: none;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zoom-button:hover {
    color: #ccc;
}

.fullscreen-viewer-loading {
    color: white;
    font-size: 1.2rem;
}

/* تنسيق أرقام المراجع */
/* .reference-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-color-light);
    color: var(--primary-color);
    border-radius: 4px;
    padding: 0 4px;
    margin: 0 2px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.reference-number:hover {
    background-color: var(--primary-color);
    color: white;
} */
/* تنسيق أرقام المراجع */
/* .reference-number  */
.reference-number{
    /* color: var(--primary-color); */

    color: var(--text-color);
    cursor: pointer;
    font-size: 0.7em;
    padding: 2px 4px;
    border-radius: 4px;
    background-color: color-mix(in srgb, var(--gray-medium) 40%, transparent);
    text-decoration: none;
    margin: 0 1px;
    /* vertical-align: super;
    line-height: normal;
    font-weight: normal;
    padding-right: 2px;
    padding-left: 2px;
    position: relative;
    top: -0.2em; */



}

/* .reference-number  */
.reference-number:hover {
    /* color: var(--primary-color); */
    text-decoration: underline;
    background-color: var(--gray-medium);
}


/* تنسيق قائمة المراجع */
/* .references-list {
    margin-top: 20px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 0.9em;
    color: var(--text-color-secondary);
}

.reference-link {
    color: var(--link-color);
    text-decoration: none;
}

.reference-link:hover {
    text-decoration: underline;
} */


/* تنسيق مشغل الصوت في العرض بملء الشاشة */
.audio-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.audio-info {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
}

.audio-title {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.audio-timestamp {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 15px;
    padding: 5px 10px;
    background-color: rgba(var(--primary-color-rgb), 0.3);
    border-radius: 5px;
    display: inline-block;
    direction: ltr;
}

.fullscreen-audio-player {
    width: 100%;
    height: 50px;
    outline: none;
    border-radius: 5px;
    margin: 10px 0;
    width: 600px;
}

/* تخصيص مظهر مشغل الصوت */
.fullscreen-audio-player::-webkit-media-controls-panel {
    background-color: rgba(255, 255, 255, 0.2);
}

.fullscreen-audio-player::-webkit-media-controls-play-button {
    background-color: var(--primary-color);
    border-radius: 50%;
}

.fullscreen-audio-player::-webkit-media-controls-current-time-display,
.fullscreen-audio-player::-webkit-media-controls-time-remaining-display {
    color: white;
}


/* تنسيق مشغل الفيديو في العرض بملء الشاشة */
.video-player-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 800px;
    padding: 20px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

.video-info {
    margin-bottom: 20px;
    text-align: center;
    width: 100%;
}

.video-title {
    color: white;
    font-size: 1.2rem;
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-timestamp {
    color: rgba(255, 255, 255, 0.8);
    font-size: 1rem;
    margin-bottom: 15px;
    padding: 5px 10px;
    background-color: rgba(var(--primary-color-rgb), 0.3);
    border-radius: 5px;
    display: inline-block;
    direction: ltr;
}

.fullscreen-video-player {
    width: 100%;
    max-width: 720px;
    height: auto;
    outline: none;
    border-radius: 5px;
    margin: 10px 0;
    background-color: black;
}

/* تخصيص مظهر مشغل الفيديو */
.fullscreen-video-player::-webkit-media-controls-panel {
    background-color: rgba(255, 255, 255, 0.2);
}

.fullscreen-video-player::-webkit-media-controls-play-button {
    background-color: var(--primary-color);
    border-radius: 50%;
}

.fullscreen-video-player::-webkit-media-controls-current-time-display,
.fullscreen-video-player::-webkit-media-controls-time-remaining-display {
    color: white;
}

.page-thumbnail i {
    /* font-size: 24px; */
    color: var(--primary-color);
}

[data-theme="night"] .page-thumbnail i {
    /* font-size: 24px; */
    color: var(--gray-text);
}

.mind-map-container {
    position: relative;
    cursor: grab;
    height: 400px;
    /* max-width: 80%;
    min-width: 80%; */
    max-width: 100%;
    min-width: 100%;
    border: 2px solid var(--border-color);
    margin-bottom: 15px;
    cursor: grab;
    border-radius: var(--border-radius);
}

.jsmind-container {
    width: 100%;
    height: 100%;
    background-color: var(--chat-bg);
    border-radius: var(--border-radius);
}

/* أنماط جديدة لأزرار التحكم في الخريطة الذهنية */
.jsmind-controls-container {
    /* position: fixed; */
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    gap: 10px;
}
.jsmind-zoom-button {
    padding: 8px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    background-color: var(--primary-color);
    color: white;
}
.jsmind-zoom-button:hover {
    opacity: 0.95;
}

/* .jsmind-controls-container {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 10;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 5px;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
}

.jsmind-zoom-button {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 5px 14px;
    margin-left: 5px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.jsmind-zoom-button:hover {
    background-color: var(--primary-color-rgb);
}
 */

.typing-indicator svg {
    width: 32px;
    height: 32px;
    margin: -15px 10px;
    padding: 0;
}

.typing-indicator svg circle {
    fill: var(--primary-color);
}


.app-logo {
    gap: 10px;
    /* flex-grow: 1; */
    justify-content: start;
}

.app-logo img {
    width: 30px;
    height: 30px;
}

.app-logo span {
    font-size: 1.0rem;
    font-weight: 600;
    margin-left: 10px;
    cursor: default;
}

#pdf-thumbnails-container {
    display: flex;
    flex-direction: column; /* أو row إذا كنت تريدها أفقية */
    gap: 10px; /* مسافة بين الصور المصغرة */
    max-height: 500px;
    overflow-y: auto;
    /* border: 1px solid #ccc;  */
    padding: 5px;
    scrollbar-width: thin;
}

.pdf-thumbnail-item{
    display: flex;
    align-content: center;
    flex-direction: column;
}

.pdf-thumbnail-item canvas {
    border: 1px solid #ddd;
    cursor: pointer;
    max-width: 100%; /* لجعلها متجاوبة داخل الحاوية */
    height: auto;
    border: 2px solid var(--border-color);
}

.pdf-thumbnail-item span {
    align-self: center;
}

.pdf-thumbnail-item canvas:hover {
    border-color: rgba(var(--primary-color-rgb), 0.5); /* تغيير لون الحدود عند التحويم */
}

/* ================== What's New Section ================== */
.whats-new-container {
    padding: 0px 20px;
    display: none;
    opacity: 0;
    transform: translateY(20px);
    max-height: 0;
    overflow: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, max-height 0.2s ease, padding 0.2s ease;
}

.chat-container.new-chat-active .whats-new-container {
    display: block;
    /* opacity: 1; */
    /* transform: translateY(0); */
    max-height: 1000px; /* قيمة كبيرة بما يكفي لإظهار المحتوى */
    pointer-events: auto;
    margin-top: 10px;

    animation-name: fadeInGridDelayed;
    animation-duration: 0.8s; /* المدة الإجمالية للتحريك */
    animation-timing-function: ease-in-out; /* لتأثير ظهور سلس */
    animation-fill-mode: forwards; /* للحفاظ على الحالة النهائية (opacity: 1) */
    /* إذا كان هناك animation-delay سابق، قد تحتاج لإزالته أو تعديله */
}

.chat-container.drag-over .whats-new-container {
    opacity: 0.5 !important;
}

  
  .whats-new-title {
    text-align: start;
    font-size: 1.0rem;
    font-weight: 500;
    color: var(--text-color);
    margin-bottom: 20px;
    margin-top: 10px;
    padding: 0px 50px;
    opacity: 0.8;
  }

  @keyframes fadeInGridDelayed {
    0% {
      opacity: 0;
    }
    40% { /* عند 0.3 ثانية (0.5s * 0.6) */
      opacity: 0;
    }
    100% { /* عند 0.5 ثانية */
      opacity: 1;
      transform: translateY(0);
    }
  }
  
  .whats-new-grid {
    /* opacity: 0; */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 15px;
    /* transform: translateY(10px); */
    
    padding: 0px 40px;
  }


  
  .whats-new-card {
    background-color: rgba(var(--primary-color-rgb), 0.015);
    border-radius: 12px;
    padding: 10px;
    display: flex;
    align-items: flex-start;
    gap: 15px;
    border: 1px solid var(--border-color);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
  }
  
  .whats-new-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 1px 10px var(--border-color);
  }
  
  .whats-new-card-icon {
    font-size: 1.6rem;
    color: var(--primary-color);
    margin-top: 3px;
    min-width: 30px;
    text-align: center;
    opacity: 0.9;
  }
  
  .whats-new-card-content h3 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.9;
  }
  
  .whats-new-card-content p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-color);
    line-height: 1.5;
    opacity: 0.8;
  }