/* Grundlegendes Reset und Body Styling */
* {
  font-family: Arial, Helvetica, sans-serif;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
  word-wrap: break-word;

  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
:root {
  --anim-time-01: .2s;
  --anim-time-02: .1s;

  --border-radius-01: .2rem;
  --border-radius-02: .5rem;
  --border-radius-03: .7rem;

  --anim-type-01: ease;
  --backdrop-blur-01: blur(50px);

  --color-light-01: #ECFEFF;
  --color-light-02: #ECFEFF;
  --color-light-03: #ECFEFF;
  --color-light-hover: #4e5252;

  --color-dark-01: #333;
  --color-dark-02: #100f12;
  --color-dark-03: #333;
  
  --color-accent-01: #24717B;
  --color-accent-switch: #24717B;
  
  --color-background-01: #1A191D;
  --color-background-02: #130a142e;
  --color-background-03: #0000004a;

  --color-placeholder: #A9A9A9;
  
  --background-patern-url: url(/images/background-pattern.webp);
  --icon-filter-invert: none;
}

:root[data-theme="dark"] {
  --color-light-01: #ECFEFF;
  --color-light-02: #ECFEFF;
  --color-light-03: #ECFEFF;
  --color-light-hover: #4e5252;

  --color-dark-01: #333;
  --color-dark-02: #100f12;
  --color-dark-03: #333;
  
  --color-accent-01: #24717B;
  --color-accent-switch: #24717B;
  
  --color-background-01: #1A191D;
  --color-background-02: #130a142e;
  --color-background-03: #0000004a;

  --color-placeholder: #A9A9A9;
  
  --background-patern-url: url(/images/background-pattern.webp);
  --icon-filter-invert: none;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-light-01: #333;
    --color-light-02: #cce3e4;
    --color-light-03: #ECFEFF;
    --color-light-hover: #b8c3c4;
    
    --color-dark-01: #333;
    --color-dark-02: #c8c6cc;
    --color-dark-03: #ECFEFF;
    
    --color-accent-01: #4b96a0;
    --color-accent-switch: #7b2424;
    
    --color-background-01: #ffffff;
    --color-background-02: #faeafb2e;
    --color-background-03: #ffffff4a;

    --color-placeholder: #6a6a6a;
    
    --background-patern-url: url(/images/background-pattern-light.webp);
    --icon-filter-invert: invert(1);
  }
}
:root[data-theme="light"] {
  --color-light-01: #333;
  --color-light-02: #cce3e4;
  --color-light-03: #ECFEFF;
  --color-light-hover: #b8c3c4;
  
  --color-dark-01: #333;
  --color-dark-02: #c8c6cc;
  --color-dark-03: #ECFEFF;
  
  --color-accent-01: #4b96a0;
  --color-accent-switch: #7b2424;
  
  --color-background-01: #ffffff;
  --color-background-02: #faeafb2e;
  --color-background-03: #ffffff4a;

  --color-placeholder: #6a6a6a;
  
  --background-patern-url: url(/images/background-pattern-light.webp);
  --icon-filter-invert: invert(1);
}

body {
  font-family: Arial, sans-serif;
  background: var(--color-background-01);
  /* background: #121215; */
}

input, label, h1, h2, h3, h4, h5, h6, p {
  color: var(--color-light-01);
}
.text-content {
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}
*::selection {
  background-color: #4fb9c2b9;
  color: white;
}

#main-container {
  display: flex;
  height: 100dvh;
}

#chatList {
  width: 30rem;
  height: 100dvh;
  z-index: 30;
  overflow: hidden;
  background-color: var(--color-background-02);

  transition: width var(--anim-time-01) var(--anim-type-01);
}
#chatList.closed {
  width: 0;
  min-width: 0;
}
#chatList ul{
	margin: 5rem 0 0 0;
}
#chatList li{
	list-style: none;
	background: var(--color-accent-01);
}
#chatList a{
	display: inline-block;
	color: var(--color-light-01);
	text-decoration: none;
	padding: .5rem 1rem .5rem 1rem;
}

