:root {
  --dark-bg: #000;
  --dark-bg-secondary: #1e1e1e;
  --text-color: #f8f4f2;
  --highlight-bg: #242f50;
  --spacing: .25rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

@font-face {
  font-family: Ginto;
  src: url(../fonts/Ginto-Copilot-Upright-Variable.woff) format("woff2"),
      url(../fonts/Ginto-Copilot-Upright-Variable.woff) format("woff");
}

html, body {
  height: 100%;
}

body {
  font-family: Ginto, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", Segoe UI Symbol, "Noto Color Emoji";
  display: flex;
  flex-direction: column;
  font-size: 16px;
  margin: 0;
  padding: 0;
  color: var(--text-color);
  background-color: var(--dark-bg);
}

p.small {
  font-size: 12px;
  margin: 0;
}

* {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.4);
}

#app {
  height: 100%;
}

.layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.sidebar {
  background-color: var(--dark-bg);
  width: 260px;
  max-width: 260px;
  height: 100%;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transform: translateX(0);
  transition: transform 0.3s ease, max-width 0.2s ease, border 0.2s ease;
  z-index: 1000;
}

.sidebar.closed {
  transform: translateX(-100%);
  max-width: 0;
  border: none;
}

.sidebar-header {
  display: flex;
  padding-left: .75rem;
  padding-right: .75rem;
  position: sticky;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
}

.sidebar-footer {
  display: flex;
  position: sticky;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.toggle-sidebar,
.toggle-search,
.toggle-new-chat,
.user-account {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-color);
  cursor: pointer;
}

.toggle-search:hover,
.toggle-new-chat:hover,
.toggle-sidebar:hover,
.user-account {
  color: #ffffff;
}

.sidebar-links {
  padding-left: .75rem;
  padding-right: .75rem;
  padding-bottom: .75rem;
  overflow: hidden;
  overflow-y: auto;
}

.sidebar-link {
  display: flex;
  gap: 6px;
  padding: .5rem;
  font-size: .875rem;
  border-radius: 8px;
  cursor: pointer;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
  align-items: center;
}

.sidebar-link:hover {
  background-color: #313131;
}

.chat-sessions {
  padding-left: .75rem;
  padding-right: .75rem;
  overflow: hidden;
  overflow-y: auto;
  flex: 1;
}

.chat-sessions-empty {
  text-align: center;
  margin-top: calc(30dvh + 25px);
}

.session-group {
  margin-top: 2rem;
}

.session-group-title {
  padding-left: .5rem;
  padding-right: .5rem;
  padding-bottom: .5rem;
}

