
:root{
  --font-base-size: 16px;
  --bg:#0b0b0b;
  --panel:#111;
  --panel-2:#0e0e0e;
  --text:#f5f5f5;
  --muted:#c9c9c9;
  --border:#222;
  --accent:#fff;
  --accent-rgb:255,255,255;
  --user:#171717;
  --assistant:#121212;
  --input:#101010;
  --shadow: 0 6px 18px rgba(0,0,0,.35);
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 22px;
  --maxw: 980px;
  --thinking-bg: #1a1a1a;
  --thinking-border: #333;
  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
}

body[data-theme="light"] {
  --bg: #f5f5f5;
  --panel: #ffffff;
  --panel-2: #f0f0f0;
  --text: #111111;
  --muted: #555555;
  --border: #e0e0e0;
  --accent: #000000;
  --accent-rgb:0,0,0;
  --user: #f9f9f9;
  --assistant: #ffffff;
  --input: #ffffff;
  --shadow: 0 4px 12px rgba(0,0,0,.08);
  --thinking-bg: #f0f0f0;
  --thinking-border: #e0e0e0;
}

*{box-sizing:border-box}
html,body{height:100%;overflow-x:hidden}
html{font-size: var(--font-base-size);}
body{margin:0;background:var(--bg);color:var(--text);font:1em/1.6 system-ui, -apple-system, Segoe UI, Roboto, "Noto Sans Arabic", Arial, sans-serif}

body[data-theme="light"] .msg,
body[data-theme="light"] .menu-dropdown {
    box-shadow: none;
}

.app{display:grid;grid-template-columns:280px 1fr;height:100vh;overflow:hidden;width:100%; transition: grid-template-columns 0.3s ease;}
.sidebar{background:var(--panel);border-inline-end:1px solid var(--border);display:flex;flex-direction:column;position:relative;z-index:10;min-height:0; transition: width 0.3s ease, min-width 0.3s ease;}
.brand{padding:18px 16px;border-bottom:1px solid var(--border);display:flex;align-items:center;gap:10px}
.logo{width:28px;height:28px;border:1px solid var(--border);border-radius:8px;background:var(--panel-2);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:16px;color:var(--accent);}
.brand h1{font-size:18px;margin:0;font-weight:700;letter-spacing:.5px}
.side-actions{padding:12px 10px;border-bottom:1px solid var(--border); display: flex; flex-direction: column; gap: 8px;}
.btn{background:var(--panel-2);border:1px solid var(--border);color:var(--text);padding:10px 12px;border-radius:12px;cursor:pointer;transition:.3s ease;display:flex;align-items:center;justify-content:center;width:100%;box-shadow:0 2px 5px rgba(0,0,0,0.2); gap: 8px;}
.btn:hover{background:var(--panel);border-color:var(--accent);box-shadow:0 4px 10px rgba(0,0,0,0.3); transform: translateY(-1px);}
.btn:active{transform:translateY(0);box-shadow:0 1px 3px rgba(0,0,0,0.2);}
.btn:disabled{opacity:.6;cursor:not-allowed;box-shadow:none;}


.chat-list{flex:1;overflow-y:auto;padding:0 8px 8px;scroll-behavior:smooth; transition: max-height 0.3s ease-out, padding 0.3s ease-out;}
.chat-list.scroll-to-top-visible::after{content:'';display:block;height:40px;}
.chat-list-item{border-radius:8px;cursor:pointer;font-size:14px;color:var(--muted);position:relative; padding: 8px 12px; margin-bottom: 4px; transition: background 0.2s, color 0.2s;}
.chat-list-item:hover{background:var(--panel-2);color:var(--text);}
.chat-list-item.active{background:var(--accent);color:var(--bg);font-weight:500;}

