html, body {
  height: 100%;
  margin: 0;
  overflow: hidden; /* Prevent body scrolling */
}

:root {
  --terminal-color: #00FF00;
  --input-bg: rgba(0, 255, 0, 0.1);
  --input-bg-hover: rgba(0, 255, 0, 0.2);
  --terminal-shadow: rgba(0, 255, 0, 0.2);
  --terminal-glow: rgba(0, 255, 0, 0.1);
  --copy: #0f9550;

  /* Transition properties */
  transition: --terminal-color 0.2s ease,
              --input-bg 0.2s ease,
              --terminal-shadow 0.2s ease,
              --terminal-glow 0.2s ease,
              --copy 0.2s ease;
}
  
  
  *, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
  }
  
  body {
    background-color: #000;
    font-family: 'Roboto Mono', monospace;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}
  
  /* Terminal container */
  .terminal {
    height: 100%;
    background-color: #0C0C0C;
    border: 2px solid var(--terminal-color);
    border-radius: 5px;
    height: 100%;
    color: var(--terminal-color);
    padding: 10px;
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 20px var(--terminal-shadow);
    position: relative;
    transition: border-color 0.2s ease,
                box-shadow 0.2s ease;
  }
  
  .terminal-header {
    position: relative;
    border-bottom: 1px solid var(--terminal-color);
    padding: 10px;
    margin-bottom: 10px;
    font-size: 1.2em;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--terminal-color);
    transition: border-color 0.2s ease,
                color 0.2s ease;
  }

  .terminal-output,
.terminal-input-line,
.prompt,
input,
textarea#input {
    transition: color 0.2s ease,
                background-color 0.2s ease;
}
  
  /* Theme button */
  .theme-button {
    position: absolute;
    top: 38%;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    font-size: 20px;
    z-index: 1000;
  }
  
  .theme-button.amber {
    right: 40px;
    color: #FFB000;
  }
  
  .theme-button.green {
    right: 10px;
    color: #00FF00;
  }

  .theme-button.save {
    right: 100px; /* Adjust this value to properly position the save button */
    color: var(--terminal-color);
}

.theme-button.save:hover {
    opacity: 0.8;
}

/* Update history button position */
.theme-button.history {
    right: 70px;
}
  
  /* Terminal output area 

  .elka-response.streaming {

}
  
*/

  .terminal-output {
    flex-grow: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    padding: 10px;
    font-size: 14px;
    line-height: 1.4;
    white-space: pre-wrap;
    scrollbar-width: thin;
    scrollbar-color: var(--terminal-color) #0C0C0C;
    color: var(--terminal-color);
    min-height: 0;
  }
  
  .terminal-output::-webkit-scrollbar {
    width: 8px;
  }
  
  .terminal-output::-webkit-scrollbar-track {
    background: #0C0C0C;
  }
  
  .terminal-output::-webkit-scrollbar-thumb {
    background: var(--terminal-color);
    border-radius: 4px;
  }
  
  /* Terminal input line */
  .terminal-input-line {
    display: flex;
    align-items: flex-start;
    padding: 5px 10px;
    background-color: var(--input-bg);
    border-radius: 3px;
    position: relative;
  }

  #hiddenInput {
    position: absolute;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* Visible input area with custom cursor */
#visible-input {
  flex: 1;
  min-height: 20px;
  color: var(--terminal-color);
  font-family: 'Roboto Mono', monospace;
  font-size: 16px;
  line-height: 1.4;
  white-space: pre-wrap;
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  outline: none;
}

/* Custom selection styling */
::selection {
  background: var(--terminal-color);
  color: #000;
}

::-moz-selection {
  background: var(--terminal-color);
  color: #000;
}

/* Custom cursor styling */
.cursor {
  display: inline-block;
  width: 10px;
  height: 1.2em;
  margin-bottom: 2px;
  margin-left: 2px;
  background: var(--terminal-color);
  vertical-align: bottom;
  animation: blinkCursor 0.6s steps(1) infinite;
}