#chatListIcon {
  position: fixed;
  top: 0; left: .5rem;
  cursor: pointer;
  height: 3rem; aspect-ratio: 1;
  z-index: 200;

  background-image: url(/images/side-panel.svg);
  background-position: center center;
  background-size: 50%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #chatListIcon:hover {
  opacity: .6;
  background-size: 55%;
}
#chatListIcon:active {
  background-size: 40% !important;
}

#container {
  position: relative;
  width: 100%;
  background: var(--color-background-01);
  background-image: var(--background-patern-url);

  transition: width var(--anim-time-01) var(--anim-type-01);
}

#chatWrapper {
  position: relative;
  margin: auto;
  top: 0; left: 0;
  overflow-y: auto;
  scroll-behavior: smooth;
  padding: 5px;
  height: 100dvh; width: 100%;
  max-width: 90rem;

  mask-image: linear-gradient(#000 calc(100% - 6rem), #00000000 100%);
  overscroll-behavior-y: auto;
}

#chat {
  padding: 4rem clamp(10px, 4vw, 40px) 6rem clamp(10px, 4vw, 40px);
}

#chat p {
  margin-bottom: 8px;
  line-height: 1.4;
}

#chat .file-preview {
	max-width: 100%;
}
.bubble {
  position: relative;
  display: flex;
  flex-direction: column;
	max-width: 60vw;
  min-width: 1rem;
  margin-top: 1rem;
	margin-bottom: none;
  width: max-content;
}

.bubble .text:first-child {
  border-top-right-radius: var(--border-radius-02);
  border-top-left-radius: var(--border-radius-02);
}
.bubble:has(.text:first-child > .text-reply) .text:first-child {
  border-top-right-radius: var(--border-radius-01);
  border-top-left-radius: var(--border-radius-01);
}
.bubble .text:nth-last-child(2) {
  border-bottom-right-radius: var(--border-radius-03);
  border-bottom-left-radius: var(--border-radius-03);
}

.bubble .text {
  position: relative;
  margin: 2px 0;
  width: max-content;
  text-align: start;
  max-width: 100%;
  font-size: 14px;
  word-wrap: break-word;
  border-radius: var(--border-radius-01);
}
.bubble .text .text-content {
  padding: .4rem .5rem;
}

.bubble .text:has(.reaction) {
  padding-bottom: .5rem;
  margin-bottom: 1.2rem;
}
/* .bubble .text:has(.attachment-frame) .text-content {
  display: none;
  padding: 0 0;
} */

.bubble.me .text {
  background: var(--color-accent-01);
  color: var(--color-light-03);
}
.bubble.other .text {
  background: var(--color-light-02);
  color: var(--color-dark-01);
}
.bubble.me {
  align-items: end;
  text-align: right;
  margin-left: auto;
}
.bubble.other {
  text-align: left;
}

mark {
  background-color: yellow;
  color: black;
  padding: 0 2px;
  border-radius: 2px;
}