.chat-item-content{
  display:flex;
  align-items:center;
  justify-content:space-between;
  width:100%;
}
.chat-title{
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
  flex:1;
  margin-right:8px;
}
.chat-menu{
  position:relative;
  opacity:0;
  transition:opacity 0.2s;
}
.chat-list-item:hover .chat-menu{
  opacity:1;
}
.menu-dots{
  background:none;
  border:none;
  color:var(--muted);
  cursor:pointer;
  padding:4px 8px;
  border-radius:6px;
  font-size:16px;
  transition:all 0.2s;
}
.menu-dots:hover{
  background:var(--panel);
  color:var(--text);
}
.menu-dropdown{
  position:absolute;
  top:100%;
  right:0;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:8px;
  box-shadow:var(--shadow);
  min-width:120px;
  z-index:100;
  opacity:0;
  visibility:hidden;
  transform:translateY(-10px);
  transition:all 0.2s;
}
.menu-dropdown.show{
  opacity:1;
  visibility:visible;
  transform:translateY(0);
}
.menu-option{
  display:block;
  width:100%;
  padding:8px 12px;
  background:none;
  border:none;
  color:var(--text);
  text-align:left;
  cursor:pointer;
  font-size:14px;
  transition:background 0.2s;
}
.menu-option:hover{
  background:var(--panel-2);
}
.menu-option:first-child{
  border-radius:8px 8px 0 0;
}
.menu-option:last-child{
  border-radius:0 0 8px 8px;
}