.chat-session-item {
  padding: .5rem;
  font-size: .875rem;
  border-radius: 8px;
  cursor: pointer;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-session-item.active {
  background-color: #212121;
}

.chat-session-item:hover {
  background-color: #313131;
}

.logo-container {
  display: flex;
  margin: auto;
  padding: 10px;
}

.logo {
  width: 100px;
}

.logo path {
  fill: white;
}

.chat-area {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  overflow: hidden;
}

.chat-header {
  position: sticky;
  top: 0;
  width: 100%;
  height: 45px;
  padding: 10px;
  z-index: 10;
  flex-shrink: 0;
  background-color: var(--dark-bg);
}

.user-actions {
  position: absolute;
  top: 10px;
  right: 10px;
}

.chat-content {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-scroll-wrapper {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.chat-scrollable {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
}

.welcome-text {
  font-size: 28px;
  transition: opacity 0.7s ease-in;
  user-select: none;
  margin: 0;
  margin-top: calc(30dvh + 25px);
  text-align: center;
}

.message-wrapper {
  display: flex;
  width: 100%; 
  margin-bottom: 1rem; 
}

.message-wrapper[data-user="user"] {
  align-items: flex-end;
  flex-direction: column;
}

.message-wrapper[data-user="assistant"] {
  align-items: flex-start;
  flex-direction: column; 
}

.chat-message {
  padding-left: 1.2rem;
  padding-right: 1.2rem;
  padding-top: .75rem;
  padding-bottom: 0.75rem;
  width: auto;
  word-wrap: break-word;
  color: var(--text-color); 
}

.message-wrapper[data-user="user"] .chat-message {
  max-width: 75%;
  border-radius: 8px;
  background-color: #121212;
  white-space: pre-wrap;
}

.message-wrapper[data-user="assistant"] .chat-message {
  width: 100%;
  background: none;
  border: none;
}

.chat-message table {
  border-collapse: separate;
  border:none;
  border-spacing: 0;
  width: 100%;
  --radius-border: 8px;
}

.chat-message table td, table th {
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: left;
  font-size: .8rem;
  padding: 8px;
}

.chat-message th {
  background-color: #121212;
}

.chat-message table td  {
  border-top: none;
}

.chat-message table tr:last-child td:first-child{
  border-bottom-left-radius: var(--radius-border);
}

.chat-message table tr:last-child td:last-child {
  border-bottom-right-radius: var(--radius-border);
}

.chat-message table tr:first-child th:first-child {
  border-top-left-radius: var(--radius-border);
}

.chat-message table tr:first-child th:last-child {
  border-top-right-radius: var(--radius-border);
}

.chat-message table tr th:not(:last-child),
.chat-message table tr td:not(:last-child) {
  border-right: none;
}



.chat-input-container {
  position: relative;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  padding: 10px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-input {
  width: 100%;
  padding: 0.5rem;
  border-radius: 4px;
  background-color: inherit;
  color: var(--text-color);
  font-size: 16px;
  font-family: inherit;
  height: auto;
  /*min-height: 40px;*/
  max-height: 600px;
  /*line-height: 1.5;*/
  overflow-y: auto;
  resize: none;
  outline: none;
  box-sizing: border-box;
}

.chat-input::placeholder {
  color: #848a99;
}

.chat-input:focus {
  outline: none;
}

.chat-input-actions {
  display: flex;
  justify-content: space-between;
}

.chat-input-actions .btn-round {
  border-radius: 9999px;
  width: 32px;
  padding: 0;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: white;
  border: none;
}

[data-id="send-button"]:disabled,
[data-id="attach-files"]:disabled {
  opacity: 0.5;
}

[data-id="send-button"]:not(:disabled),
[data-id="attach-files"]:not(:disabled) {
  opacity: 1;
  cursor: pointer;
}

.footer {
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
  background-color: inherit;
  flex-shrink: 0;
  margin-bottom: 12px;
}

.legal {
  margin-top: 10px;
  text-align: center;
}

.legal a{
  color: #ccc;
  text-decoration: underline;
}

.legal a:hover {
  color: #fff;
}

.help-btn {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  bottom: 16px;
  right: 16px;
  width: 1.5rem;
  height: 1.5rem;
  font-size: .75rem;
  color: var(--text-color);
  border: 1px solid;
  border-radius: 50%;
  cursor: pointer;
}

.text-success {
  color: #28a745;
}

.d-none {
  display: none !important;
}

/* Avatar styles */
.avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  cursor: pointer;
}

.avatar-circle:hover {
  outline: 3px solid #333333;
}

/* Popover menu */
.popover-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  background-color: #121212;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.25);
  padding: 8px;
  min-width: 200px;
  z-index: 1000;
}

.popover-menu.chat-options {
  max-width: 200px;
}

.popover-menu.show {
  display: block;
}

.popover-menu .popover-item {
  padding: 10px 15px;
  color: #ffffff;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
  display: flex;
  align-items: center;
  cursor: pointer;
  gap: 10px;
}

.popover-menu .popover-item:hover {
  background-color: #333333;
}

.popover-menu .popover-item i {
  font-size: 16px;
}

.avatar-circle:focus {
  outline: none;
}

/* Code snippets */
.code-card {
  background-color: #000;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.code-snippet {
  background-color: #000;
  color: #cbd5e1;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
}

.code-header {
  display: flex;
  height: 45px;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  background-color: #000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px 8px 0 0;
  color: #fff;
}

.copy-button {
  background: none;
  border: none;
  color: #b4b4b4;
  font-size: 0.9rem;
  cursor: pointer;
}

.copy-button:hover {
  color: #fff;
}

pre {
  margin: 0;
  /*padding: 1rem;*/
  overflow-x: auto;
  white-space: pre;
}

code {
  display: inline-block;
  background-color: transparent;
  color: inherit;
  padding: 0;
  margin: 0;
  font-size: inherit;
  border-radius: 0;
  white-space: pre;
  font-family: 'Courier New', Courier, monospace;
}

/* File uploade (beta) */
.file-preview {
  display: flex;
  gap: 10px;
  padding: 0.5rem;
  flex-wrap: wrap;
}

.preview-item {
  position: relative;
  display: inline-block;
}

.preview-item img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 16px;
  display: block;
}

.remove-btn {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #fff;
  color: #333;
  border: none;
  -webkit-border-radius: 50%;
  -moz-border-radius: 50%;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* Tooltips */
.tooltip {
  position: absolute;
  background-color: #121212;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-color);
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 14px;
  white-space: nowrap;
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tooltip.show {
  opacity: 1;
}

.tooltip::after {
  content: '';
  position: absolute;
  border-style: solid;
}

.tooltip[data-position='top']::after {
  border-width: 6px 6px 0 6px;
  border-color: #121212 transparent transparent transparent;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
}

.tooltip[data-position='right']::after {
  border-width: 6px 6px 6px 0;
  border-color: transparent #121212 transparent transparent;
  left: -6px;
  top: 50%;
  transform: translateY(-50%);
}

.tooltip[data-position='bottom']::after {
  border-width: 0 6px 6px 6px;
  border-color: transparent transparent #121212 transparent;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
}

.tooltip[data-position='left']::after {
  border-width: 6px 0 6px 6px;
  border-color: transparent transparent transparent #121212;
  right: -6px;
  top: 50%;
  transform: translateY(-50%);
}

/* Placeholders */
/* Shared shimmer style */
.shimmer {
  position: relative;
  overflow: hidden;
  background: #2a2f3b;
}

/* Shimmer animation */
.shimmer::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  height: 100%;
  width: 150%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
  animation: shimmer 1.5s infinite linear;
}

/* Placeholder blocks */
.placeholder-title {
  height: 12px;
  width: 30%;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.placeholder-line {
  height: .875rem;
  width: 95%;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.placeholder-line-short {
  height: .875rem;
  width: 60%;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.placeholder-box {
  height: 10rem;
  width: 100%;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

@keyframes shimmer {
  0% {
    left: -150%;
  }
  100% {
    left: 150%;
  }
}

/* Responsive Design */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    /*height: 100vh;*/
    background-color: var(--dark-bg);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .chat-input-container {
    max-width: 95%;
  }

  .chat-message table {
    font-size: 14px;
  }

  .chat-message td,
  .chat-message th {
    padding: 8px;
  }

  p.small {
    font-size: 10px;
  }

}


.chat-session-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chat-title {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 0.5rem;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.chat-options-button {
  opacity: 0;
  position: relative;
  z-index: 1001;
  cursor: pointer;
}

.chat-options-button.visible {
  opacity: 1;
  pointer-events: auto;
}

.chat-session-item:hover .chat-options-button {
  opacity: 1;
}

/* Modal Overlays */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.modal-overlay .modal-box {
  background: #1e1e1e;
  color: #fff;
  padding: 16px;
  border-radius: 12px;
  max-width: 28rem;
  width: 100%;
}

.modal-overlay .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

.modal-overlay .btn-cancel {
  background: transparent;
  border: 1px solid #555;
  color: #ccc;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 30px;
  user-select: none;
}
.modal-overlay .btn-cancel:hover {
  background: #333;
  color: #fff;
  border-color: #666;
}

.modal-overlay .btn-delete {
  background: #e06666;
  border: none;
  color: white;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 30px;
  user-select: none;
}
.modal-overlay .btn-delete:hover {
  background: #cc5555;
}

.modal-overlay .note {
  font-size: 0.85em;
  margin-top: 10px;
  color: #aaa;
}

.modal-overlay .note a {
  color: #fff;
}

.message-images {
  margin-bottom: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-image {
  border-radius: 8px;
  max-width: calc(var(--spacing) * 64);
  object-fit: cover;
}

.hljs {
    background: #111113 !important;
}