@import url("https://fonts.googleapis.com/css2?family=Roboto+Mono:ital,wght@0,100..700;1,100..700&family=Rubik:ital,wght@0,300..900;1,300..900&display=swap");

/* Add box-sizing globally for better cross-browser consistency */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  /* Dark mode */
  --color-background-dark: #131313;
  --color-text-dark: #ffffff;
  --color-text-muted-dark: #d4d4d4e4;
  --color-primary-dark: #737a81;
  --color-secondary-dark: #656565;
  --color-accent-dark: #cf6679;
  --color-message-bg-dark: #2d2d2d;
  --color-highlight-dark: #2b5ab9;
  --color-message-text-dark: #e0e0e0;
  --color-panel-dark: #1a1a1a;
  --color-border-dark: #444444a8;
  --color-input-dark: #131313;
  --color-input-focus-dark: #101010;
  --color-chat-background-dark: #212121;
  --color-error-text-dark:#e72323;
  --color-warning-text-dark:#e79c23;
  --color-table-row-dark: #272727;

  /* Light mode */
  --color-background-light: #fafafa;
  --color-text-light: #333333;
  --color-text-muted-light: #333333e4;
  --color-primary-light: #384653;
  --color-secondary-light: #e8eaf6;
  --color-accent-light: #b00020;
  --color-message-bg-light: #ffffff;
  --color-highlight-light: #2563eb;
  --color-message-text-light: #333333;
  --color-panel-light: #f0f0f0;
  --color-border-light: #bdbdbdcf;
  --color-input-light: #e4e4e4;
  --color-input-focus-light: #dadada;
  --color-chat-background-light: #fafafa;
  --color-error-text-light:#920000;
  --color-warning-text-light:#936214;
  --color-table-row-light: #edededf3;


  /* Default to dark mode */
  --color-background: var(--color-background-dark);
  --color-text: var(--color-text-dark);
  --color-text-muted: var(--color-text-muted-dark);
  --color-primary: var(--color-primary-dark);
  --color-secondary: var(--color-secondary-dark);
  --color-accent: var(--color-accent-dark);
  --color-message-bg: var(--color-message-bg-dark);
  --color-highlight: var(--color-highlight-dark);
  --color-message-text: var(--color-message-text-dark);
  --color-panel: var(--color-panel-dark);
  --color-border: var(--color-border-dark);
  --color-input: var(--color-input-dark);
  --color-input-focus: var(--color-input-focus-dark);
  --color-background-hover: color-mix(in srgb, var(--color-border) 50%, transparent);
  --color-chat-background: var(--color-chat-background-dark);
  --color-error-text:var(--color-error-text-dark);
  --color-warning-text:var(--color-warning-text-dark);
  --color-table-row: var(--color-table-row-dark);

  /* Spacing variables */
  --spacing-xxs: 0.15rem;
  --spacing-xs: 0.3125rem;
  --spacing-sm: 0.625rem;
  --spacing-md: 1.25rem;
  --spacing-lg: 2rem;

  /* Font sizes */
  --font-size-xs: 0.7rem;
  --font-size-small: 0.8rem;
  --font-size-smaller: 0.9rem;
  --font-size-normal: 1rem;
  --font-size-large: 1.2rem;

  /* Font families */
  --font-family-main: "Rubik", Arial, Helvetica, sans-serif;
  --font-family-code: "Roboto Mono", monospace;

  /* Other variables */
  --border-radius: 1.125rem;
  --border-radius-sm: 0.5rem;
  --transition-speed: 0.3s;
  --svg-filter: brightness(0) saturate(100%) var(--color-primary-filter);
  --color-primary-filter: invert(73%) sepia(17%) saturate(360%)
    hue-rotate(177deg) brightness(87%) contrast(85%);
}

/* Light mode class */
.light-mode {
  --color-background: var(--color-background-light);
  --color-text: var(--color-text-light);
  --color-text-muted: var(--color-text-muted-light);
  --color-primary: var(--color-primary-light);
  --color-secondary: var(--color-secondary-light);
  --color-accent: var(--color-accent-light);
  --color-message-bg: var(--color-message-bg-light);
  --color-message-text: var(--color-message-text-light);
  --color-panel: var(--color-panel-light);
  --color-border: var(--color-border-light);
  --color-input: var(--color-input-light);
  --color-input-focus: var(--color-input-focus-light);
  --color-background-hover: color-mix(in srgb, var(--color-border) 50%, transparent);
  --color-chat-background: var(--color-chat-background-light);
  --color-error-text:var(--color-error-text-light);
  --color-warning-text:var(--color-warning-text-light);
  --color-table-row: var(--color-table-row-light);
} 