@keyframes blinkCursor {
  50% { opacity: 0; }
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #visible-input {
      font-size: 16px;
  }
}
  
  .prompt {
    margin-right: 10px;
    color: var(--terminal-color);
    font-weight: bold;
    font-family: 'VT323', monospace;
    font-size: 16px;
    padding-top: 2px;
  }
  
  input,
  textarea#input {
    background: transparent;
    border: none;
    color: var(--terminal-color);
    font-family: 'VT323', monospace;
    font-size: 16px;
    width: 100%;
    outline: none;
    caret-color: var(--terminal-color);
    resize: none;
    overflow: hidden;
    min-height: 20px;
  }
  
  textarea#input {
    line-height: 1.4;
    padding: 0;
    margin: 0;
    display: block;
    vertical-align: top;
    -webkit-appearance: none;
    appearance: none;
  }
  
  textarea#input::-webkit-scrollbar {
    display: none;
  }
  
  textarea#input {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }
  
  input:disabled {
    opacity: 0.5;
  }
  
  /* Message styling */
  .user-input,
  .elka-response,
  .error-message,
  .system-message {
    margin: 5px 0;
    padding: 3px 0;
  }
  
  .user-input,
  .elka-response {
    color: var(--terminal-color);
  }
  
  .elka-response {
    animation: fadeIn 0.3s ease-in;
  }

  .elka-response::before {
    content: ">";
    color: var(--terminal-color);
    margin-right: 5px;
    font-weight: bold;
}
  
  .error-message {
    color: #FF0000;
  }
  
  .system-message {
    color: #FFFF00;
    font-style: italic;
  }

  /* History */

  .theme-button.history {
    position: absolute;
    top: 18px;
    right: 70px;
    transform: translateY(-50%);
    cursor: pointer;
    user-select: none;
    font-size: 16px;
    color: var(--terminal-color);
    z-index: 1000;
}

.history-sidebar {
  position: fixed;
  top: 0;
  right: -300px;
  width: 300px;
  height: calc(100% - 100px);
  background: #0C0C0C;
  border-left: 2px solid var(--terminal-color);
  transition: right 0.3s ease;
  z-index: 999;
  margin-top: 78px;
  margin-right: 22px;
  visibility: hidden;
  opacity: 0;
  transition: right 0.3s ease, visibility 0.3s ease, opacity 0.3s ease;
}

.history-sidebar.active {
  right: 0;
  visibility: visible;
  opacity: 1;
}

.sidebar-header {
  padding: 15px;
  font-size: 1.2em;
  border-bottom: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Style for the close button */
.sidebar-close {
  color: var(--terminal-color);
  cursor: pointer;
  font-size: 24px;
  padding: 0 8px;
  user-select: none;
}

.sessions-list {
    padding: 10px;
    overflow-y: auto;
    height: calc(100% - 50px);
}

.session-item {
  padding: 15px;
  margin: 10px 0;
  border: 1px solid var(--terminal-color);
  cursor: pointer;
  color: var(--terminal-color);
  transition: background-color 0.2s ease;
}

.session-item:hover {
  background-color: var(--input-bg);
}

.session-icon {
  font-size: 20px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.session-icon svg {
  fill: var(--terminal-color);
  width: 24px;
  height: 24px;
}

.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}

.delete-icon {
  fill: var(--terminal-color);
  opacity: 0.7;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.delete-icon:hover {
  opacity: 1;
}

.session-date {
  font-size: 0.9em;
  margin-bottom: 5px;
  color: var(--terminal-color);
  opacity: 0.8;
}

.session-summary {
  font-size: 0.8em;
  color: var(--terminal-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item.error {
  border-color: #ff0000;
  color: #ff0000;
  cursor: default;
}
  
  /* Screen effect overlay */
  .terminal::before {
    content: "";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
      0deg,
      rgba(0, 0, 0, 0.15) 0px,
      rgba(0, 0, 0, 0.15) 1px,
      transparent 1px,
      transparent 2px
    );
    pointer-events: none;
    opacity: 0.3;
  }
  
  /* Glow effect */
  .terminal::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    box-shadow: inset 0 0 50px var(--terminal-glow);
    pointer-events: none;
  }
  
  /* Animations */
  @keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
  }

  /* Copy */
  
  
  /* Draggable Window */
  .draggable-window {
    position: absolute;
    background-color: #0C0C0C;
    border: 2px solid var(--terminal-color);
    min-width: 640px;
    min-height: 360px;
    box-shadow: 0 0 20px var(--terminal-shadow);
    z-index: 1000;
}
  
  .draggable-window.resizing {
    will-change: width, height;
  }
  
  .draggable-window.dragging {
    will-change: transform, left, top;
  }
  
  .window-titlebar {
    background-color: var(--input-bg);
    padding: 8px;
    cursor: move;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--terminal-color);
  }
  
  .window-title {
    color: var(--terminal-color);
    font-size: 0.9em;
    user-select: none;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }
  
  .window-controls {
    display: flex;
    gap: 10px;
  }
  
  .window-control {
    color: var(--terminal-color);
    cursor: pointer;
    user-select: none;
    font-size: 16px;
  }
  
  .youtube-link {
    color: var(--terminal-color);
    text-decoration: none;
    cursor: pointer;
  }
  
  .youtube-link:hover {
    text-decoration: underline;
  }
  
  .window-content {
    position: relative;
    width: 100%;
    height: calc(100% - 37px);
    padding: 10px;
    color: var(--terminal-color);
    overflow: hidden;
    word-wrap: break-word;
    font-family: 'VT323', monospace;
    font-size: 16px;
    line-height: 1.4;
  }
  
  .youtube-container,
  .youtube-player-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: 1;
  }
  
  .youtube-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
  }
  
  .youtube-player {
    width: 100%;
    height: 100%;
    min-height: 360px;
  }
  
  .window-resize-handle {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 20px;
    height: 20px;
    background: transparent;
    border-style: solid;
    border-color: transparent var(--terminal-color) var(--terminal-color) transparent;
    border-width: 2px;
    cursor: se-resize;
    user-select: none;
    z-index: 1;
    transition: border-color 0.2s ease,
    border-width 0.2s ease;
  }
  
  .window-resize-handle.active {
    border-width: 0 9px 9px 0;
  }
  
  .minimized {
    height: auto !important;
    min-height: unset !important;
    border-bottom: none;
  }
  
  .minimized .window-content,
  .minimized .window-resize-handle {
    display: none;
  }
  
  /* Scrollbar styling for window-content */
  .window-content::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  
  .window-content::-webkit-scrollbar-track {
    background: #0C0C0C;
  }
  
  .window-content::-webkit-scrollbar-thumb {
    background-color: var(--terminal-color);
    opacity: 0.5;
  }
  
  .window-content::-webkit-scrollbar-thumb:hover {
    opacity: 1;
  }
  
  .window-content::-webkit-scrollbar-corner {
    background: #0C0C0C;
  }
  
  .window-content {
    scrollbar-width: thin;
    scrollbar-color: var(--terminal-color) #0C0C0C;
  }

  .terminal-link {
    color: var(--terminal-color);
    text-decoration: underline;
}