.bubble .text:nth-last-child(2)::after {
  position: absolute;
  bottom: -.05rem;
  height: .8rem; aspect-ratio: 933.3/1000;
  content: "";
  mask-image: url("data:image/svg+xml,%3Csvg%20width='62px'%20height='66px'%20viewBox='0%200%2062%2066'%20version='1.1'%20xmlns='http://www.w3.org/2000/svg'%20xmlns:xlink='http://www.w3.org/1999/xlink'%20xml:space='preserve'%20xmlns:serif='http://www.serif.com/'%20style='fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2;'%3E%3Cg%20transform='matrix(1,0,0,1,0.0011,-4.54747e-13)'%3E%3Cg%20transform='matrix(0.088,0,0,0.088,-264.001,-246.4)'%3E%3Cpath%20d='M3700,3550C3563.27,3412.32%203500,3247.43%203500,2800L3000,2800L3000,3350C3187.92,3494.36%203430.1,3545.89%203700,3550Z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  mask-size: contain;
  mask-repeat: no-repeat;
  mask-position: center;
}
.bubble.me .text:nth-last-child(2)::after {
  right: -.23rem;
  background-color: var(--color-accent-01);
}
.bubble.other .text:nth-last-child(2)::after {
  background-color: var(--color-light-02);
  left: -.23rem;
  transform: scale(-1, 1);
}

.bubble.other .text.highlight:nth-last-child(2)::after, .bubble.me .text.highlight:nth-last-child(2)::after {
	background-color: #fafa66;
	transition: color 0.5s ease-out;
}

/* .bubble.me .metadata {
  margin-right: 5px;
}
.bubble.other .metadata {
  margin-left: 5px;
} */

.metadata {
  display: flex;
  flex-direction: row-reverse;
  max-width: fit-content;
  margin-top: 2px;
  gap: 1rem;
  color: var(--color-light-01);
}
.bubble.me .metadata {
  padding-right: .7rem;
}
.bubble.other .metadata {
  padding-left: .7rem;
}
/* 
.bubble:has(.text:nth-last-child(2) .reaction) .metadata {
  margin-top: 18px;
} */

.bubble .name {
  position: relative;
  font-size: 0.8em;
}
.bubble .name::after {
  position: absolute;
  right: -.6rem;
  content: "•";
}

.bubble .time {
  font-size: 0.8em;
}
.bubble.temp {
  opacity: 0.7;
}

.bubble .text.failed {
  background-color: #e46363;
}
.bubble.me .text.failed:nth-last-child(2)::after {
  color: #e46363;
}

.bubble .error-msg {
  color: #c0392b;
  font-size: 0.85em;
  margin-top: 0.5em;
}

.bubble .error-msg button {
  background: none;
  border: 1px solid #c0392b;
  padding: 2px 6px;
  font-size: 0.8em;
  cursor: pointer;
}
.text.failed {
  border-left: 2px solid #cd0000;
}
.bubble .text.success {
  border-left: 2px solid #00d535;
  background-color: #7cf27c;
}
.bubble .text.success:nth-last-child(2)::after {
  color: #7cf27c;
}

/* Button zum schnellen Runterscrollen */
#scrollBtn {
  position: absolute;
  top: -3.5rem; right: 0;
  border-radius: var(--border-radius-02);
  width: fit-content;
  color: var(--color-light-01);
  border: 1px solid var(--color-light-01);
  padding: 10px 15px 12px 35px;
  cursor: pointer;
  font-size: 14px;
  display: none;
  
  background: var(--color-background-01);
  transition: background-color var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01);
}
#scrollBtn:hover {
  background: var(--color-dark-02);
  border: 1px solid #ecfeff92;
}
#scrollBtn::before {
  display: block;
  position: absolute;
  top: 0; left: 0;
  content: "";
  height: 100%; aspect-ratio: 1;

  background-image: url(/images/down-arrow.svg);
  background-position: center center;
  background-size: 30%;
  background-repeat: no-repeat;

  transition: background-size var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #scrollBtn:hover::before {
  background-size: 40%;
  opacity: .6;
}
#scrollBtn:active::before {
  background-size: 20% !important;
}

/* Formular Styling */
form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--color-background-03);
  padding: 12px;
  /* border: 1px solid #ddd; */
  backdrop-filter: var(--backdrop-blur-01);
  border-radius: 4px;
}

.message-input-area {
  position: relative;
  width: 100%;
  min-height: 36px;
}

form input[type="text"],
form textarea {
  width: 100%;
  border: 1px solid var(--color-light-01);
  border-radius: .4rem .2rem .2rem .4rem;
  padding: 8px 12px;
  font-size: 14px;
  background-color: transparent;
  color: var(--color-light-01);
	field-sizing: content;
	-moz-field-sizing: content;
	-webkit-field-sizing: content;
	-ms-field-sizing: content;
	-o-field-sizing: content;
	min-height: 36px;
  height: 36px;
	max-height: 150px;
  resize: vertical;
  font-size: 1rem;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}
form textarea::placeholder {
  color: var(--color-placeholder);
}

#sendBtn {
  all: unset;

  display: block;
  position: absolute;
  height: 24px; aspect-ratio: 1;
  right: 6px; top: 6px;
  cursor: pointer;

  background-image: url(/images/send.svg);
  background-position: center center;
  background-size: 80%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #sendBtn:hover {
  opacity: .6;
  background-size: 100%;
}
#sendBtn:active {
  background-size: 30% !important;
}

form input[type="text"],
form textarea:focus {
  background-color: #78787843;
  outline: none;
}
/*
form textarea {
  resize: vertical;
  min-height: 60px;
}
*/