/* Reset and Base Styles */
body,
html {
  background-color: var(--color-background);
  color: var(--color-text);
  font-family: var(--font-family-main);
  width: 100%;
  height: 100%;
  min-width: 320px !important;
  min-height: 370px !important;
  margin: 0;
  padding: 0;
  overflow: hidden;
  position: fixed;
  -webkit-font-smoothing: antialiased; /* Improve font rendering */
  -moz-osx-font-smoothing: grayscale; /* Improve font rendering */
}

body {
  overscroll-behavior: none;
  -webkit-overscroll-behavior: none;
}

p:last-child {
  margin-bottom: 0;
}

body,
#chat-input,
.message,
.config-button,
.switch-label {
  -webkit-transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  transition: background-color 0.3s, color 0.3s, border-color 0.3s;
  color: var(--color-text) !important;
}

/* Bootstrap-like tooltips */
.tooltip {
  position: absolute;
  /* Above custom modals (base z-index: 3000 in `webui/js/modals.js`) */
  z-index: 5000;
  display: block;
  margin: 0;
  font-family: var(--font-family-main);
  font-style: normal;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  word-break: normal;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-in-out;
}

.tooltip.show {
  opacity: 1;
}

.tooltip .tooltip-inner {
  max-width: 240px;
  padding: 0.35rem 0.6rem;
  color: var(--color-text);
  background-color: var(--color-secondary);
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 0.75rem;
}

.tooltip .tooltip-arrow {
  position: absolute;
  width: 0.8rem;
  height: 0.4rem;
}

.tooltip .tooltip-arrow::before {
  content: "";
  position: absolute;
  border-color: transparent;
  border-style: solid;
}