.terminal-link:hover {
    opacity: 0.8;
}
  
  /* YouTube Results */
  .youtube-results {
    padding: 10px;
  }
  
  .youtube-result {
    margin-bottom: 15px;
    padding: 10px;
    border: 1px solid var(--terminal-color);
    display: flex;
    align-items: center;
    gap: 10px;
  }
  
  .video-number {
    min-width: 25px;
  }
  
  .video-title {
    flex-grow: 1;
  }

  .terminal-output a {
    color: var(--terminal-color);
    text-decoration: underline;
    cursor: pointer;
}

.terminal-output a:hover {
    opacity: 0.8;
}
  
  .youtube-result a {
    color: var(--terminal-color);
    text-decoration: none;
    padding: 5px 10px;
    border: 1px solid var(--terminal-color);
  }
  
  .youtube-result a:hover {
    background-color: var(--terminal-color);
    color: #000;
  }
  
  .play-button {
    background-color: var(--terminal-color);
    color: #000;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    font-family: 'VT323', monospace;
  }
  
  #youtube-player {
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    position: relative;
    display: none;
  }
  
  #youtube-player.active {
    display: block;
  }
  
  #youtube-player iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  
  .loading-state {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s;
    z-index: 2;
  }
  
  .loading-spinner {
    width: 30px;
    height: 30px;
    border: 2px solid var(--terminal-color);
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
  }
  
  .embed-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: var(--terminal-color);
    width: 100%;
    padding: 20px;
  }
  
  .embed-error p {
    font-size: 1.2em;
    margin-bottom: 20px;
    font-family: 'VT323', monospace;
  }
  
  .youtube-redirect {
    display: inline-block;
    padding: 12px 24px;
    border: 2px solid var(--terminal-color);
    color: var(--terminal-color);
    text-decoration: none;
    font-family: 'VT323', monospace;
    font-size: 1.1em;
    transition: all 0.3s ease;
    background: transparent;
    text-transform: uppercase;
    letter-spacing: 1px;
  }
  
  .youtube-redirect:hover {
    background: var(--terminal-color);
    color: #000;
    box-shadow: 0 0 15px var(--terminal-color);
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }

/* Code block styling */
.terminal-output pre {
  position: relative;
  background: #0d1117;
  border-radius: 6px;
  padding: 16px;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--terminal-color);
}

.terminal-output pre code.hljs {
  background: transparent;
  padding: 0;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  line-height: 1.5;
  tab-size: 4;
}

/* Inline code styling */
.terminal-output code:not(pre code) {
  background: rgba(0, 255, 0, 0.1);
  border-radius: 3px;
  padding: 2px 6px;
  font-family: 'Roboto Mono', monospace;
  font-size: 0.9em;
  color: var(--terminal-color);
}