.side-footer{margin-top:auto;border-top:1px solid var(--border);padding:12px 14px;color:var(--muted);font-size:12px;display:flex;justify-content:space-between;align-items:center;flex-shrink:0;z-index:15;background:var(--panel);position:relative;}
/* Scroll to Bottom Button */
.scroll-to-bottom-btn{
  position:fixed;
  bottom:130px;
  right:20px;
  width:48px;
  height:48px;
  border-radius:50%;
  background:var(--accent);
  border:none;
  color:var(--bg);
  cursor:pointer;
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:20;
  opacity:0;
  visibility:hidden;
  transform:scale(0.8);
  transition:all 0.3s ease;
  box-shadow:0 4px 12px rgba(0,0,0,0.3);
}
.scroll-to-bottom-btn.show{
  opacity:1;
  visibility:visible;
  transform:scale(1);
}
.scroll-to-bottom-btn:hover{
  background:var(--muted);
  transform:scale(1.1);
  box-shadow:0 6px 16px rgba(0,0,0,0.4);
}
.scroll-to-bottom-btn:active{
  transform:scale(0.95);
}
.settings-btn { 
  padding: 8px; 
  width: auto; 
  border-radius: 10px; 
  background: linear-gradient(135deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.settings-btn:hover { 
  background: linear-gradient(135deg, var(--accent) 0%, #e0e0e0 100%);
  color: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}
.settings-btn svg { 
  display: block; 
  transition: transform 0.3s ease;
}
.settings-btn:hover svg {
  transform: rotate(90deg);
}

.main{display:flex;flex-direction:column;height:100vh;overflow:hidden;min-width:0}
.topbar{position:sticky;top:0;background:var(--panel);border-bottom:1px solid var(--border);padding:10px 16px;z-index:5;display:flex;align-items:center;gap:10px;}
.topbar .title{max-width:var(--maxw);margin:0 auto;font-weight:600;letter-spacing:.3px;flex-grow:1;text-align:center;}

/* Connection Status Indicator */
.connection-status{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  font-size:12px;
  color:var(--muted);
  min-width:0;
}
.connection-status .status-indicator{
  display:inline-flex;
  align-items:center;
  gap:6px;
  white-space:nowrap;
}
.connection-status .status-dot{
  width:8px;
  height:8px;
  border-radius:50%;
  box-shadow:0 0 0 2px rgba(0,0,0,0.2);
}
.connection-status.connected .status-dot{ background:#10b981; }
.connection-status.error .status-dot{ background:#ef4444; }
.connection-status.connecting .status-dot{ background:#f59e0b; animation:pulse 1.2s ease-in-out infinite; }

.connection-status.connected .status-text{ color:#10b981; }
.connection-status.error .status-text{ color:#ef4444; }
.connection-status.connecting .status-text{ color:#f59e0b; }

@keyframes pulse {
  0% { transform:scale(1); opacity:1; }
  50% { transform:scale(1.25); opacity:.8; }
  100% { transform:scale(1); opacity:1; }
}

.menu-btn{display:block;background:none;border:none;color:var(--text);font-size:24px;cursor:pointer;padding:0 5px;}
.menu-btn:focus{outline:none;}

.chat{flex:1;overflow:auto;min-width:0;position:relative;}
.chat-inner{max-width:var(--maxw);margin:0 auto;padding:18px 16px 120px;display:grid;gap:14px;min-width:0}

.welcome-message{
  display:flex;
  align-items:center;
  justify-content:center;
  min-height:300px;
  opacity:1;
  transition:opacity 0.3s ease-out;
}
.welcome-message.fade-out{
  opacity:0;
}
.welcome-text{
  font-size:48px;
  font-weight:700;
  color:var(--text);
  text-align:center;
  letter-spacing:1px;
  background:linear-gradient(135deg, var(--accent) 0%, var(--muted) 100%);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}

.msg{display:grid;gap:8px;padding:16px;border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);min-width:0;position:relative;}
.msg.user{background:var(--user)}
.msg.assistant{background:var(--assistant)}

.message-header{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:4px;
}
.msg .role{font-size:12px;color:var(--muted);letter-spacing:.4px}
.timestamp{font-size:11px;color:var(--muted);opacity:0.7;}
.msg .content{white-space:pre-wrap;word-wrap:break-word;overflow-wrap:break-word;min-width:0}

.message-actions{
  display:flex;
  gap:8px;
  margin-top:8px;
  opacity:0;
  transition:opacity 0.2s;
}
.msg:hover .message-actions{
  opacity:1;
}
.action-btn{
  background:none;
  border:1px solid var(--border);
  color:var(--muted);
  padding:6px 8px;
  border-radius:6px;
  cursor:pointer;
  font-size:14px;
  transition:all 0.2s;
  display:flex;
  align-items:center;
  gap:4px;
}
.action-btn:hover{
  background:var(--panel-2);
  color:var(--text);
  border-color:var(--muted);
}
.action-btn.active{
  background:var(--accent);
  color:var(--bg);
  border-color:var(--accent);
}

.content code{font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Cascadia Mono", monospace; background:var(--panel-2);border:1px solid var(--border);border-radius:10px;padding:1px 6px;word-break:break-all;color:var(--accent);}
pre{margin:0;overflow-x:auto;max-width:100%}
pre code{display:block;padding:14px;background:var(--panel-2);border:1px solid var(--border);border-radius:12px;overflow:auto;max-width:100%;white-space:pre-wrap;word-wrap:break-word;color:var(--text);}

.code-block {
  margin: 16px 0;
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
  border: 1px solid var(--border);
  text-align: left; /* Always LTR for code */
}
.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
[dir="rtl"] .code-header { flex-direction: row; }

.code-language {
  color: var(--muted);
  font-weight: 500;
  font-size: 12px;
  text-transform: lowercase;
}
.code-copy-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 24px;
  height: 24px;
  opacity: 0.7;
}
.code-copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
  opacity: 1;
}
.code-copy-btn.copied { color: #22c55e; opacity: 1; }
.code-copy-btn.copied:hover { color: #16a34a; }
.code-block pre { margin: 0; background: transparent; border: none; overflow-x: auto; }
.code-block code {
  background: transparent; border: none; padding: 16px; display: block;
  font-size: 14px; line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Monaco, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
  color: var(--text);
}
.inline-code {
  background: var(--panel-2); color: var(--accent); padding: 2px 6px; border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Monaco, Menlo, Consolas, 'Liberation Mono', 'Courier New', monospace;
}

.composer{position:fixed;inset-inline:280px 0;bottom:0;background:linear-gradient(180deg, rgba(11,11,11,0) 0, rgba(11,11,11,0.85) 30%, rgba(11,11,11,1) 70%);padding:16px 20px 18px;border-top:1px solid var(--border);box-sizing:border-box; transition: inset-inline 0.3s ease;}
body[data-theme="light"] .composer { background: linear-gradient(180deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.85) 30%, rgba(255,255,255,1) 70%); }
.composer-inner{max-width:var(--maxw);margin:0 auto;min-width:0}
.input-row{display:flex;gap:10px;align-items:flex-end;min-width:0}
textarea{flex:1;min-height:50px;max-height:200px;resize:vertical;background:var(--input);color:var(--text);border:1px solid var(--border);border-radius:var(--radius-lg);padding:14px 16px;font:1em/1.5 inherit;outline:none;min-width:0;box-sizing:border-box}
textarea:focus{border-color:#2a2a2a}
body[data-theme="light"] textarea:focus { border-color: #bbbbbb; }
.send{width:38px; height: 38px; border-radius:50%; display:flex; align-items:center; justify-content:center; background:var(--accent); color:var(--bg); border:none; cursor:pointer; font-size:14px; transition:all 0.2s; flex-shrink: 0;}
.send:hover{background:#e0e0e0;}
body[data-theme="light"] .send:hover { background: #222; }
.send:disabled{background:var(--border); color:var(--muted);}
.send.stop{background:#ff4444; color:#fff; width:38px; border-radius:6px;}
.send.stop:hover{background:#ff6666;}

@media (max-width: 960px){
  .app{grid-template-columns:1fr;overflow:hidden;width:100%}
  .sidebar{position:fixed;top:0;left:-280px;height:100%;transition:left .3s ease-in-out;z-index:10;box-shadow:2px 0 5px rgba(0,0,0,0.5);width:280px}
  .sidebar.open{left:0;}
  .composer{inset-inline:0;box-sizing:border-box}
  .topbar .title{margin-inline-start:auto;margin-inline-end:auto;}
  .connection-status{ font-size:11px; }
  .connection-status .status-text{ max-width:140px; overflow:hidden; text-overflow:ellipsis; }
  
  .message-actions{ opacity:1; }
  .welcome-text{ font-size:32px; }
  
  .scroll-to-bottom-btn{
    bottom:100px;
    right:10px;
    width:44px;
    height:44px;
  }
}

.deployment-actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  justify-content: flex-end;
}
.deployment-actions .btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
  width: auto;
}
.deployment-actions .deploy-btn {
  background-color: var(--accent);
  color: var(--bg);
  border-color: var(--accent);
}
.deployment-actions .deploy-btn:hover {
  background-color: #fff;
  border-color: #fff;
}
body[data-theme="light"] .deployment-actions .deploy-btn:hover { background-color: #222; border-color: #222; }
.deployment-actions .not-now-btn {
  background-color: transparent;
  color: var(--text);
  border-color: var(--border);
}
.deployment-actions .not-now-btn:hover {
  background-color: var(--panel-2);
  border-color: var(--muted);
}
.deployment-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.thinking-step {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 12px);
  padding: 12px 16px;
  margin: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.thinking-step-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.thinking-step-content {
  color: var(--text);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Cascadia Mono", monospace;
  font-size: 14px;
}

.settings-modal-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.settings-modal-overlay.show { opacity: 1; visibility: visible; }
.settings-modal {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%); 
  padding: 32px; 
  border-radius: var(--radius-lg);
  border: 2px solid var(--border); 
  width: 90%; 
  max-width: 450px;
  display: flex; 
  flex-direction: column; 
  gap: 24px; 
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  transform: scale(0.95); 
  transition: transform 0.3s ease;
  backdrop-filter: blur(10px);
}
.settings-modal-overlay.show .settings-modal { transform: scale(1); }
.settings-modal h2 { 
  margin: 0 0 20px; 
  text-align: center; 
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.setting-item { display: flex; justify-content: space-between; align-items: center; }
.setting-item label { font-weight: 500; color: var(--text); }
.setting-item select {
  padding: 10px 14px; border-radius: 10px; background: var(--input);
  color: var(--text); border: 1px solid var(--border);
  min-width: 150px; appearance: none; /* Remove default arrow */
  background-image: url('data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%20viewBox%3D%220%200%20292.4%20292.4%22%3E%3Cpath%20fill%3D%22%23cccccc%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13.6-6.4H19a17.6%2017.6%200%200%200-13.6%206.4%2017.6%2017.6%200%200%200%200%2025.3l128%20128a17.6%2017.6%200%200%200%2025.3%200l128-128a17.6%2017.6%200%200%200%200-25.3z%22%2F%3E%3C%2Fsvg%3E');
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 12px;
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.setting-item select:hover { border-color: var(--accent); }
.setting-item select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.5); }
.close-settings { margin-top: 10px; }

.setting-section {
  border-top: 1px solid var(--border);
  padding-top: 20px;
  margin-top: 10px;
}

.setting-section h3 {
  margin: 0 0 15px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
}

.about-info {
  margin-bottom: 15px;
}

.about-info p {
  margin: 5px 0;
  line-height: 1.4;
}

.about-info p:first-child {
  font-weight: 600;
  color: var(--accent);
}

.licenses-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
  font-weight: 500;
}

.licenses-btn:hover {
  background: var(--border);
  border-color: var(--accent);
}

/* --- RTL Support (CORRECTED) --- */
[dir="rtl"] .app { grid-template-columns: 1fr 280px; }
[dir="rtl"] .sidebar { border-inline-end: none; border-inline-start: 1px solid var(--border); }
[dir="rtl"] .topbar { flex-direction: row-reverse; }
[dir="rtl"] .connection-status { justify-content:flex-start; }
[dir="rtl"] .chat-title { margin-right: 0; margin-left: 8px; text-align: right; }
[dir="rtl"] .menu-dropdown { right: auto; left: 0; }
[dir="rtl"] .menu-option { text-align: right; }
[dir="rtl"] .side-footer { flex-direction: row-reverse; }
[dir="rtl"] .msg { text-align: right; }
[dir="rtl"] .message-header { flex-direction: row-reverse; }
[dir="rtl"] .message-actions { justify-content: flex-end; }
[dir="rtl"] .deployment-actions { justify-content: flex-start; }
[dir="rtl"] .thinking-step { text-align: right; }
[dir="rtl"] .thinking-step-title { flex-direction: row-reverse; }
[dir="rtl"] .composer { inset-inline: 0 280px; }
[dir="rtl"] textarea { text-align: right; }

@media (max-width: 960px) {
  [dir="rtl"] .app { grid-template-columns: 1fr; }
  [dir="rtl"] .sidebar { left: auto; right: -280px; }
  [dir="rtl"] .sidebar.open { left: auto; right: 0; }
  [dir="rtl"] .composer { inset-inline: 0; }
  
  [dir="rtl"] .scroll-to-bottom-btn {
    right: auto;
    left: 10px;
  }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Collapsed state styles */
.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

.sidebar.collapsed .brand h1,
.sidebar.collapsed .side-actions .btn,
.sidebar.collapsed .chat-list,
.sidebar.collapsed .side-footer span {
  display: none;
}

.sidebar.collapsed .brand {
  justify-content: center;
  padding: 18px 8px;
}

.sidebar.collapsed .side-actions {
  padding: 12px 8px;
}

.sidebar.collapsed .side-footer {
  justify-content: center;
  padding: 12px 8px;
}

.sidebar.collapsed .settings-btn {
  width: 44px;
  height: 44px;
  padding: 10px;
}

/* Update grid layout for collapsed sidebar */
.app.sidebar-collapsed {
  grid-template-columns: 60px 1fr;
}

/* Update composer position for collapsed sidebar */
.composer.sidebar-collapsed {
  inset-inline: 60px 0;
}

/* RTL support for collapsed state */
[dir="rtl"] .app.sidebar-collapsed {
  grid-template-columns: 1fr 60px;
}

[dir="rtl"] .composer.sidebar-collapsed {
  inset-inline: 0 60px;
}

/* Mobile responsive adjustments */
@media (max-width: 960px) {
  .sidebar.collapsed {
    width: 280px;
    min-width: 280px;
  }
  
  .sidebar.collapsed .brand h1,
  .sidebar.collapsed .side-actions .btn,
  .sidebar.collapsed .chat-list,
  .sidebar.collapsed .side-footer span {
    display: block;
  }
  
  .sidebar.collapsed .brand {
    justify-content: flex-start;
    padding: 18px 16px;
  }
  
  .sidebar.collapsed .side-actions {
    padding: 12px 10px;
  }
  
  .sidebar.collapsed .side-footer {
    justify-content: space-between;
    padding: 12px 14px;
  }
  
  .sidebar.collapsed .settings-btn {
    width: auto;
    height: auto;
    padding: 8px;
  }
  
  .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  
  .composer.sidebar-collapsed {
    inset-inline: 0;
  }
  
  [dir="rtl"] .app.sidebar-collapsed {
    grid-template-columns: 1fr;
  }
  
  [dir="rtl"] .composer.sidebar-collapsed {
    inset-inline: 0;
  }
}

.syntra-hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1em auto;
  width: 30%; /* Make it a short line */
  opacity: 0.7;
}

.syntra-h3 {
  font-size: 1.3em; /* Slightly larger than base font size */
  margin: 1em 0 0.5em;
  font-weight: 600;
  color: var(--text);
}


/* Flag Modal Styles */
.flag-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.flag-modal-overlay.show {
  opacity: 1;
  visibility: visible;
}

.flag-modal {
  background: linear-gradient(135deg, var(--panel) 0%, var(--panel-2) 100%);
  padding: 32px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border);
  width: 90%;
  max-width: 500px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 20px 40px rgba(0,0,0,0.4);
  transform: scale(0.95);
  transition: transform 0.3s ease;
  backdrop-filter: blur(10px);
}

.flag-modal-overlay.show .flag-modal {
  transform: scale(1);
}

.flag-modal h2 {
  margin: 0;
  text-align: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.flag-modal p {
  margin: 0;
  color: var(--text);
  text-align: center;
  line-height: 1.5;
}

.flag-modal textarea {
  width: 100%;
  padding: 12px;
  border-radius: 8px;
  background: var(--input);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.flag-modal textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(var(--accent-rgb), 0.5);
}

.flag-modal textarea::placeholder {
  color: var(--muted);
}

.flag-modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.flag-modal-actions .btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
}

.cancel-flag {
  background: var(--panel-2);
  color: var(--text);
}

.cancel-flag:hover {
  background: var(--border);
}

.submit-flag {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

.submit-flag:hover {
  background: #dc2626;
  border-color: #dc2626;
}

/* Flag button active state */
.flag-btn.active {
  color: var(--error);
  background: rgba(239, 68, 68, 0.1);
}

/* File Upload Button Styles */
.file-upload {
  width: 38px; 
  height: 38px; 
  border-radius: 50%; 
  display: flex; 
  align-items: center; 
  justify-content: center; 
  background: var(--panel-2); 
  color: var(--text); 
  border: 1px solid var(--border); 
  cursor: pointer; 
  font-size: 14px; 
  transition: all 0.2s; 
  flex-shrink: 0;
}

.file-upload:hover {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

.file-upload:active {
  transform: translateY(0);
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

/* File Upload Status */
.file-upload-status {
  position: absolute;
  top: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.file-upload-status.success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.file-upload-status.error {
  background: var(--error);
  color: white;
  border-color: var(--error);
}

/* Attached Files Display */
.attached-files {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.attached-file {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text);
}

.attached-file .file-name {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attached-file .remove-file {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 2px;
  border-radius: 4px;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
}

.attached-file .remove-file:hover {
  background: var(--error);
  color: white;
}

/* File Attachments in Messages */
.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 0;
}

.message-attachment {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  max-width: 200px;
  transition: all 0.2s ease;
}

.message-attachment:hover {
  background: var(--panel);
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.message-attachment .file-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: var(--bg);
  border-radius: 6px;
  font-size: 10px;
  font-weight: bold;
}

.message-attachment .file-info {
  flex: 1;
  min-width: 0;
}

.message-attachment .file-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.2;
}

.message-attachment .file-size {
  font-size: 11px;
  color: var(--muted);
  opacity: 0.8;
}

/* Different file type colors */
.message-attachment .file-icon.pdf { background: #e74c3c; }
.message-attachment .file-icon.doc { background: #3498db; }
.message-attachment .file-icon.txt { background: #95a5a6; }
.message-attachment .file-icon.img { background: #e67e22; }
.message-attachment .file-icon.zip { background: #9b59b6; }
.message-attachment .file-icon.default { background: var(--accent); }

/* New Task and Search Button Styling */
.new-task-btn, .search-btn {
  font-weight: 600;
  letter-spacing: 0.5px;
  /* Remove animation/transform on hover for a more formal look */
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.new-task-btn:hover, .search-btn:hover {
  transform: none; /* Override the default transform */
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.3);
}

.search-input-container {
  padding: 0 10px 12px;
  border-bottom: 1px solid var(--border);
  display: none; /* Hidden by default */
}

.search-input-container.active {
  display: block;
}

.search-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.2s;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Collapsible Chat List Header (All Task) */
.chat-list-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  user-select: none;
  transition: color 0.2s;
}

.chat-list-header:hover {
  color: var(--text);
}

.collapse-icon {
  transition: transform 0.3s ease;
}

.chat-list-container.collapsed .collapse-icon {
  transform: rotate(-90deg);
}

.chat-list-container.collapsed .chat-list {
  max-height: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

.chat-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 8px;
  scroll-behavior: smooth;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

/* Enhanced Chat List Item Styling */
.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  position: relative;
  transition: background 0.2s, color 0.2s;
}

.chat-list-item:hover {
  background: var(--panel-2);
  color: var(--text);
}

.chat-list-item.active {
  background: var(--accent);
  color: var(--bg);
  font-weight: 500;
}

.chat-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-right: 8px;
}

.chat-menu {
  opacity: 0;
  transition: opacity 0.2s;
}

.chat-list-item:hover .chat-menu {
  opacity: 1;
}