.bs-tooltip-top .tooltip-arrow {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.bs-tooltip-top .tooltip-arrow::before {
  border-width: 0.4rem 0.4rem 0;
  border-top-color: var(--color-secondary);
  top: 0;
}

.bs-tooltip-bottom .tooltip-arrow {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.bs-tooltip-bottom .tooltip-arrow::before {
  border-width: 0 0.4rem 0.4rem;
  border-bottom-color: var(--color-secondary);
  top: 0;
}

.bs-tooltip-start .tooltip-arrow,
.bs-tooltip-left .tooltip-arrow {
  right: 0;
  top: 50%;
  width: 0.4rem;
  height: 0.8rem;
  transform: translateY(-50%);
}

.bs-tooltip-start .tooltip-arrow::before,
.bs-tooltip-left .tooltip-arrow::before {
  border-width: 0.4rem 0 0.4rem 0.4rem;
  border-left-color: var(--color-secondary);
  left: 0;
}

.bs-tooltip-end .tooltip-arrow,
.bs-tooltip-right .tooltip-arrow {
  left: 0;
  top: 50%;
  width: 0.4rem;
  height: 0.8rem;
  transform: translateY(-50%);
}

.bs-tooltip-end .tooltip-arrow::before,
.bs-tooltip-right .tooltip-arrow::before {
  border-width: 0.4rem 0.4rem 0.4rem 0;
  border-right-color: var(--color-secondary);
  right: 0;
}

/* Bootstrap-like tooltips */
.tooltip {
  position: absolute;
  /* Above custom modals (base z-index: 3000 in `webui/js/modals.js`) */
  z-index: 5000;
  display: block;
  margin: 0;
  font-family: var(--font-family-main);
  font-style: normal;
  font-weight: 400;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  text-shadow: none;
  text-transform: none;
  letter-spacing: normal;
  word-break: normal;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.08s ease-in-out;
}

.tooltip.show {
  opacity: 1;
}

.tooltip .tooltip-inner {
  max-width: 240px;
  padding: 0.35rem 0.6rem;
  color: var(--color-text);
  background-color: var(--color-secondary);
  border-radius: 0.375rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
  font-size: 0.75rem;
}

.tooltip .tooltip-arrow {
  position: absolute;
  width: 0.8rem;
  height: 0.4rem;
}

.tooltip .tooltip-arrow::before {
  content: "";
  position: absolute;
  border-color: transparent;
  border-style: solid;
}

.bs-tooltip-top .tooltip-arrow {
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
}

.bs-tooltip-top .tooltip-arrow::before {
  border-width: 0.4rem 0.4rem 0;
  border-top-color: var(--color-secondary);
  top: 0;
}

.bs-tooltip-bottom .tooltip-arrow {
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.bs-tooltip-bottom .tooltip-arrow::before {
  border-width: 0 0.4rem 0.4rem;
  border-bottom-color: var(--color-secondary);
  top: 0;
}

.bs-tooltip-start .tooltip-arrow,
.bs-tooltip-left .tooltip-arrow {
  right: 0;
  top: 50%;
  width: 0.4rem;
  height: 0.8rem;
  transform: translateY(-50%);
}

.bs-tooltip-start .tooltip-arrow::before,
.bs-tooltip-left .tooltip-arrow::before {
  border-width: 0.4rem 0 0.4rem 0.4rem;
  border-left-color: var(--color-secondary);
  left: 0;
}

.bs-tooltip-end .tooltip-arrow,
.bs-tooltip-right .tooltip-arrow {
  left: 0;
  top: 50%;
  width: 0.4rem;
  height: 0.8rem;
  transform: translateY(-50%);
}

.bs-tooltip-end .tooltip-arrow::before,
.bs-tooltip-right .tooltip-arrow::before {
  border-width: 0.4rem 0.4rem 0.4rem 0;
  border-right-color: var(--color-secondary);
  right: 0;
}

img {
  user-drag: none;      /* Safari & old Chrome */
  -webkit-user-drag: none;
  user-select: none;    /* Prevent selection for good measure */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  pointer-events: auto; /* Allow clicks, just no drag */
}

/* Layout */
.container {
  display: -webkit-flex;
  display: flex;
  height: 100%;
}

.panel {
  display: -webkit-flex;
  display: flex;
  height: 100%;
  overflow: auto;
  -webkit-scroll-behavior: smooth;
  scroll-behavior: smooth;
}

/* Right Panel */
#right-panel {
  display: -webkit-flex;
  display: flex;
  width: 100%;
  flex-direction: column;
  flex-grow: 1;
  -webkit-transition: margin-left var(--transition-speed) ease-in-out;
  transition: margin-left var(--transition-speed) ease-in-out;
}

/* Scrollbar styles for right panel */
#right-panel.expanded {
  margin-left: 0;
}
div#right-panel::-webkit-scrollbar {
  width: 6px;
}
div#right-panel::-webkit-scrollbar-track {
  background: transparent;
}
div#right-panel::-webkit-scrollbar-thumb {
  background-color: rgba(155, 155, 155, 0.3);
  border-radius: 6px;
}
div#right-panel::-webkit-scrollbar-thumb:hover {
  background-color: rgba(155, 155, 155, 0.5);
}

#time-date-container {
  z-index: 1000;
  position: fixed;
  right: var(--spacing-md);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-md);
}

#time-date {
  color: var(--color-text);
  text-align: right;
  line-height: 1.2;
}

#user-date {
  font-size: 0.7rem;
  opacity: 0.5;
  font-weight: 400;
  display: block;
  margin-top: 2px;
}

/* Typography */
/* h2,
h3 {
  color: var(--color-primary);
} */

/* h2 {
  margin-bottom: var(--spacing-sm);
  margin-top: var(--spacing-lg);
}

h3 {
  margin-bottom: var(--spacing-sm);
}

h4 {
  margin: auto 0;
} */


/* Preview section with unified tile system */
.preview-section {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 10px;
  padding: var(--spacing-sm);
  transition: all 0.3s ease;
  border-radius: 8px;
  margin-bottom: var(--spacing-xs);
  max-height: 10em;
  overflow-y: auto;
}


.preview-item {
  position: relative;
  width: 120px;
  height: 120px;
  /* background-color: var(--color-background); */
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  animation: fadeIn 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.preview-item.image-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 10px;
}

.preview-item.file-preview {
  flex-direction: column;
  padding: 12px;
  text-align: center;
}

.preview-item.file-preview .file-icon {
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: 0.1rem;
}