body:not(.touch) form button[type="submit"]:hover {
  background: #0056b3;
}

.send-form-wrapper {
  position: absolute;
  bottom: 1rem; left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
}

form#form {
  position: relative;
  width: 90%;
  max-width: 75rem;
  display: flex;
  flex-direction: row;
  gap: .7rem;
  padding: .5rem .5rem .3rem .5rem;
  border-radius: .9rem;
  /* background: #fff; */

  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);
}

/* Drop-Area für Dateien */
#fileDropArea {
  border: 1.5px dashed var(--color-light-03);
  padding: 13px;
  width: 45px;
  height: 36px;
  text-align: center;
  color: var(--color-light-01);
  border-radius: .2rem .4rem .4rem .2rem;
  cursor: pointer;

  background-image: url(/images/paper-clip.svg);
  background-position: center center;
  background-size: 40%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
  transition: opacity var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);
}
body:not(.touch) #fileDropArea:hover {
  opacity: .6;
  background-size: 50%;
}
#fileDropArea:active {
  background-size: 30% !important;
}
#fileDropArea.dragover {
  background-color: #78787843;
  border-color: var(--color-accent-switch);
}

/* Angeheftete Dateien */
.attachment-frame {
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--border-radius-01);
}

.attachment-frame > a > img {
  margin: auto;
}
.attachment-frame > a {
  display: block;
}
.bubble .text:has(.text-content) .attachment-frame {
  padding: 0 .5rem;
}
.bubble .text:has(.text-content) .attachment-frame > a {
  border-radius: 0;
}
.bubble.me .text:has(.text-content) .attachment-frame > a {
  border-top: 1px solid #ffffff43;
}
.bubble.other .text:has(.text-content) .attachment-frame > a {
  border-top: 1px solid #5f5f5f2d;
}

.bubble.me .attachment-frame > a {
  /* border-bottom: 1px solid #2f93a0; */
  border-bottom: 1px solid #ffffff43;
}
.bubble.other .attachment-frame > a {
  /* border-bottom: 1px solid #c1d1d3; */
  border-bottom: 1px solid #5f5f5f2d;
}

.attachment-frame img,
.file-preview {
  display: block;
  max-width: 100%;
  max-height: 250px;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}
#attachedFiles {
  position: absolute;
  left: .5rem;
  top: -2.8rem;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
#attachedFiles span {
  background: #eef;
  color: var(--color-dark-01);
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 13px;
}

/* Highlight beim Drag über Drop-Zone oder Textarea */
.drop-area.dragover,
#text.dragover {
  border: 2px dashed #1e88e5;
  background-color: #f0f8ff;
  transition: background-color var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01);
}
#text{
	padding-right: 2rem;
}

/* Stil für einzelne angehängte Dateien */
.attached-file {
  padding: 6px 10px;
  margin: 5px 0;
  background: var(--color-light-03);
  border-radius: 5px;
  font-size: 0.9em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid #c0d3eb;
  color: var(--color-dark-01);
}
.file-info {
  padding: .4rem .5rem;
  /* max-width: 250px;
  max-width: 0; */
  mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), #00000000);
  text-wrap: nowrap;
  transition: opacity var(--anim-time-01) var(--anim-type-01);
}
.file-info.nopreview {
  mask-image: none;
  text-wrap: wrap;
}
body:not(.touch) .file-info:hover {
  opacity: .6;
}
.bubble .text:has(.text-content) .file-info {
  padding: .4rem 0;
}

.file-info a {
  text-decoration: none;
}

.file-info a::before {
  display: inline-block;
  content: "";
  margin: 0 .2rem 0 0;
  height: 14px; aspect-ratio: 1;
  background-image: url(/images/paper-clip.svg);
  background-position: center 100%;
  background-size: 80%;
  background-repeat: no-repeat;
}
.bubble.other .file-info a {
  color: var(--color-dark-01);
}
.bubble.me .file-info a {
  color: var(--color-light-03);
}
.bubble.other .file-info a::before {
  filter: invert(1);
}

.attached-file button {
  background: transparent;
  border: none;
  font-size: 1.1em;
  color: #999;
  cursor: pointer;
  margin-left: 10px;
  line-height: 1;
}

