@import "shared.css";

* {
  margin: 0;
  box-sizing: border-box;
}

html {
  height: 100%;
}

.hidden {
  display: none;
}

.gallery {
  padding: 50px;
  height: auto;
  overflow: auto;
  flex: 1;
}

.gallery.tile, .tile {
  width: 100px;
  height: 100px;
  object-fit: cover;
  margin: 20px 10px 20px 0;
  border-radius: 5px;
}

body {
  font-family: Arial, sans-serif;
  background-color: #000000;
  color: #e6e6e6;
  line-height: 1.5;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "sidebar chat-area";
  min-width: 100%;
  height: 100%;
}

main {
  display: flex;
  flex: 1;
  overflow: hidden;
  grid-area: chat-area;
}

header {
  grid-area: header;
  padding: 10px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header .logo {
  color: #fff;
  font-weight: bold;
  font-size: 1.2em;
  color: #fff;
}

header nav a {
  color: #aaa;
  text-decoration: none;
  margin-left: 15px;
  font-size: 1em;
  transition: color 0.3s;
}

.no-select {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

header nav a:hover {
  color: #fff;
}

a {
  font-weight: bold;
  color: #f05a28;
  margin-bottom: 3px;
}

h1 {
  font-size: 2em;
  color: #f05a28;
}

h2 {
  font-size: 1.4em;
  color: #f05a28;
}


.chat-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-header {
  padding: 10px 20px;
  user-select: none;
}

.chat-header h2 {
  font-size: 1.2em;
  color: #fff;

}

footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
}

.message-list {
  flex: 1;
  height: 10px;
  padding-bottom: 40px;
  overflow-y: auto;
}

.chat-messages, .threads {
  flex: 1;
  overflow-y: scroll;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 10px;
  height: 10px;
}

.chat-messages {
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1;
  padding: 10px;

  ul {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  a {
    font-size: 20px;
    color: #f05a28;
  }

}

.chat-messages picture img {
  cursor: pointer;
}

.chat-messages::-webkit-scrollbar {
  display: none;
}

.chat-messages .message, .threads .thread {
  display: flex;
  align-items: flex-start;
  margin-bottom: 0;
  padding: 5px;
  border-radius: 8px;
}

.chat-messages .message .avatar, .threads .thread .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f05a28;
  color: #fff;
  font-size: 1em;
  font-weight: bold;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 15px;
}

.chat-messages .message .message-content, .threads .thread .message-content {
  flex: 1;
}

.chat-messages .message .message-content .author, .threads .thread .message-content .author {
  font-weight: bold;
  color: #f05a28;
  margin-bottom: 3px;
}

* {
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.highlight pre {
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.chat-messages .message .message-content .text, .threads .thread .message-content .text {
  margin-bottom: 5px;
  color: #e6e6e6;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
}

.message-content .spoiler {
  background-color: rgba(255, 255, 255, 0.1);
  /*color: transparent;*/
  cursor: pointer;
  border-radius: 0.5rem;
  padding: 0.5rem;
  position: relative;
  height: 2.5rem;
  overflow: hidden;
  max-width: unset;
}

.message-content .spoiler * {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.spoiler:hover, .spoiler:focus, .spoiler:focus-within, .spoiler:active {
  /*color: #e6e6e6;*/
  /*transition: color 0.3s ease-in;*/
  height: unset;
  overflow: unset;
}

@keyframes delay-pointer-events {
  0% {
    visibility: hidden;
  }
  50% {
    visibility: hidden;
  }
  100% {
    visibility: visible;
  }
}

.spoiler:hover * {
  animation: unset;
}

.spoiler:hover *, .spoiler:focus *, .spoiler:focus-within *, .spoiler:active * {
  opacity: 1;
  transition: opacity 0.3s ease-in;
  pointer-events: auto;
  visibility: visible;
  animation: delay-pointer-events 0.2s linear;
}

.message-content {
  max-width: 100%;
}

.message-content {

  img, video, iframe, div {
    max-width: 90%;
    border-radius: 20px;
  }
}

.chat-messages .message .message-content .time, .threads .thread .message-content .time {
  font-size: 0.8em;
  color: #aaa;
}

.chat-input {
  padding: 15px;
  display: flex;
  align-items: center;
}

input[type="text"], .chat-input textarea {
  flex: 1;
  color: white;
  background: none;
  border: none;
  padding: 10px;
  border-radius: 5px;
  resize: none;
}

.chat-input upload-button {
  color: white;
  border: none;
  padding: 10px 15px;
  margin-left: 10px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 1em;
  transition: background-color 0.3s;
}

.chat-input button:hover {
  background-color: #e04924;
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
}

.message {
  .text {
    max-width: 100%;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  .avatar {
    opacity: 0;
    max-height: 0;
    overflow: hidden;
  }

  .author {
    display: none;
  }

  &:not(:hover, :focus-within, :active) .time {
    opacity: 0;
  }
}

.message.switch-user {
  .text img, iframe, video {
    max-width: 90%;
    border-radius: 20px;
  }

  .avatar {
    user-select: none;
    opacity: 1;
    max-height: unset;
  }

  .author {
    display: block;
  }
}

.message:has(+ .message.switch-user), .message:has(+ .message.long-time), .message:not(:has(+ .message)) {
  .time {
    display: block;
    opacity: 1;
  }
}

/* The entire scrollbar */
::-webkit-scrollbar {
  display: none;
}

::-webkit-scrollbar-track {
  background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 3px;
  border: 1px solid #f1f1f1;
}

::-webkit-scrollbar-thumb:hover {
  background-color: #555;
}

.chat-messages, .threads {
  scrollbar-width: none;
  scrollbar-color: #888 #f1f1f1;
}

a {
  text-decoration: none
}

.sidebar {
  width: 250px;
  padding-left: 20px;
  padding-right: 20px;
  padding-top: 10px;
  overflow-y: auto;
  grid-area: sidebar;
}

.sidebar h2 {
  color: #f05a28;
  font-size: 1.2em;
  margin-bottom: 20px;
}

.sidebar ul {
  list-style: none;
}

.sidebar ul li {
  margin-bottom: 15px;
}

.sidebar ul li a {
  color: #ccc;
  text-decoration: none;
  font-size: 1em;
  transition: color 0.3s;
}

.sidebar ul li a:hover {
  color: #fff;
}

@keyframes glow {
  0% {
    box-shadow: 0 0 5px #3498db;
  }
  50% {
    box-shadow: 0 0 20px #3498db, 0 0 30px #3498db;
  }
  100% {
    box-shadow: 0 0 5px #3498db;
  }
}

.glow {
  animation: glow 1s;
}


@media only screen and (max-width: 768px) {

  header {
    top: 0;
    left: 0;
    text-overflow: ellipsis;
    width: 100%;
    display: flex;
    flex-direction: column;

    .logo {
      display: block;
      flex: 1;
      text-overflow: ellipsis;
      white-space: nowrap;
      overflow: hidden;

      h2 {
        font-size: 14px;
      }

      text-align: center;
    }

    nav {
      text-align: right;
      flex: 1;
      display: block;
      width: 100%;
    }
  }

  /*
      body {
          justify-content: flex-start;
      }
      header{
          position: sticky;
          display: block;
          .logo {
              display:block;
          }
      }
      .chat-input {
          position:sticky;
      }*/
}

dialog {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  border: none;
  border-radius: 12px;
  padding: 24px;
  background-color: #000; /* Deep black */
  color: #f1f1f1;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.8);
  width: 90%;
  max-width: 400px;

  animation: dialogFadeIn 0.3s ease-out, dialogScaleIn 0.3s ease-out;
  z-index: 1000;
}

/* Backdrop styling */
dialog::backdrop {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
}

/* Title and content */
dialog .dialog-title {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 16px;
  color: #fff;
}

dialog .dialog-content {
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 20px;
}

/* Button layout */
dialog .dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

dialog .dialog-button {
  padding: 8px 16px;
  font-size: 0.95rem;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: background 0.2s ease;
}


@keyframes dialogFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialogScaleIn {
  from {
    transform: scale(0.95) translate(-50%, -50%);
    opacity: 0;
  }
  to {
    transform: scale(1) translate(-50%, -50%);
    opacity: 1;
  }
}

dialog .dialog-button.primary {
  background-color: #f05a28;
  color: white;
}

dialog .dialog-button.primary:hover {
  background-color: #f05a28;
}

dialog .dialog-button.secondary {
  background-color: #f0a328;
  color: #eee;
}

dialog .dialog-button.secondary:hover {
  background-color: #f0b84c;
}
dialog .dialog-button.primary:disabled,
dialog .dialog-button.primary[aria-disabled="true"] {
  /* slightly darker + lower saturation of the live colour */
  background-color: #70321e;          /* muted burnt orange */
  color: #bfbfbf;                     /* light grey text    */

  opacity: .55;                       /* unified fade       */
  cursor: not-allowed;
  pointer-events: none;
}

/* ----------  SECONDARY  (yellow)  ---------- */
dialog .dialog-button.secondary:disabled,
dialog .dialog-button.secondary[aria-disabled="true"] {
  background-color: #6c5619;          /* muted mustard      */
  color: #bfbfbf;

  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

dialog .dialog-button:disabled:focus {
  outline: none;
}

.embed-url-link {
  display: flex;
  flex-direction: column;
}

.embed-url-link img,
.embed-url-link video,
.embed-url-link iframe,
.embed-url-link div {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px 12px 0 0;
}

.embed-url-link .page-site {
  font-size: 0.9em;
  color: #aaa;
  margin-bottom: 5px;
}

.embed-url-link .page-name {
  font-size: 1.2em;
  color: #f05a28;
  margin-bottom: 5px;
}

.embed-url-link .page-description {
  font-size: 1em;
  color: #e6e6e6;
  margin-bottom: 10px;
}

.embed-url-link .page-link {
  font-size: 0.9em;
  color: #f05a28;
  text-decoration: none;
  margin-top: 10px;
}

th {
    min-width: 100px;
}