.preview-item.file-preview .file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

.preview-item.file-preview .filename {
  font-size: 0.75rem;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.preview-item.file-preview .extension {
  background: var(--color-primary);
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.remove-attachment {
  position: absolute;
  top: 0.1em;
  right: 0.1em;
  background-color: var(--color-accent);
  color: white;
  border: none;
  border-radius: 50%;
  width: 2em;
  height: 2em;
  /* font-size: 1em; */
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 2;
  opacity: 0;
  transform: scale(0.8);
}

.device-pointer .preview-item:hover .remove-attachment,
.device-pointer .attachment-item:hover .remove-attachment {
  opacity: 1;
  transform: scale(1);
}

.device-touch .remove-attachment {
  opacity: 1 !important;
  transform: scale(1.25) !important;
  /* font-size: 1.5em; */
  top: 0.5em;
  right: 0.5em;
}

.remove-attachment:hover {
  background-color: var(--color-accent-dark);
  transform: scale(1.1) !important;
}

.device-touch .remove-attachment:active {
  transform: scale(1.1) !important;
}

.remove-attachment:active {
  transform: scale(0.9) !important;
}

.image-error {
  border: 1px solid var(--color-error);
  padding: 10px;
  color: var(--color-error);
  border-radius: 4px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-error::before {
  content: "⚠️";
}

/* Config Section */
.config-section > h4 {
  margin-top: 0;
}

.config-list {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

.config-list li {
  align-items: center;
  /* border-top: 1px solid var(--color-border); */
  display: -webkit-flex;
  display: flex;
  justify-content: space-between;
  padding: 0.28rem 0;
}

.config-list > *:first-child {
  border-top: 0px;
}

/* Attachment icon */
.attachment-wrapper {
  position: relative;
  flex-shrink: 0;
}

.attachment-icon {
  cursor: pointer;
  color: var(--color-text);
  opacity: 0.7;
  transition: opacity 0.2s ease;
  display: flex;
  align-items: center;
}

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

.attachment-icon:active {
  opacity: 0.5;
}

/* Message attachments with unified tile system */
.attachments-container {
  margin-top: 0.75em;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  padding: var(--spacing-sm);
  /* background-color: var(--color-input); */
  border-radius: 8px;
  overflow: visible;
}

.attachment-item {
  position: relative;
  width: 6rem;
  height: 6rem;
  /* background-color: var(--color-background); */
  border: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-radius: var(--border-radius);
}

.attachment-item:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  transform: translateY(-2px);
}

.light-mode .attachment-item:hover {
  border-color: var(--color-primary-light);
}

/* Image attachment styling */
.attachment-item.image-type {
  padding: 0;
}

.attachment-item.image-type .attachment-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--border-radius);
  background: repeating-linear-gradient(45deg, var(--color-panel) 0 10px, var(--color-chat-background) 10px 20px);

}


/* File attachment styling */
.attachment-item.file-type {
  flex-direction: column;
  padding: 12px;
  text-align: center;
}
 
.attachment-item.file-type .file-icon {
  width: 50%;
  height: 50%;
}
 
.attachment-item.file-type .file-title {
  font-size: 0.75rem;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: center;
  margin-top: auto;
}

/* Chat-history attachments overrides (flat styling) */

#chat-history .attachments-container {
  padding: 0 !important;
}

.attachment-info,
.file-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  width: 100%;
}

.attachment-name,
.filename,
.file-name {
  font-size: 0.75rem;
  color: var(--color-text);
  word-break: break-word;
  line-height: 1.2;
  max-height: 2.4em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-align: center;
}

.attachment-ext,
.extension,
.file-ext {
  background: var(--color-primary);
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Preview section styles */
.preview-section {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  padding: var(--spacing-xs);
}

/* .preview-item {
  position: relative;
  background: var(--color-secondary);
  border-radius: 8px;
  padding: 8px;
  max-width: 200px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s ease;
} */

/* .preview-item.image-preview img {
  max-height: 100px;
  object-fit: cover;
  border-radius: 4px;
} */

.image-wrapper {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 10px;
}

.file-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 12px;
  text-align: center;
}

.extension {
  background: var(--color-primary);
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  text-transform: uppercase;
}

.remove-attachment:hover {
  background-color: var(--color-accent);
  transform: scale(1.1);
}