.attached-file button:hover {
  color: #d32f2f;
}

.overlay[hidden] {
  display: none !important;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;

  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);
}

.overlay-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: var(--border-radius-01);
  padding: 0;
}

.overlay-content img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 4px;
  background-color: var(--color-light-01);
  box-shadow: 0 0 15px #00000080;
  cursor: pointer;
  padding: 0;
}

.attached-file.uploading::after {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  border: 2px solid #ccc;
  border-top-color: var(--color-dark-01);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

dialog {
  padding: 1.5em 2em;
  border: none;
  border-radius: 6px;
  box-shadow: 0 0 30px rgba(0,0,0,0.3);
  font-size: 1rem;
  max-width: 400px;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

#uploadDialog a {
  color: #007aff;
  text-decoration: none;
  font-weight: bold;
}

/**NAV BAR**/

#nav-bar {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 1.3rem 0 1.3rem;
  top: 0; left: 0;
  width: 100%; height: 3rem;
  text-align: center;
  z-index: 100;
  
  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);
  
  transition: padding var(--anim-time-01) var(--anim-type-01);
}
#nav-bar.closed-side {
  padding: 0 1.3rem 0 3.8rem;
}

.chatNameWrapper {
  width: 100%;
  overflow: hidden;
  mask-image: linear-gradient(90deg, #000, #000 calc(100% - 6rem), #00000000 100%);
}
.chatName {
  color: var(--color-light-01);
  font-size: 1rem;
  padding-top: .15rem;
  font-weight: 50;
  text-wrap: nowrap;
  text-align: start;
  /* background-color: linear-gradient(90deg #000, #000 calc(100% - 14rem), #00000000 calc(100% - 8rem)); */
}

.tool-bar {
  height: auto;
  display: flex;
  gap: 1rem;
}
.settings-icon {
  all: unset;
  display: block;
  height: 31px; aspect-ratio: 1;
  cursor: pointer;
  transition: opacity var(--anim-time-01) var(--anim-type-01), rotate var(--anim-time-01) var(--anim-type-01), background-size var(--anim-time-01) var(--anim-type-01);

  background-image: url(/images/settings.svg);
  background-position: center center;
  background-size: 75%;
  background-repeat: no-repeat;

  filter: var(--icon-filter-invert);
}
body:not(.touch) .settings-icon:hover {
  opacity: .6;
  background-size: 85%;
}
.settings-icon:active {
  background-size: 60% !important;
}
.settings-icon.open {
  rotate: -45deg;
}

.settings-pane {
  position: fixed;
  top: 3rem; right: -30rem;
  height: calc(100dvh - 3rem); width: 100%;
  max-width: 30rem;
  display: grid;
  padding: 1.5rem 2rem 2rem 2rem;
  grid-template-columns: 1fr auto;
  grid-template-rows: 3.5rem 2rem 2rem 3.5rem;
  grid-auto-rows: 2rem;
  opacity: 0;
  gap: 1rem;
  z-index: 80;
  align-items: center;
  background: var(--color-background-03);
  backdrop-filter: var(--backdrop-blur-01);

  transition: right var(--anim-time-02) var(--anim-type-01), opacity var(--anim-time-02) var(--anim-type-01);
}
.settings-pane.open {
  right: 0;
  opacity: 1;
}

.settings-pane h3 {
  align-self: start;
  text-align: center;
  grid-column: span 2;
}


.settings-pane input[type=checkbox] {
  all: unset;
  display: block;
  position: relative;
  background-color: #ffffff77;
  width: 3rem; height: 1.5rem;
  border-radius: .75rem;
  box-shadow: 0 0 3px 0 #1f1f1f;
  cursor: pointer;
  transition: background-color var(--anim-time-02) ease-out;
}
.settings-pane input[type=checkbox]::after, #switchTheme::after {
  top: .2rem; left: calc(0% + .2rem);
  position: absolute;
  display: block;
  content: "";
  box-shadow: 0 0 3px 0 #1f1f1f;
  background-color: #536366;
  height: 1.1rem; aspect-ratio: 1;
  border-radius: .75rem;
  pointer-events: none;
  transition: left var(--anim-time-02) ease-out, background-color var(--anim-time-02) ease-out, scale var(--anim-time-02) ease-out;
}