/* Scrollbar styling for code blocks */
.terminal-output pre::-webkit-scrollbar {
  height: 8px;
  background: #0d1117;
}

.terminal-output pre::-webkit-scrollbar-thumb {
  background: var(--terminal-color);
  border-radius: 4px;
}

.terminal-output pre::-webkit-scrollbar-track {
  background: rgba(0, 255, 0, 0.1);
  border-radius: 4px;
}

/* Optional: Add a subtle language indicator */
.terminal-output pre::before {
  content: attr(class);
  position: absolute;
  top: 0;
  right: 0;
  padding: 4px 8px;
  font-size: 12px;
  color: var(--terminal-color);
  background: rgba(0, 255, 0, 0.1);
  border-radius: 0 6px 0 6px;
  opacity: 0.7;
}

.code-block-wrapper {
  position: relative;
  background: #0d1117;
  border-radius: 6px;
  padding: 16px;
  margin: 12px 0;
  overflow-x: auto;
  border: 1px solid var(--terminal-color);
}

.code-block-header {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px;
  border-radius: 4px;
  background: transparent;
  z-index: 1;
}

/* Remove if it exists */
.terminal-output pre::before {
  display: none;
}

.code-language {
  font-size: 12px;
  color: var(--terminal-color);
  opacity: 0.7;
}

.copy-button {
  background: transparent;
  border: none;
  color: var(--terminal-color);
  padding: 2px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.copy-button:hover {
  opacity: 1;
}

.copy-button.copied {
  color: #00ff00;
}

/* Adjust the code block padding to accommodate the header */
.code-block-wrapper code {
  margin-top: 24px;
  display: block;
}

.clock-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  width: 100%;
  background: #0C0C0C;
  padding: 10px;
  position: relative;
  box-sizing: border-box;
}

.digital-time {
  font-size: 1.2em;  /* Reduced from 1.5em */
  margin-bottom: 5px;
  font-family: 'Roboto Mono', monospace;
  color: var(--terminal-color);
}

.location {
  font-size: 0.9em;  /* Reduced from 1em */
  margin-bottom: 2px;
  color: var(--terminal-color);
}

.timezone {
  font-size: 0.7em;  /* Reduced from 0.8em */
  margin-bottom: 10px;
  color: var(--terminal-color);
  opacity: 0.8;
}

.clock-wrapper {
  position: relative;
  width: 30%;  /* Reduced from 60% to 30% */
  padding-bottom: 30%;  /* Match width for square aspect ratio */
  max-width: min(30vh, 30%);  /* Reduced from 60% to 30% */
  margin: 10px auto;
}

.clock {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: 2px solid var(--terminal-color);
  border-radius: 50%;
}

.hand {
  position: absolute;
  bottom: 50%;
  left: 50%;
  transform-origin: bottom;
  border-radius: 4px;
  width: 4px;
  height: 40%;
  background: var(--terminal-color);
}

.hand.hour {
  height: 25%;
  width: 6px;
}

.hand.minute {
  height: 35%;
  width: 4px;
}

.hand.second {
  height: 40%;
  width: 2px;
}

.hour-marker {
  position: absolute;
  width: 6px;
  height: 10px;
  background: var(--terminal-color);
  transform-origin: center;
}

.center-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  background: var(--terminal-color);
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

/* Terminal Alert Styles */
.terminal-alert-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.terminal-alert-overlay.active {
  opacity: 1;
  visibility: visible;
}

.terminal-alert {
  background: #0C0C0C;
  border: 2px solid var(--terminal-color);
  padding: 20px;
  min-width: 300px;
  max-width: 90%;
  box-shadow: 0 0 20px var(--terminal-shadow);
  position: relative;
  animation: alertSlideIn 0.3s ease;
}

.terminal-alert-content {
  color: var(--terminal-color);
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  margin-bottom: 20px;
  line-height: 1.4;
}