.remove-attachment:active {
  transform: scale(0.9);
}

/* Error handling */
.image-error {
  border: 1px solid var(--color-error);
  padding: 10px;
  color: var(--color-error);
  border-radius: 4px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}

.image-error::before {
  content: "⚠️";
}

/* Image preview section */
.image-preview-section {
  display: flex;
  gap: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-sm) 0.37rem var(--spacing-sm);
  overflow-x: auto;
  background-color: var(--color-input);
  border-radius: 8px;
  margin-bottom: var(--spacing-xs);
  -webkit-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

.preview-item {
  position: relative;
  flex-shrink: 0;
  padding: 4px;
  animation: fadeIn 0.3s ease;
  min-width: min-content;
  background-color: var(--color-background);
}

.image-preview img {
  max-height: 100px;
  object-fit: cover;
  border-radius: 8px;
  /* border: 1px solid var(--color-border-light); */
}

.file-preview {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.extension {
  background: var(--color-primary);
  color: var(--color-text);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.8em;
  text-transform: uppercase;
}

.remove-image {
  -webkit-transform: scale(1.1);
  transform: scale(1.1);
}

/* Toggle Switch */
.switch {
  display: inline-block;
  height: 1.15rem;
  position: relative;
  width: 2.2rem;
}

.switch input {
  float: right;
  height: 0;
  opacity: 0;
  width: 0;
}

.slider {
  background-color: #272727;
  border: 1px solid #535353;
  border-radius: 1.15rem;
  bottom: 0;
  cursor: pointer;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  -webkit-transition: 0.4s ease-in-out;
  transition: 0.4s ease-in-out;
}

.slider:before {
  background-color: #b6b6b6;
  border-radius: 50%;
  bottom: 0.134rem;
  content: "";
  height: 0.8rem;
  left: 0.15rem;
  position: absolute;
  -webkit-transition: 0.4s ease-in-out;
  transition: 0.4s ease-in-out;
  width: 0.8rem;
}

input:checked + .slider {
  background-color: #3a3a3a;
}

input:checked + .slider:before {
  -webkit-transform: translateX(1rem);
  transform: translateX(1rem);
}

.status-icon {
  display: flex;
  justify-content: center;
  align-items: center;
}

.status-icon svg {
  width: 18px;
  height: 18px;
}

.connected-circle,
.disconnected-circle {
  -webkit-transition: all 0.3s ease;
  transition: all 0.3s ease;
}

.connected-circle {
  animation: heartbeat 1.5s ease-in-out infinite;
  transform-origin: center;
}

.connected {
  color: #00c340;
}

.disconnected {
  color: #e40138;
}

.heartbeat {
  animation: heartbeat 1.5s ease-in-out infinite;
}

.font-bold {
  font-weight: bold;
}


/* Media Queries */
@media (max-width: 640px) {
  /* Responsive tiles for mobile */
  .preview-section {
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    padding: var(--spacing-xs);
  }

  .attachments-container {
    gap: 6px;
    padding: var(--spacing-xs);
  }
/* 
  .preview-item,
  .attachment-item {
    width: 90px;
    height: 90px;
    border-radius: 8px;
  }

  .preview-item.file-preview,
  .attachment-item.file-type {
    padding: 8px;
  }

  .preview-item.file-preview .file-icon,
  .attachment-item.file-type .file-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 4px;
  } */

  /* .preview-item.file-preview .filename,
  .attachment-item.file-type .file-title,
  .attachment-name,
  .filename {
    font-size: 0.65rem;
    -webkit-line-clamp: 1;
  } */

  /* .preview-item.file-preview .extension,
  .attachment-item.file-type .file-extension,
  .attachment-item.image-type .image-badge,
  .attachment-ext,
  .extension {
    font-size: 0.6rem;
    padding: 1px 4px;
  } */

  /* .remove-attachment,
  .remove-image {
    width: 20px;
    height: 20px;
    top: 2px;
    right: 2px;
  } */

  /* .attachment-item.image-type .image-badge {
    bottom: 4px;
    font-size: 0.55rem;
    padding: 1px 6px;
  } */
}

@media (max-width: 640px) {
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0);
    opacity: 0;
    z-index: 1002;
  }

  .sidebar-overlay.visible {
    display: block;
  }
}


@media (max-height: 600px) {
  /* consistent font sizing */
  html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }
}

