/*
 * Copyright 2019 dialog LLC <info@dlg.im>
 */

@import '../../styles/variables.css';

:root {
  --message-attachment-font-family: var(--default-font-family);
  --message-attachment-background: color-mod(#000 alpha(3%));
  --message-attachment-font-size: var(--default-font-size-small);
  --message-attachment-padding: 10px;
  --message-attachment-forward-padding: 10px;
  --message-attachment-border-color: color-mod(
    var(--message-attachment-background) shade(5%)
  );
  --message-attachment-from-font-size: 14px;
  --message-attachment-from-color: #939393;
  --message-attachment-header-line-height: 20px;
  --message-attachment-nick-color: color-mod(#000 alpha(60%));
  --message-attachment-timestamp-font-size: 12px;
  --message-attachment-timestamp-color: var(--message-attachment-nick-color);
  --message-attachment-preview-size: 36px;
}

.container {
  font-family: var(--message-attachment-font-family);
  border-radius: 2px;
  background-color: var(--message-attachment-background);
  display: block;
}

.itemContainer {
  cursor: pointer;

  &:first-child {
    margin-top: 0;
  }
}

.from {
  height: 100%;
  display: flex;
  line-height: var(--message-attachment-header-line-height);
  padding: 6px var(--message-attachment-padding) 0;
  font-size: var(--message-attachment-from-font-size);
  color: var(--message-attachment-from-color);
}

.fromPrefix {
  flex: 0 0 auto;
}

.fromButton {
  flex: 0 1 auto;
  margin-left: 6px;
  line-height: var(--message-attachment-header-line-height);
  color: var(--color-primary);
  font-size: var(--message-attachment-from-font-size);
  cursor: pointer;
  @mixin text-overflow-ellipsis;
}

.fromIcon {
  display: inline-block;
  vertical-align: top;
  margin-right: 2px;
  color: currentColor;
}

.fromTitle {
  display: inline;
}

.header {
  margin-bottom: 4px;
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  align-content: center;
  justify-content: flex-start;
  height: var(--message-attachment-header-line-height);
  line-height: var(--message-attachment-header-line-height);
}

.icon {
  flex: 0 0 auto;
  margin-right: 4px;
  color: var(--message-attachment-from-color);
}

.title {
  display: inline-flex;
  flex: 0 1 auto;
  overflow: hidden;
  height: var(--message-attachment-header-line-height);
}

.name {
  flex: 0 1 auto;
  font-size: var(--default-font-size);
  font-weight: 500;
  @mixin text-overflow-ellipsis;
}

.nick {
  display: block;
  flex: 0 0 auto;
  font-size: var(--default-font-size-small);
  color: var(--message-attachment-nick-color);

  /* Uncoment to enable text overflow for nickname */
  /* flex: 0 1 auto; */
  /* @mixin text-overflow-ellipsis; */
}

.reply {
  padding: 4px var(--message-attachment-padding);
}

.replyContent {
  width: 100%;
  display: block;
  @mixin text-overflow-ellipsis;
}

.forward {
  padding: 3px var(--message-attachment-forward-padding);

  &:first-child {
    padding-top: 6px;
  }

  &:last-child {
    padding-bottom: 6px;
  }
}

.content {
  display: block;
}

/* .messageWrapper {} */

.message {
  font-size: var(--message-attachment-font-size);
  line-height: 20px;
}

.timeWrapper {
  display: inline-block;
}

.time {
  color: var(--message-attachment-timestamp-color);
  font-size: var(--message-attachment-timestamp-font-size);
}

.timestamp {
  composes: time;
  flex: 0 0 auto;
}

.fulltime {
  composes: time;
  display: block;
  margin-top: 2px;
  height: 20px;
  line-height: 20px;
}

.short {
  margin-top: 0;
}

.preview {
  margin-top: 6px;
  display: block;
  width: var(--message-attachment-preview-size);
  height: var(--message-attachment-preview-size);
  background-position: 50% 50%;
  background-size: cover;
  border-radius: var(--default-border-radius-small);
  box-shadow: 0 0 0 1px color-mod(#000 alpha(15%));
}

.messageType {
  color: var(--color-primary);
}