.terminal-alert-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.terminal-alert-button {
  background: transparent;
  border: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  padding: 8px 16px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.terminal-alert-button:hover {
  background: var(--terminal-color);
  color: #000;
}

.terminal-alert-button.primary {
  background: var(--terminal-color);
  color: #000;
}

.terminal-alert-button.primary:hover {
  opacity: 0.9;
}

@keyframes alertSlideIn {
  from {
      transform: translateY(-20px);
      opacity: 0;
  }
  to {
      transform: translateY(0);
      opacity: 1;
  }
}
  
@media (max-width: 768px) {
  body {
    height: 100vh;
    /* Use viewport height units */
    height: 100dvh; /* Dynamic viewport height - modern browsers */
    padding: 5px;
    position: fixed; /* Prevent mobile browser chrome from affecting layout */
    width: 100%;
}

.terminal {
  height: 100%;
  display: flex;
  flex-direction: column;
}

  .terminal-header {
    font-size: 1.1em;
    padding: 8px 5px;
    flex-shrink: 0; /* Prevent header from shrinking */
  }

  .terminal-output {
    flex: 1;
    font-size: 16px; /* Increase font size for better readability */
    line-height: 1.5;
    overflow-y: auto;
        min-height: 0;
        padding: 8px 5px;
  }

  .terminal-input-line {
    flex-shrink: 0; /* Prevent input from shrinking */
    padding: 8px 5px;
    margin-top: auto; /* Push to bottom */
    position: relative;
    width: 100%;
    background-color: var(--input-bg);
}

  .prompt {
    font-size: 18px; /* Larger prompt for better visibility */
  }

  textarea#input {
    font-size: 16px; /* Prevent zoom on mobile when focusing input */
    line-height: 1.4;
    padding: 2px 0;
  }

  /* Adjust YouTube container for mobile */
  .draggable-window {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    min-width: unset;
    min-height: unset;
    transform: none !important;
  }

  /* Adjust code blocks for mobile */
  .terminal-output pre {
    padding: 12px 8px;
    font-size: 14px;
    white-space: pre-wrap;
  }

  .terminal-output pre code.hljs {
    font-size: 14px;
    word-break: break-word;
  }

  .code-block-header {
    position: relative;
    top: 0;
    right: 0;
    margin-bottom: 8px;
  }

  /* Adjust theme buttons position */
  .theme-button {
    font-size: 14px; /* Make buttons slightly smaller */
    padding: 4px;   /* Reduce padding */
}

  .theme-button.amber {
    right: 30px;
    color: #FFB000;
  }

  .theme-button.green {
    right: 8px;
    color: #00FF00;
  }

  /* Sidebar */

  .history-sidebar {
    top: 0;
    right: -100%;
    width: 100%;
    height: 100%;
    margin: 0;
    border-left: none;
    z-index: 1001; /* Ensure it's above other mobile elements */
}

.history-sidebar.active {
    right: 0;
    visibility: visible;
    opacity: 1;
}

.sidebar-header {
  padding: 15px;
  font-size: 1.1em;
  position: sticky;
  top: 0;
  background: #0C0C0C;
  z-index: 2;
}

.sidebar-close {
  min-height: 44px;
  min-width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: static; /* Remove absolute positioning */
  top: auto;
  right: auto;
}

.sessions-list {
    padding: 10px;
    height: calc(100% - 50px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.session-item {
    padding: 12px;
    margin: 8px 0;
    border: 1px solid var(--terminal-color);
}

.session-header {
    flex-wrap: wrap;
    gap: 8px;
}

.session-date {
    font-size: 0.85em;
    width: 100%;
}

.delete-icon {
    padding: 8px;
    min-height: 44px; /* Better touch target */
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-button.save {
  right: 90px;
}

.theme-button.history {
  right: 60px;
}

/* Add close button for mobile */
.sidebar-close {
    position: absolute;
    right: 15px;
    color: var(--terminal-color);
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.terminal-alert {
  width: 90%;
  max-width: none;
  margin: 20px;
}

.terminal-alert-buttons {
  flex-direction: column;
}

.terminal-alert-button {
  width: 100%;
  padding: 12px;
  margin: 5px 0;
  min-height: 44px;
}
}

/* Add specific styles for very small screens */
@media (max-width: 380px) {
  .terminal-output {
    font-size: 14px;
  }

  textarea#input {
    font-size: 14px;
  }

  .terminal-header {
    font-size: 1em;
  }

  .session-summary {
    font-size: 0.75em;
}

.session-date {
    font-size: 0.8em;
}

.sidebar-header {
    font-size: 1em;
    padding: 12px;
}

.theme-button {
  font-size: 12px; /* Even smaller for tiny screens */
}

.theme-button.save {
  right: 80px;
}

.theme-button.history {
  right: 55px;
}

.theme-button.amber {
  right: 30px;
  color: #FFB000;
}

.theme-button.green {
  right: 5px;
  color: #00FF00;
}

}

/* Add viewport-based font scaling */
@media screen and (min-width: 320px) and (max-width: 768px) {
  .terminal-output,
  textarea#input {
    font-size: calc(14px + 2 * ((100vw - 320px) / 448));
  }
}

/* Improve touch targets */
@media (hover: none) and (pointer: coarse) {
  .window-control,
  .copy-button,
  .theme-button {
    padding: 8px;
    min-height: 44px; /* Apple's recommended minimum touch target size */
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* KaTeX styling */
.katex {
  color: var(--terminal-color) !important;
  font-size: 1.1em;
}

.katex-display {
  overflow-x: auto;
  padding: 10px 0;
  margin: 10px 0;
}

.math-error {
  color: #ff0000;
  font-family: monospace;
  padding: 2px 4px;
}

/* Simulation */

.menu-button {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  cursor: pointer;
  z-index: 1000;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-button svg {
  fill: var(--terminal-color);
  width: 20px;
  height: 20px;
}



/* Menu dropdown styling */
.terminal-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: #0C0C0C;
  border: 1px solid var(--terminal-color);
  display: none;
  z-index: 1001;
  min-width: 200px;
}

.terminal-menu.active {
  display: block;
}

.menu-item {
  padding: 12px 20px;
  cursor: pointer;
  font-size: 0.8em;
  color: var(--terminal-color);
  transition: background-color 0.2s ease;
}

.menu-item:hover {
  background-color: var(--input-bg);
}

/* Simulation window and container styles */
.simulation-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 15px;
}

.simulation-input {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.simulation-textarea {
  width: 100%;
  min-height: 100px;
  background: #0C0C0C;
  border: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  padding: 10px;
  font-family: 'Roboto Mono', monospace;
  resize: vertical;
  font-size: 16px; /* Prevent zoom on mobile */
  outline: none;
  transition: border-color 0.2s ease;
}


.simulation-textarea:focus {
  border: 2px solid var(--terminal-color);
}

.simulation-textarea::placeholder {
  color: var(--terminal-color);
  opacity: 0.5;
}

.simulation-button {
  background: transparent;
  border: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  padding: 12px 16px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  min-height: 44px; /* Better touch target */
}

.simulation-button:hover:not(:disabled) {
  background: var(--terminal-color);
  color: #0C0C0C;
}

.simulation-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.simulation-results {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  font-size: 14px;
  line-height: 1.5;
}

/* Enhanced Todo Styling */
.todo-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  gap: 15px;
  color: var(--terminal-color);
  font-family: 'Roboto Mono', monospace;
}

/* Input section styling */
.todo-input {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--terminal-color);
  background: var(--input-bg);
}

/* Form elements base styling */
.todo-title,
.todo-description,
.todo-date,
.todo-priority {
  width: 100%;
  background: #0C0C0C;
  border: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  padding: 10px;
  outline: none;
  transition: border-color 0.2s ease;
}

/* Input focus states */
.todo-title:focus,
.todo-description:focus,
.todo-date:focus,
.todo-priority:focus {
  border-color: var(--terminal-color);
  box-shadow: 0 0 5px var(--terminal-shadow);
}

/* Placeholder styling */
.todo-title::placeholder,
.todo-description::placeholder {
  color: var(--terminal-color);
  opacity: 0.5;
}

/* Description textarea */
.todo-description {
  min-height: 80px;
  resize: vertical;
  line-height: 1.4;
}

/* Options section */
.todo-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: center;
}

/* Date input styling */
.todo-date {
  -webkit-appearance: none;
  background-color: #0C0C0C;
  background-image: none; /* Remove the static SVG */
  position: relative;
  cursor: pointer;
}

.todo-date::-webkit-calendar-picker-indicator {
  background: none;
  position: absolute;
  right: 10px;
  width: 20px;
  height: 20px;
  cursor: pointer;
}

.todo-date::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.11 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z'/%3E%3C/svg%3E") no-repeat center;
  pointer-events: none;
}