@media screen and (orientation: landscape) {
  /* lock font size during rotation */
  html {
    -webkit-text-size-adjust: none;
    text-size-adjust: none;
  }
}

/* Link styling */
a {
  color: inherit;
  /* text-decoration: none; */
}

a:visited {
  color: inherit;
}

a:hover {
  color: inherit;
}

a:active {
  color: inherit;
}


.light-mode .connected {
  color: #4caf50;
}

.light-mode .disconnected {
  color: #f44336;
}

.light-mode .slider {
  background-color: #f1f1f1;
  border: 1px solid #dddddd;
}

.light-mode .slider:before {
  background-color: #838383;
}

.light-mode input:checked + .slider {
  background-color: #e6e6e6;
}

.light-mode .extension {
  background: var(--color-primary);
  color: var(--color-background);
  opacity: 0.7;
}

.dragdrop-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1rem;
}

.light-mode .dragdrop-overlay {
  background: rgba(255, 255, 255, 0.92);
}

/* Alpine transition classes */
.transition {
  transition-property: all;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
}

.duration-300 {
  transition-duration: 300ms;
}

.opacity-0 {
  opacity: 0;
}

.opacity-100 {
  opacity: 1;
}

/* Rest of dragdrop styles remain the same */
.dragdrop-icon {
  width: 128px;
  height: 128px;
  opacity: 0.85;
  filter: invert(1);
}

.light-mode .dragdrop-icon {
  filter: none;
}

.dragdrop-text {
  color: var(--color-text);
  font-size: 1.2rem;
  opacity: 0.85;
  text-align: center;
  max-width: 80%;
  line-height: 1.5;
}

.dragdrop-subtext {
  color: var(--color-text);
  font-size: 0.9rem;
  opacity: 0.6;
}

.path-link {
  margin-left: 0.1em;
  margin-right: 0.1em;
}

/* Alpine cloak to prevent FOUC */
[x-cloak] {
  display: none !important;
}

/* Remove unnecessary specific media query that was causing issues */
@media (max-width: 480px) {
  .text-button svg {
    width: 16px;
    height: 16px;
  }
}

/* Settings Modal Styles */
.settings-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: auto;
  padding: 24px;
}

.settings-modal-close {
  position: absolute;
  top: 8px;
  right: 16px;
  border: none;
  background: transparent;
  font-size: 24px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.settings-modal-title {
  margin-top: 0;
  margin-bottom: 24px;
  font-size: 1.8rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 12px;
}

.settings-modal-content {
  background-color: var(--color-panel);
  color: var(--color-text);
  width: 100%;
  max-width: 800px;
  height: auto;
  max-height: 90vh;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  padding: 24px;
  position: relative;
  overflow: auto;
}

/* Settings Sections */
nav ul {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0 0 1rem 0;
  list-style: none;
}

/* Add specific styling for the nav element itself to ensure spacing */
nav {
  margin-bottom: 1rem;
}

nav ul li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
  border-radius: 0.5rem;
  background-color: var(--color-bg-secondary);
  text-decoration: none;
  color: var(--color-text);
  transition: background-color 0.2s ease;
}

nav ul li a:hover {
  background-color: var(--color-bg-tertiary);
}

nav ul li a img {
  width: 50px;
  height: 50px;
  margin-bottom: 0.5rem;
  filter: var(--svg-filter);
}

.section {
  margin-bottom: 3rem;
  animation: fadeIn 0.3s ease;
  width: 100%;
}

.section-title {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--color-primary);
  border-bottom: 1px solid var(--color-border);
  padding-bottom: 0.5rem;
}

.section-description {
  margin-bottom: 1.5rem;
  color: var(--color-text-secondary);
}