.settings-pane input[type=checkbox]:checked, #switchTheme:has(#radio-dark:checked), #switchTheme:has(#radio-light:checked) {
  background-color: #ffffffc4;
}
body:not(.touch) .settings-pane input[type=checkbox]:hover::after, body:not(.touch) #switchTheme:hover::after {
  scale: 1.1;
}
.settings-pane input[type=checkbox]:active::after, #switchTheme:active::after {
  scale: .8 !important;
}

.settings-pane input[type=checkbox], .settings-pane input[type=radio] {
  justify-self: end;
}

#switchTheme {
  all: unset;
  position: relative;
  display: flex;
  background-color: #ffffff77;
  height: 1.5rem; width: 5rem;
  border-radius: .75rem;
  box-shadow: 0 0 3px 0 #1f1f1f;
  cursor: pointer;
  transition: background-color var(--anim-time-02) ease-out;
}
#switchTheme::after {
  top: .2rem; left: calc(50% - .55rem);
}

#switchTheme input[type=radio] {
  all: unset;
  height: 100%; width: 100%;
}

.settings-pane input[type=checkbox]:checked::after, #switchTheme:has(#radio-dark:checked)::after, #switchTheme:has(#radio-light:checked)::after {
  left: calc(100% - 1.1rem - .2rem);
  background-color: var(--color-accent-01);
}
#switchTheme:has(#radio-light:checked)::after {
  left: calc(0% + .2rem);
}

#switchTheme p {
  opacity: .3;
  position: absolute;
  width: 100%;
  left: 0; top: 1.9rem;
  font-size: .7rem;
  transition: opacity var(--anim-time-02) ease-out;
}
#switchTheme p:nth-child(5) {
  text-align: center;
  top: -1.1rem
} 
#switchTheme p:nth-child(6) {
  text-align: end;
} 
#switchTheme:has(#radio-light:checked) p:nth-child(4) {
  opacity: 1;
}
#switchTheme:has(#radio-auto:checked) p:nth-child(5) {
  opacity: 1;
}
#switchTheme:has(#radio-dark:checked) p:nth-child(6) {
  opacity: 1;
}


#chatSearchWrapper {
  height: 100%;
  position: relative;
  background-size: 55%;
}
#chatSearch {
  all: unset;
  display: block;
  padding: .25rem .7rem .2rem .7rem;
  width: 1rem;
  font-size: 1rem;
  text-align: start;
  border: 1px solid var(--color-light-01);
  color: transparent;
  border-radius: 1.3rem;
  cursor: pointer;
  transition: width var(--anim-time-01) var(--anim-type-01), border var(--anim-time-01) var(--anim-type-01), opacity var(--anim-time-01) var(--anim-type-01);
}
#chatSearch::placeholder {
  color: var(--color-placeholder);
  opacity: 0;
}
#chatSearch:focus {
  width: 10rem;
  color: var(--color-light-01);
  padding-left: 2.2rem;
  cursor: text;
}
#chatSearch:focus::placeholder {
  opacity: 1;
}
body:not(.touch) #chatSearch:hover {
  border: 1px solid var(--color-light-hover);
}

.search-icon {
  position: absolute;
  height: 100%; aspect-ratio: 1;
  left: .3rem;
  transition: background-size var(--anim-time-01) var(--anim-type-01);

  background-image: url(/images/search.svg);
  background-position: center center;
  background-size: inherit;
  background-repeat: no-repeat;
  pointer-events: none;

  filter: var(--icon-filter-invert);
}
body:not(.touch) #chatSearchWrapper:hover {
  background-size: 45%;
}

#loadingMessages {
  color: var(--color-light-01);
}

/* context menu */
/* Reaktionen unter einer Nachricht */
.reactions {
  position: absolute;
  bottom: -1rem;
  width: max-content;
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-left: 6px;
  z-index: 5;
  font-size: 0.85em;
}
.reaction {
  z-index: 50;
  border: 2.5px solid var(--color-background-01);
  padding: 2px 8px 2px 6px;
  border-radius: 999px;
  cursor: pointer;
  user-select: none;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}