/* Priority select styling */
.todo-priority {
  -webkit-appearance: none;
  appearance: none;
  background-color: #0C0C0C;
  background-image: none; /* Remove the static SVG */
  position: relative;
  cursor: pointer;
  padding-right: 30px; /* Make room for the custom arrow */
}

.todo-priority::after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat center;
  pointer-events: none;
}

/* Custom Select styling */
.custom-select {
  position: relative;
  width: 100%;
  cursor: pointer;
}

.select-selected {
  background: #0C0C0C;
  border: 1px solid var(--terminal-color);
  padding: 10px;
  color: var(--terminal-color);
  position: relative;
}

.select-selected:after {
  content: '';
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid var(--terminal-color);
  transition: transform 0.3s ease;
}

.select-arrow-active .select-selected:after {
  transform: translateY(-50%) rotate(180deg);
}

.select-items {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 99;
  background: #0C0C0C;
  border: 1px solid var(--terminal-color);
  border-top: none;
  max-height: 200px;
  overflow-y: auto;
}

.select-hide {
  display: none;
}

.select-items div {
  padding: 10px;
  color: var(--terminal-color);
  cursor: pointer;
  transition: all 0.2s ease;
}

/* Priority-specific colors */
.select-items div[data-value="high"] {
  color: #ff4444;
}

