/* Simple styles for the Lilo web client. */

@import url('colours.css');

body {
  font-family: Arial, Helvetica, sans-serif;
  max-width: 640px;
  margin: 2rem auto;
  padding: 0 1rem;
  background: var(--color-bg);
  color: var(--color-text);
}

h1 {
  font-size: 1.5rem;
}

section {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}

section h2 {
  font-size: 1.25rem;
}

/* Settings dialog: modal dialog for configuring the Lilo message server. */
#settings {
  position: relative;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 1rem;
  max-width: 640px;
  width: 90%;
  background: var(--color-bg);
  color: var(--color-text);
}

/* Dialog backdrop when shown modally. */
#settings::backdrop {
  background: rgba(0, 0, 0, 0.5);
}

/* Close button for the settings dialog. */
#settingsClose {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem 0.5rem;
  border: none;
  background: var(--color-status-button-bg);
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

#settingsClose:hover {
  opacity: 1;
  color: var(--color-status-close-hover-text);
}

label {
  display: block;
  margin: 1rem 0 0.5rem;
}

input[type='text'],
input[type='file'],
textarea {
  display: block;
  width: 97%;
  margin-top: 0.25rem;
  background: var(--color-input-bg);
  border: 1px solid var(--color-border);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  color: var(--color-text);
  font-size: large;
}

select {
  font-size: large;
  background-color: var(--color-bg);
  color: var(--color-text);
}

textarea {
  min-height: 6rem;
  padding: 0.5rem;
  font-family: inherit;
  resize: vertical;
}

input[type='checkbox'] {
  margin-top: 0.25rem;
  margin-right: 0.5rem;
}

button {
  /* margin-top: 1rem; */
  padding: 0.5rem 1rem;
}

/* Status overlay: fixed at top right. Collapsed by default (single line with
 * the latest message); clicking it toggles to the expanded state to show more
 * messages. High z-index so it stays on top of the settings dialog when it is
 * open. */
#statusOverlay {
  position: fixed;
  top: .5rem;
  right: 0.5rem;
  padding: 0;
  background: var(--color-status-bg);
  border: 1px solid var(--color-status-border);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.875rem;
  max-width: 50%;
  z-index: 2147483647;
  display: none;
}

/* Header of the status overlay: contains the toggle button on the left and
 * the close button on the right. */
#statusOverlayHeader {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Toggle button for expanding/collapsing the status overlay. */
#statusOverlayToggle::before {
  content: '▶';
}

#statusOverlayToggle {
  background: var(--color-status-button-bg);
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: 1rem;
  color: inherit;
  width: 2rem;
  height: 2rem;
}

#statusOverlayToggle:hover {
  opacity: 0.8;
}

/* Show the down arrow when the overlay is expanded (i.e. not collapsed). */
#statusOverlay:not(.status-overlay-collapsed) #statusOverlayToggle::before {
  content: '▼';
}

#statusOverlay.status-overlay-collapsed #statusOverlayMessages {
  max-height: none;
  overflow-y: visible;
}

#statusOverlay.status-overlay-collapsed .status-message {
  margin: 0;
  padding: 0;
  border-bottom: none;
}

#statusOverlay.status-overlay-collapsed .status-message-timestamp {
  display: none;
}

/* Scrollable list of status messages inside the overlay. Only the messages
 * scroll, so the close button stays at a fixed position while the user scrolls
 * through the messages. */
#statusOverlayMessages {
  max-height: 30vh;
  overflow-y: auto;
  padding: .5rem;
}

/* Close button for the status overlay. */
#statusOverlayClose {
  margin: 0;
  padding: 0.25rem 0.5rem;
  border: none;
  background: var(--color-status-button-bg);
  color: inherit;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  opacity: 0.7;
}

#statusOverlayClose:hover {
  opacity: 1;
  color: var(--color-status-close-hover-text);
}

/* Individual status message inside the overlay. Text color maps to the message type. */
#statusOverlayMessages .status-message {
  margin: 0.5rem 0;
  padding: 0 0 0.5rem 0;
  border-bottom: 1px solid var(--color-status-message-border);
}

#statusOverlayMessages .status-message:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

/* Message text colors by type. */
#statusOverlayMessages .status-message.status-error {
  color: #cc3333;
}

#statusOverlayMessages .status-message.status-success {
  color: #339933;
}

#statusOverlayMessages .status-message.status-warning {
  color: #cc9933;
}

#statusOverlayMessages .status-message.status-info {
  color: #3366cc;
}

/* Timestamp of each status message: small, muted text below the message. */
#statusOverlayMessages .status-message-timestamp {
  font-size: 0.75rem;
  color: var(--color-status-timestamp);
  margin-top: 0.25rem;
}

/* Drop area: surrounding area for drag and drop file upload. */
#dropArea {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin-top: 0.5rem;
  border: 2px dashed var(--color-file-list-border);
  border-radius: 4px;
  background: var(--color-file-list-bg);
  cursor: pointer;
}

#dropArea.drag-over {
  border-color: var(--color-accent);
  background: var(--color-pre-bg);
}

#dropArea label {
  margin-bottom: 0.5rem;
  display: block;
}

.drop-hint {
  margin-top: 0.5rem;
  font-style: italic;
  color: var(--color-status-timestamp);
}

/* File list styles */
#fileList {
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--color-file-list-border);
  border-radius: 4px;
  background: var(--color-file-list-bg);
}

#messageControls {
  margin-top: 1rem;
}

.file-entry {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25rem 0;
  border-bottom: 1px solid var(--color-file-entry-border);
}

.file-entry:last-child {
  border-bottom: none;
}

.remove-file {
  background: var(--color-remove-bg);
  color: white;
  border: none;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
}

.remove-file:hover {
  background: var(--color-remove-hover);
}

/* Settings dialog messages: status messages shown inside the settings dialog
 * so they remain visible even when the status overlay is hidden. */
#settingsMessages .settings-message {
  margin: 0.5rem 0;
  padding: 0 0 0.5rem 0;
  border-bottom: 1px solid var(--color-status-message-border);
}

#settingsMessages .settings-message:last-child {
  margin-bottom: 0;
  border-bottom: none;
}

#settingsMessages .settings-message.settings-error {
  color: #cc3333;
}

#settingsMessages .settings-message.settings-success {
  color: #339933;
}

#settingsMessages .settings-message.settings-warning {
  color: #cc9933;
}

#settingsMessages .settings-message.settings-info {
  color: #3366cc;
}