.bubble.other .reactions {
  left: .3rem;
}
.bubble.me .reactions {
  right: .3rem;
}

.bubble.other .reaction {
  background: var(--color-light-02);
  color: var(--color-dark-01);
}
.bubble.me .reaction {
  background: var(--color-accent-01);
  color: var(--color-light-03);
}

.bubble.other .reaction:hover {
  background: #a6b1b2;
}
.bubble.me .reaction:hover {
  background: #16484f;
}

.bubble .text-content.deleted {
  font-style: italic;
  opacity: .7;
  padding: .4rem .6rem;
}

body .bubble .text.highlight {
  background: #ffff0088;
  background: #fafa66;
  transition: background-color 0.5s ease-out;
}

.emoji-row {
  display: flex;
  gap: 6px;
  padding: 8px 12px;
  justify-content: flex-start;
}
.emoji-option {
  font-size: 1.3em;
  cursor: pointer;
  transition: transform var(--anim-time-01) var(--anim-type-01);
}
.emoji-option:hover {
  transform: scale(1.3);
}


/* Touch-Fix: Unter iOS Safari usw. */
/* .bubble .text:active {
  background-color: rgba(255,255,255,0.05);
} */

/* Optionales Intro-Animation */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* floating-menu.css oder in dein styles.css integrieren */

.floating-menu, .context-menu {
  position: absolute;
  border-radius: var(--border-radius-03);
  box-shadow: 0 4px 12px #00000026;
  padding: 8px 8px;
  z-index: 20;
  min-width: 140px;
  border: 1px solid var(--color-background-01);
  display: flex;
  flex-direction: column;

  background: var(--color-background-02);
  backdrop-filter: var(--backdrop-blur-01);
}
.floating-menu-item {
  opacity: .8;
}
.floating-menu-item, .context-item {
  padding: 8px 12px;
  font-size: 14px;
  color: var(--color-light-01);
  cursor: pointer;
  border-radius: .3rem;
  transition: background var(--anim-time-02) var(--anim-type-01);
}
.floating-menu-item:last-child {
  opacity: 1;
}
.floating-menu-item:hover, .context-item:hover {
  background: #130a1444;
}

#chat-dialog {
  position: fixed;
  flex-direction: column;
  padding: 0;
  width: clamp(10rem, 80%, 20rem);
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background-color: var(--color-background-01);
  border-radius: var(--border-radius-02);
  overflow: hidden;
}

#dialog-title {
  padding: .7rem 1rem .5rem 1rem;
  font-weight: 100;
  text-align: center;
  font-size: 1rem;
  color: var(--color-accent-01);
}

#reply-to {
  position: relative;
  background-color: var(--color-accent-01);
  background-color: #4b96a05e;
  padding: .5rem 1rem;

}

#reply-to span {
  display: block;
  max-width: 100%;
  font-size: 14px;
  color: var(--color-light-01);
  text-align: start;
  mask-image: linear-gradient(90deg, #000 calc(100% - 2rem), #00000000);
  text-wrap: nowrap;
}

#dialog-text {
  padding: .7rem 1rem;
  width: 100%;
  margin: 0;
  font-size: 1rem;
  min-height: 3rem;
  max-height: 15rem;
  background-color: var(--color-background-01);
  border: 1px solid var(--color-accent-01);
  border: 1px solid #4b96a05e;
  color: var(--color-light-01);

  resize: vertical;
}

#dialog-text:focus {
  background-color: var(--color-accent-01);
  background-color: #4b96a05e;
  outline: none;
}

.confirmation-wrapper {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background-color: var(--color-background-01);
}

.confirmation-wrapper input, .confirmation-wrapper button {
  all: unset;
  display: block;
  font-size: 1rem;
  padding: .5rem 1rem;
  pointer-events: all;
  color: var(--color-light-01);
  text-align: center;
  transition: background-color var(--anim-time-01) var(--anim-type-01);
}
.confirmation-wrapper input {
  background-color: #4b96a01b;
}
.confirmation-wrapper button {
  background-color: #4b96a05e;
}

