/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

@import url("/assets/utilities-a340dfb7.css");

:root,
:host {
  --pico-form-element-spacing-vertical: 0.3rem !important;
  --pico-form-element-spacing-horizontal: 0.5rem !important;
}

h1 {
  margin-top: 10px !important;
}

button {
  margin-bottom: 0 !important;
}

nav button {
  height: 24px !important;
  width: 24px !important;
  padding: 0 !important;
  line-height: 12px !important;
}

@media (max-width: 480px) {
  body > header,
  body > main {
    padding-block: 0 !important;
  }
}

a.unstyled {
  text-decoration: none;
  color: inherit;
}

button.icon {
  height: 24px !important;
  width: 24px !important;
  padding: 0 !important;
  line-height: 12px !important;
  margin-bottom: 0 !important;
}

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.icon {
  width: 1em;
  height: 1em;
}

.word {
  padding: 0px 2px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid transparent;
  text-decoration: none;
  color: black;

  &:not(.selected):hover {
    border: 1px solid #ccc;
  }

  &.selected {
    background-color: red !important;
    color: white;

    &:not(.first-selected) {
      margin-left: -10px;
      padding-left: 14px;
    }
  }

  &.unknown {
    background-color: oklch(80.9% 0.105 251.813);
    &:hover {
      background-color: oklch(70.7% 0.165 254.624);
    }
  }

  &.learning {
    background-color: #ffe58a;
    &:hover {
      background-color: #ffd75a;
    }
  }

  &.familiar {
    background-color: #fff0c2;
    &:hover {
      background-color: #ffe0a2;
    }
  }

  &.strong {
    background-color: #fff8e6;
    &:hover {
      background-color: #fff0d6;
    }
  }
}

.chatbox {
  display: flex;
  flex-direction: column;

  /* 100vh - header - main padding - buffer */
  height: calc(100vh - 105px - 19px - 10px);
  width: 100%;
  border: 1px solid #ccc;

  @media (max-width: 480px) {
    /* 100vh - header - buffer */
    height: calc(100vh - 58px - 25px);
    width: calc(100% + 16px);
    margin: 0 -8px;
  }

  .titlebar {
    display: flex;
    align-items: center;
    border-bottom: 1px solid #ccc;
    padding: 5px;

    .title {
      font-size: 1.1em;
      font-weight: bold;
      flex-grow: 1;
    }

    .actions {
      display: flex;
      align-items: center;
      gap: 10px;
      flex-grow: 0;
      color: rgba(0, 0, 0, 0.5);
      font-size: 0.85rem;
    }
  }

  .messages {
    flex-grow: 1;
    padding: 0 10px 10px;
    overflow-y: auto;

    .message {
      max-width: 90%;

      @media (max-width: 480px) {
        max-width: 95%;
      }

      &.self {
        justify-self: baseline;
        margin-left: auto;

        .user {
          text-align: right;
          margin-right: 15px;
        }
      }

      .content {
        background-color: #eee;
        border-radius: 4px;
        margin: 0 15px 15px 0;
        padding: 15px;

        p {
          margin: 0;
        }
      }

      .meta {
        display: flex;
        margin-top: -15px;
        color: rgba(0, 0, 0, 0.5);
        font-size: 0.85rem;
        gap: 10px;
      }
    }

    .sentence-mode {
      position: relative;

      display: flex;
      align-items: center;
      justify-content: center;
      height: 100%;

      .actions {
        position: absolute;
        top: 5px;
        right: 5px;
      }

      .body {
        display: block;
        text-align: center;
      }
    }
  }

  .message-input {
    margin-bottom: 5px;

    .textarea-wrapper {
      position: relative;
      width: 80%;

      textarea {
        margin-bottom: 0;
      }

      .actions {
        position: absolute;
        right: 5px;
        top: 2px;
        text-align: right;

        button {
          width: 24px;
          height: 24px;
          line-height: 14px;
          padding: 0;
        }
      }
    }

    input[type="submit"] {
      height: 78px;
      width: 20%;
      margin-bottom: 0;
    }
  }

  .status-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    border-top: 1px solid #ccc;
    padding: 5px;
    font-size: 0.8rem;
  }
}

.tooltip-dialog {
  position: absolute;
  z-index: 1000;

  width: 320px;
  max-width: calc(100vw - 32px);

  /* Positioned below the trigger with room for the arrow */
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-60%);

  /* Appearance */
  background: white;
  color: rgb(55, 60, 68);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);

  padding: 0;

  @media (max-width: 480px) {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: calc(100vw - 32px);
    max-width: 320px;
  }

  /* ---- Arrow ---- */
  &::after {
    content: "";
    position: absolute;
    top: -16px;
    left: 50%;
    margin-left: -8px;
    width: 0;
    height: 0;
    border: 8px solid transparent;
    border-bottom-color: white;

    @media (max-width: 480px) {
      display: none;
    }
  }

  .body {
    font-size: 1em;
    padding: 10px;
    overflow: auto;
    text-align: left;
  }

  header {
    padding: 14px 16px 10px;
    font-size: 1.1em;
    font-weight: 600;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;

    .actions {
      display: flex;
      align-items: center;
      gap: 5px;
    }

    button {
      height: 24px;
      width: 24px;
      line-height: 14px;
      padding: 0;
    }
  }

  footer {
    padding: 10px 5px 14px;
    display: flex;
    justify-content: center;
    gap: 5px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    overflow-x: auto;

    button {
      font-size: 0.8em;
    }
  }
}