.select-items div[data-value="medium"] {
  color: #ffaa00;
}

.select-items div[data-value="low"] {
  color: #44ff44;
}

.select-items div:hover {
  background-color: var(--input-bg);
}

/* Custom scrollbar for dropdown */
.select-items::-webkit-scrollbar {
  width: 8px;
}

.select-items::-webkit-scrollbar-track {
  background: #0C0C0C;
}

.select-items::-webkit-scrollbar-thumb {
  background: var(--terminal-color);
  border-radius: 4px;
}

/* Mobile optimization */
@media (max-width: 768px) {
  .select-selected, 
  .select-items div {
      padding: 12px;
      font-size: 16px;
  }

  .select-selected:after {
      border-width: 8px;
  }
}

/* Reminder checkbox container */
.todo-reminder-container {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* Custom checkbox styling */
.todo-reminder {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--terminal-color);
  background: #0C0C0C;
  cursor: pointer;
  position: relative;
}

.todo-reminder:checked {
  background: var(--terminal-color);
}

.todo-reminder:checked::after {
  content: '✓';
  position: absolute;
  color: #0C0C0C;
  font-size: 14px;
  left: 3px;
  top: -1px;
}

/* Add button styling */
.todo-add-button {
  background: transparent;
  border: 1px solid var(--terminal-color);
  color: var(--terminal-color);
  padding: 12px;
  cursor: pointer;
  font-family: 'Roboto Mono', monospace;
  font-size: 14px;
  transition: all 0.2s ease;
  margin-top: 10px;
}

.todo-add-button:hover {
  background: var(--terminal-color);
  color: #0C0C0C;
}

/* Todo list styling */
.todo-list {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 5px;
}

/* Todo item styling */
.todo-item {
  border: 1px solid var(--terminal-color);
  background: var(--input-bg);
  padding: 12px;
  transition: all 0.2s ease;
}

.todo-item:hover {
  background: var(--input-bg-hover);
}

/* Todo header with checkbox and title */
.todo-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

/* Custom checkbox for todo items */
.todo-header input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 1px solid var(--terminal-color);
  background: #0C0C0C;
  cursor: pointer;
  position: relative;
}

.todo-header input[type="checkbox"]:checked {
  background: var(--terminal-color);
}

.todo-header input[type="checkbox"]:checked::after {
  content: '✓';
  position: absolute;
  color: #0C0C0C;
  font-size: 14px;
  left: 3px;
  top: -1px;
}

/* Todo title styling */
.todo-title {
  flex: 1;
  font-size: 14px;
}