.confirmation-wrapper input:hover, .confirmation-wrapper button:hover {
  background-color: var(--color-accent-01);
}
.confirmation-wrapper input:active, .confirmation-wrapper button:active {
  background-color: var(--color-background-01) !important;
}

.text-reply {
  border-radius: var(--border-radius-01) var(--border-radius-01) 0 0;
  padding: .4rem .5rem .4rem .5rem;
  background-color: #14404790;
  color: var(--color-light-03);
  border-left: 4px solid #14515abb;
}
.reply-author {
  color: #071f23d1;
  display: block;
}
.bubble.me .text-reply {
  background-color: #90c1c990;
  border-left: 4px solid #ffffff9d;
}
.bubble.me .reply-author {
  color: #0a2225c6;
}

/* Optional: kleine Optimierung auf Mobile */
@media (max-width: 600px) {
  .floating-menu {
    min-width: 120px;
  }
  .floating-menu-item {
    font-size: 16px;
  }
}

@media only screen and (max-width: 700px) {
  #container {
    width: 0;
    overflow: hidden;
  }
  #container.closed-side {
    width: 100%;
  }
  #chatList {
    width: 100%;
  }
  #chatList.closed {
    width: 0;
  }
  #nav-bar {
    padding: 0 1.3rem 0 3.8rem;
  }

}

@media (prefers-color-scheme: light) {
  .text-reply[data-theme="light"] {
    border-left: 4px solid #071f23af;
  }
  .reply-author[data-theme="light"] {
    color: #071f23af;
  }
  .bubble.me .text-reply[data-theme="light"] {
    background-color: #90c1c990;
    border-left: 4px solid #0a2125b1;
  }
  .bubble.me .reply-author[data-theme="light"] {
    color: #0a2125b1;
  }
}
@media (prefers-color-scheme: light) {
  .text-reply {
    border-left: 4px solid #071f23af;
  }
  .reply-author {
    color: #071f23af;
  }
  .bubble.me .text-reply {
    background-color: #90c1c990;
    border-left: 4px solid #0a2125b1;
  }
  .bubble.me .reply-author {
    color: #0a2125b1;
  }
}

/* needs styling or change place */

body.touch .bubble,
body.touch .bubble * {
    user-select: none !important;
    -webkit-user-select: none !important;
    -moz-user-select: none !important;
    -ms-user-select: none !important;
    /* …rest wie gehabt… */
  /* verhindert den iOS-Kontext bei Longpress */
  -webkit-touch-callout: none;
  /* erleichtert Touch-Interaktionen */
  touch-action: manipulation;
}

/* Ausnahmen, falls du doch mal Texte auswählbar machen willst:
   zum Beispiel in Formularfeldern oder an anderen Stellen */
body.touch textarea,
body.touch input {
  user-select: text;
  -webkit-user-select: text;
  -webkit-touch-callout: default;
  touch-action: auto;
}

body.touch .text:active {
  filter: brightness(.5);
}

.link-preview {
  display: flex;
  border: 1px solid #1C3539;
  background-color: #749398;
  color: var(--color-light-01);
  border-radius: 4px;
  margin: 4px 0 3px;
  overflow: hidden;
  font-size: 0.9em;
}
.bubble.me .link-preview {
  background-color: #649DA8;
}

.link-preview.loading {
  height: 50px; /* Platz für Spinner o.ä. */
  background: #f9f9f9 url('/images/spinner.gif') center center no-repeat;
}
.preview-image img {
  width: 120px;
  height: 100%;
  object-fit: cover;
}

.preview-meta {
  padding: 8px 8px 3px 8px;
  flex: 1;
  color: var(--color-light-01);
}
.preview-meta h4 {
  margin: 0 0 4px;
  font-size: 1em;
}
.preview-meta p {
  margin: 0;
}

.preview-meta h4, .preview-meta p {
  color: #1B3438;
}

.bubble.me .link-preview .preview-meta h4, .bubble.me .link-preview .preview-meta p {
  color: #1E3E42;
}

.text-content a {
  color: #1B3438;
}
.text-content a:visited {
  color: #24717B;
}

.bubble.me .text-content a {
  color: #ECFEFF;
}
.bubble.me .text-content a:visited {
  color: #0a3038;
}

.text-reply a {
  color: var(--color-light-01);
}