.icon {
  vertical-align: middle;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(var(--spacing-sm));
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@-webkit-keyframes fadeIn {
  /* Safari and older Chrome */
  from {
    opacity: 0;
    -webkit-transform: translateY(var(--spacing-sm));
    transform: translateY(var(--spacing-sm));
  }
  to {
    opacity: 1;
    -webkit-transform: translateY(0);
    transform: translateY(0);
  }
}

@keyframes heartbeat {
  0% {
    transform: scale(1);
  }
  14% {
    transform: scale(1.1);
  }
  28% {
    transform: scale(1);
  }
  42% {
    transform: scale(1.08);
  }
  70% {
    transform: scale(1);
  }
  100% {
    transform: scale(1);
  }
}


@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.spin {
  animation: spin 1s linear infinite;
}

/* Bootstrap Collapse */
.collapse:not(.show) {
  display: none !important;
}
.collapsing {
  height: 0;
  overflow: hidden;
  transition: height .35s ease;
}

/* Arrow rotation based on Bootstrap's .collapsed class */
[data-bs-toggle="collapse"] .arrow-icon {
  transform: rotate(90deg);
  transition: transform .15s ease;
}
[data-bs-toggle="collapse"].collapsed .arrow-icon {
  transform: rotate(0deg);
}

.project-color-ball {
  width: 0.6em;
  height: 0.6em;
  border-radius: 50%;
  display: inline-block;
  box-sizing: border-box;
  flex-shrink: 0;
}

/* ========================================
   Global Dropdown Component Styles
   ======================================== */

/* Dropdown container - position relative for absolute menu */
.dropdown {
  position: relative;
  display: inline-block;
}

/* Secondary / cancel buttons — visible on dark backgrounds */
.btn-secondary {
  background: transparent;
  border: 1px solid var(--color-text-secondary, #999);
  color: var(--color-text, #fff);
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.78rem;
  padding: 3px 10px;
  transition: background 0.15s, border-color 0.15s;
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--color-text, #fff);
}

/* Dropdown trigger button */
.dropdown-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--color-text);
  padding: var(--spacing-xs);
  transition: all var(--transition-speed) ease;
}

.dropdown-trigger:hover {
  opacity: 1;
}

.dropdown-trigger:active {
  opacity: 0.5;
}

/* Dropdown menu */
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 180px;
  max-height: 70vh;
  overflow-y: auto;
  background-color: var(--color-panel);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  z-index: 1010;
  padding: var(--spacing-xs) 0;
  margin-top: var(--spacing-xs);
}

.dropdown-menu.left {
  left: 0;
  right: auto;
}

/* Dropdown menu items */
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  background: transparent;
  border: none;
  color: var(--color-text);
  font-family: var(--font-family-main);
  font-size: var(--font-size-small);
  text-align: left;
  opacity: 0.8;
  cursor: pointer;
  transition: background-color 0.15s ease;
  white-space: nowrap;
}

.dropdown-item:hover {
  background-color: var(--color-background-hover);
  opacity: 1;
}

.dropdown-item:active {
  opacity: 0.7;
}

.dropdown-item:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.dropdown-item svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.dropdown-item .material-symbols-outlined {
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

/* Dropdown separator */
.dropdown-separator {
  height: 1px;
  background-color: var(--color-border);
  margin: var(--spacing-xs) 0;
}

/* Dropdown header/label */
.dropdown-header {
  padding: var(--spacing-xs) var(--spacing-md);
  font-size: 0.7rem;
  color: var(--color-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
}

/* Light mode adjustments */
.light-mode .dropdown-menu {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.light-mode .dropdown-item:hover { background-color: var(--color-background-hover); }

.display-none{
  display: none !important;
}

.no-scrollbar {
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE/Edge */
}

.no-scrollbar::-webkit-scrollbar {
  display: none; /* Chrome/Safari/Webkit */
}

body * {
  scrollbar-width: thin;
  scrollbar-color: #555 transparent;
}

body *::-webkit-scrollbar {
  width: 5px;
}

body *::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
  border-radius: 3px;
}

body *::-webkit-scrollbar-thumb {
  border-radius: 3px;
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.3);
  background-color: #555;
  -webkit-transition: background-color var(--transition-speed) ease-in-out;
  transition: background-color var(--transition-speed) ease-in-out;
}

body *::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}

body *::-webkit-scrollbar-thumb:active {
  background-color: #888;
}

.light-mode * {
  scrollbar-color: #b7b7b7 transparent;
}

.light-mode *::-webkit-scrollbar-track {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.12);
}

.light-mode *::-webkit-scrollbar-thumb {
  box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.12);
  background-color: #b7b7b7;
}

.light-mode *::-webkit-scrollbar-thumb:hover {
  background-color: #9f9f9f;
}

.light-mode *::-webkit-scrollbar-thumb:active {
  background-color: #8a8a8a;
}