/*
See the JupyterLab Developer Guide for useful CSS Patterns:

    https://jupyterlab.readthedocs.io/en/stable/developer/css.html
*/


/* Escobar Chat Styles */
.escobar-chat {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--jp-layout-color1);
  color: var(--jp-content-font-color1);
}

/* Settings Page Styles */
.escobar-settings-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.escobar-settings-overlay-visible {
  opacity: 1;
}

.escobar-settings-container {
  background-color: var(--jp-layout-color1);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(-20px);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.escobar-settings-container-visible {
  transform: translateY(0);
  opacity: 1;
}

.escobar-settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 32px;
  border-bottom: 1px solid var(--jp-border-color1);
}

.escobar-settings-header h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 500;
  color: var(--jp-content-font-color1);
}

.escobar-settings-close-button {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--jp-content-font-color2);
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.escobar-settings-close-button:hover {
  color: var(--jp-content-font-color1);
}

.escobar-settings-form {
  padding: 16px 32px;
}

.escobar-settings-group {
  margin-bottom: 16px;
}

.escobar-settings-group label {
  display: block;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--jp-content-font-color1);
}

.escobar-settings-description {
  font-size: 12px;
  color: var(--jp-content-font-color2);
  margin-bottom: 8px;
}

.escobar-settings-input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--jp-border-color1);
  border-radius: 4px;
  background-color: var(--jp-layout-color0);
  color: var(--jp-content-font-color1);
  font-family: var(--jp-content-font-family);
  font-size: 14px;
}

.escobar-settings-input:focus {
  border-color: var(--jp-brand-color1);
  outline: none;
}

.escobar-settings-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-bottom: 8px;
}

.escobar-settings-button {
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  font-family: var(--jp-content-font-family);
}

.escobar-settings-cancel-button {
  background-color: var(--jp-layout-color2);
  color: var(--jp-content-font-color1);
  border: 1px solid var(--jp-border-color1);
}

.escobar-settings-cancel-button:hover {
  background-color: var(--jp-layout-color3);
}

.escobar-settings-save-button {
  background-color: var(--jp-brand-color1);
  color: white;
  border: none;
}

.escobar-settings-save-button:hover {
  background-color: var(--jp-brand-color0);
}

/* Button container for top buttons */
.escobar-button-container {
  display: flex;
  padding: 5px;
  gap: 6px;
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.5);
  border-radius: 4px;
}

/* Icon button styles */
.escobar-icon-button {
  width: 32px;
  height: 32px;
  background-color: transparent;
  color: var(--jp-content-font-color1);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.2s;
  opacity: 1;
}

.escobar-icon-button:hover {
  opacity: 1;
}

.escobar-icon-button:hover .escobar-icon-svg {
  stroke: var(--jp-brand-color1);
}

.escobar-icon-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.escobar-icon-svg {
  width: 20px;
  height: 20px;
  stroke-width: 2;
  stroke: var(--jp-content-font-color1);
}

/* Specific button styles */
.escobar-new-chat-button .escobar-icon-svg {
  stroke: var(--jp-brand-color1);
}

.escobar-reconnect-button .escobar-icon-svg {
  stroke: var(--jp-content-font-color2);
}

.escobar-stop-button .escobar-icon-svg {
  stroke: #e74c3c;
}

.escobar-chat-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}

/* Divider styles */
.escobar-divider {
  height: 4px;
  background-color: var(--jp-layout-color2);
  cursor: ns-resize;
  position: relative;
  user-select: none;
}

.escobar-divider::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 30px;
  height: 2px;
  background-color: var(--jp-border-color1);
  border-radius: 1px;
}

.escobar-divider:hover {
  background-color: var(--jp-layout-color3);
}

.escobar-divider:hover::after {
  background-color: var(--jp-brand-color1);
}

.escobar-input-container {
  position: relative;
  display: flex;
  padding: 0;
  margin: 0;
  align-items: stretch;
  flex: 1;
  min-height: 80px;
  overflow: hidden;
}

.escobar-chat-input {
  flex: 1;
  resize: none;
  border: none;
  border-radius: 0;
  padding: 0;
  margin: 0 0 0 0;
  font-family: var(--jp-content-font-family);
  background-color: var(--jp-layout-color0);
  color: var(--jp-content-font-color1);
  height: 100%;
  min-height: 50px;
}

.escobar-send-button {
  position: absolute;
  right: 10px;

  top: 50%;
  transform: translateY(-50%);

  background-color: var(--jp-brand-color1);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
}

.escobar-send-button:hover {
  background-color: var(--jp-brand-color0);
}

.escobar-message {
  padding: 8px;
  border-radius: 8px;
  max-width: 90%;
}

.escobar-message-user {
  align-self: flex-end;
  background-color: var(--jp-layout-color3);
  color: var(--jp-content-font-color1);
}

.escobar-message-assistant {
  align-self: flex-start;
  background-color: transparent;
  color: var(--jp-content-font-color1);
}

/* Add a specific class for light mode user messages */
body[data-jp-theme-light="true"] .escobar-message-user {
  background-color: var(--jp-layout-color2);
}

/* Add a specific class for dark mode user messages */
body[data-jp-theme-light="false"] .escobar-message-user {
  background-color: #3a3a3a;
  /* Lighter than the chat background in dark mode */
}

.escobar-message-content {
  white-space: pre-wrap;
  word-break: break-word;
}


.escobar-split-button {
  position: absolute;
  right: 10px;
  bottom: 10px;
  _transform: translateY(-50%);
  display: inline-flex;
  font-family: var(--jp-content-font-family);
  background-color: transparent;
  z-index: 2000;
}

.escobar-split-button>button {
  padding: 4px;
  border: none;
  background-color: transparent;
  color: var(--jp-content-font-color1);
  cursor: pointer;
  font-size: 13px;
  opacity: 0.7;
  transition: opacity 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.escobar-split-button>button:hover {
  opacity: 1;
}

.escobar-split-button>button:hover .escobar-icon-svg {
  stroke: var(--jp-brand-color1);
}

.escobar-main-button {
  font-weight: 500;
  padding: 4px 8px !important;
}

.escobar-dropdown-toggle {
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.escobar-dropdown-menu {
  position: absolute;
  /* Will be positioned via JS */
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--jp-border-color1);
  background-color: var(--jp-layout-color0);
  display: none;
  min-width: 120px;
  z-index: 9999;
  /* Very high z-index */
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* When appended to body */
body>.escobar-dropdown-menu {
  position: fixed !important;
  z-index: 99999 !important;
  background-color: var(--jp-layout-color0) !important;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4) !important;
  border: 1px solid var(--jp-border-color1) !important;
  border-radius: 4px !important;
  min-width: 100px !important;
  width: auto !important;
}

body>.escobar-dropdown-menu li {
  list-style: none !important;
}

.escobar-dropdown-menu li button {
  width: 100%;
  padding: 8px 12px;
  border: none;
  background-color: transparent;
  color: var(--jp-content-font-color1);
  cursor: pointer;
  text-align: left;
  font-size: 13px;
}

.escobar-dropdown-menu li button:hover {
  background-color: var(--jp-layout-color2);
  color: var(--jp-brand-color1);
}