/* Delete button styling */
.todo-delete {
  background: none;
  border: none;
  color: var(--terminal-color);
  font-size: 20px;
  cursor: pointer;
  padding: 0 8px;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.todo-delete:hover {
  opacity: 1;
}

/* Todo details section */
.todo-details {
  padding-left: 30px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

/* Priority and reminder badges */
.todo-badges {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.todo-reminder-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  margin-left: 4px;
}

.todo-reminder-badge svg {
  width: 16px;
  height: 16px;
  fill: var(--terminal-color);
}

.todo-reminder-badge:hover svg {
  opacity: 0.8;
}

.todo-priority-badge {
  padding: 2px 8px;
  font-size: 12px;
  border: 1px solid var(--terminal-color);
  background: rgba(0, 255, 0, 0.1);
  white-space: nowrap;
  align-self: flex-start;
  margin-top: 10px;
  margin-right: 41px;
}

.add-task-icon {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 56px;
  height: 56px;
  background: var(--terminal-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, background-color 0.2s ease;
}

.add-task-icon:hover {
  transform: scale(1.1);
  background: #0C0C0C;
  border: 2px solid var(--terminal-color);
}

.add-task-icon svg {
  fill: #0C0C0C;
  width: 32px;
  height: 32px;
  transition: fill 0.2s ease;
}

.add-task-icon:hover svg {
  fill: var(--terminal-color);
}

/* Priority-specific styling */
.todo-item.high .todo-priority-badge {
  border-color: #ff4444;
  color: #ff4444;
}

.todo-item.medium .todo-priority-badge {
  border-color: #ffaa00;
  color: #ffaa00;
}

.todo-item.low .todo-priority-badge {
  border-color: #44ff44;
  color: #44ff44;
}

/* Completed todo styling */
.todo-item.completed {
  opacity: 0.6;
}

.todo-item.completed .todo-title {
  text-decoration: line-through;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
  .todo-container {
      padding: 10px;
  }

  .todo-input {
      padding: 12px;
  }

  .todo-options {
      grid-template-columns: 1fr;
  }

  .todo-title,
  .todo-description,
  .todo-date,
  .todo-priority,
  .todo-add-button {
      font-size: 16px;
      padding: 12px;
      height: 44px;
  }

  .todo-description {
      height: auto;
      min-height: 88px;
  }

  .todo-reminder-container {
      height: 44px;
      padding: 0 12px;
  }

  .todo-reminder-badge svg {
    width: 20px;
    height: 20px;
}

  .todo-delete {
      padding: 12px;
      min-height: 44px;
      min-width: 44px;
      display: flex;
      align-items: center;
      justify-content: center;
  }

  .todo-header input[type="checkbox"] {
      width: 24px;
      height: 24px;
  }

  .todo-header input[type="checkbox"]:checked::after {
      font-size: 18px;
      left: 4px;
      top: -2px;
  }

  .add-task-icon {
    width: 48px;
    height: 48px;
    bottom: 16px;
    right: 16px;
}

.add-task-icon svg {
    width: 28px;
    height: 28px;
}
}

/* Small screen optimizations */
@media (max-width: 380px) {
  .todo-container {
      padding: 8px;
  }

  .todo-input {
      padding: 10px;
  }

  .todo-title,
  .todo-description,
  .todo-date,
  .todo-priority {
      font-size: 14px;
  }

  .todo-details {
      padding-left: 20px;
      font-size: 12px;
  }

  .todo-badges {
      flex-wrap: wrap;
  }
}

/* Scrollbar styling */
.todo-list::-webkit-scrollbar {
  width: 8px;
}

.todo-list::-webkit-scrollbar-track {
  background: #0C0C0C;
}

.todo-list::-webkit-scrollbar-thumb {
  background: var(--terminal-color);
  border-radius: 4px;
}

.todo-list::-webkit-scrollbar-thumb:hover {
  background: var(--terminal-color);
  opacity: 0.8;
}

/* Loading and error states */
.loading {
  color: var(--terminal-color);
  padding: 10px;
  border: 1px solid var(--terminal-color);
  margin: 10px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.error {
  color: #ff4444;
  padding: 10px;
  border: 1px solid #ff4444;
  margin: 10px 0;
}

/* Mobile-specific adjustments */
@media (max-width: 768px) {
  /* Ensure menu button is easily tappable */
  .menu-button {
      min-width: 44px;
      min-height: 44px;
  }
  
  /* Full-width menu on mobile */
  .terminal-menu {
      width: 100%;
      border-left: none;
      border-right: none;
  }
  
  /* Larger touch targets in menu */
  .menu-item {
      padding: 15px 20px;
      font-size: 16px;
  }
  
  /* Adjust simulation window for mobile */
  .draggable-window {
      width: 100% !important;
      height: 100% !important;
      top: 0 !important;
      left: 0 !important;
      margin: 0;
      border-radius: 0;
  }
  
  /* Adjust simulation content for mobile */
  .simulation-container {
      padding: 15px;
  }
  
  .simulation-textarea {
      font-size: 16px;
      padding: 12px;
      min-height: 120px;
  }
  
  .simulation-button {
      padding: 15px;
      font-size: 16px;
  }
  
  .simulation-results {
      font-size: 16px;
      padding: 12px;
  }

  .todo-details {
    padding-left: 20px;
}

.todo-content {
    font-size: 14px;
}

.todo-priority-badge {
    padding: 4px 10px;
    font-size: 13px;
}
}

/* Small screen adjustments */
@media (max-width: 380px) {
  .menu-button svg {
      width: 18px;
      height: 18px;
  }
  
  .menu-item {
      padding: 12px 16px;
      font-size: 14px;
  }
  
  .simulation-textarea {
      font-size: 14px;
  }
  
  .simulation-results {
      font-size: 14px;
  }
}

/* Ensure proper spacing when terminal header has other buttons */
.terminal-header {
  position: relative;
  padding-left: 40px; /* Make room for menu button */
}

/* Maintenance mode styles */
.maintenance-mode .theme-button {
  color: var(--terminal-color) !important; /* Ensure color remains visible */
  cursor: not-allowed;
  pointer-events: none;
  /* Remove opacity change to keep buttons visible */
}

.maintenance-mode .menu-button {
  cursor: not-allowed;
  pointer-events: none;
}

.maintenance-mode .terminal-menu {
  display: none;
}

.maintenance-mode .menu-item {
  pointer-events: none;
  cursor: not-allowed;
}

/* Keep specific theme button colors */
.maintenance-mode .theme-button.amber {
  color: #FFB000 !important;
}

.maintenance-mode .theme-button.green {
  color: #00FF00 !important;
}