/* Styles.css */

/* Global styling */
:root {
  --red: #cc0007;
  --black: #000;
  --light: #f6f1eb;
  --lighter: #fffcf7;
  --gray: #666;
  --white: #fff;
}

/* Loader styling */
.oic__loader {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100%;
  font-size: 18px;
  color: var(--black);
  background-color: var(--lighter);
}

/* Loading skeleton */
.oic__skeleton {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding: 15px;
  min-height: 95%;
  box-sizing: border-box;
}

.oic__skeleton-message {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.oic__skeleton-header {
  width: 150px;
  height: 14px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.oic__skeleton-text {
  width: 100%;
  height: 16px;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: skeleton-loading 1.5s ease-in-out infinite;
  border-radius: 4px;
}

.oic__skeleton-text.short {
  width: 70%;
}

@keyframes skeleton-loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Elements */
.oic {
  width: 450px;
  max-width: 100%;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
}

.oic .oic__messages {
  height: calc(100% - 60px);
  overflow-y: auto;
  padding-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-right: 28px;
  scrollbar-color: var(--gray) var(--light);
}

.oic .oic__messages::-webkit-scrollbar-track {
  background: var(--light);
  border: 0 !important;
}

.oic .oic__messages::-webkit-scrollbar-thumb {
  background-color: var(--gray);
  border-radius: 0 !important;
  border: 0 !important;
}

.oic .oic__messages > :first-child {
  margin-top: auto;
}

.oic .oic__messages p {
  margin: 0;
}

.oic__message {
  padding-left: 10px;
}

.oic .oic__meta {
  margin-left: -5px !important;
  font-weight: 600;
  margin-bottom: 5px;
  font-size: 14px;
  color: var(--gray);
}

.oic .oic__text {
  margin-bottom: 5px;
  font-size: 15px;
}

.oic .oic__text strong {
  color: var(--gray);
  font-weight: 600;
}

.oic .oic__time {
  font-size: 12px;
  color: var(--gray);
}

.oic .oic__bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  height: 40px;
  margin-top: 10px;
}

.oic__bottom__input {
  display: flex;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--gray);
  border-radius: 20px;
  background-color: var(--lighter);
  flex: 1;
}

.oic__bottom button {
  width: 34px;
  height: 34px;
  box-shadow: none;
  border: 0;
  border-radius: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.oic__bottom .oic__button {
  margin-right: 1px;
  background-color: var(--gray);
  padding: 7px;
  transition: 0.3s ease-in-out;
}

.oic__bottom .oic__button:hover {
  background-color: var(--black);
}

/* Loading state for send button */
.oic__button.loading {
  opacity: 0.6;
  cursor: not-allowed;
  position: relative;
}

.oic__button.loading img {
  opacity: 0.3;
}

.oic__button.loading::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--white);
  border-top-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.6s linear infinite;
}

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

/* Focus styles for accessibility */
.oic__input:focus {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.oic__button:focus {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.oic__reply-button:focus,
.oic__react-button:focus {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.oic__reaction-button:focus {
  outline: 2px solid var(--black);
  outline-offset: 1px;
}

.service:focus {
  outline: 2px solid var(--black);
  outline-offset: 2px;
}

.oic__bottom .oic__bottom__service {
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  margin-bottom: 1px;
}
.oic__bottom .oic__bottom__service .service {
  background-color: transparent;
  padding: 0;
}
.oic__bottom .oic__bottom__service .service:disabled {
  display: none;
}

.oic__bottom .oic__bottom__service span {
  font-size: 12px;
  color: var(--black);
  white-space: nowrap;
}

.oic__bottom .oic__bottom__service img {
  filter: brightness(0);
}

.oic__bottom button img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.oic .oic__bottom .oic__input {
  color: var(--black);
  font-size: 16px;
  line-height: 1.2;
  flex: 1;
  padding: 10px;
  text-indent: 10px;
  background-color: transparent !important;
  border: 0 !important;
  width: 100%;
}

.oic .oic__bottom .oic__input::placeholder {
  color: var(--gray);
}

/* Input wrapper for character counter positioning */
.oic__input-wrapper {
  position: relative;
  flex: 1;
}

/* Character counter - tiny, top-left */
.oic__char-counter {
  position: absolute;
  top: -12px;
  left: 0;
  font-size: 9px;
  color: var(--gray);
  opacity: 0.6;
  pointer-events: none;
  transition: color 0.3s ease, opacity 0.3s ease;
  z-index: 1;
  line-height: 1;
}

.oic__char-counter--warning {
  color: var(--red);
  opacity: 1;
  font-weight: 600;
}

/* Mention autocomplete */
.oic__mention-autocomplete {
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid #ccc;
  border-radius: 4px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
  z-index: 100;
  margin-bottom: 5px;
}

.oic__mention-item {
  padding: 10px 15px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid #f0f0f0;
}

.oic__mention-item:last-child {
  border-bottom: none;
}

.oic__mention-item:hover,
.oic__mention-item.active {
  background-color: var(--light);
}

.oic__mention-item strong {
  color: var(--black);
  font-weight: 600;
}

/* Typing indicator */
.oic__typing-indicator {
  font-size: 13px;
  color: var(--gray);
  font-style: italic;
  padding: 8px 15px;
  background-color: var(--lighter);
  border-top: 1px solid #e0e0e0;
}

.oic__typing-dots {
  display: inline-block;
  margin-left: 2px;
}

.oic__typing-dots span {
  animation: typing-dot 1.4s infinite;
  opacity: 0;
}

.oic__typing-dots span:nth-child(1) {
  animation-delay: 0s;
}

.oic__typing-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.oic__typing-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-dot {
  0%,
  60%,
  100% {
    opacity: 0;
  }
  30% {
    opacity: 1;
  }
}

.oic__reactions {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 5px;
  margin-bottom: 5px;
  padding: 5px 10px;
  position: relative;
}

.oic__reply-button,
.oic__react-button {
  font-size: 13px;
  margin-right: 5px;
  color: var(--black);
  font-weight: 600;
  background-color: transparent;
  padding: 0;
}

.oic__reply-button:hover,
.oic__reply-button:active,
.oic__react-button:hover,
.oic__react-button:active {
  text-decoration: underline;
  background-color: transparent;
  color: var(--black);
}
.oic__reply-button:visited,
.oic__reply-button:focus,
.oic__react-button:visited,
.oic__react-button:focus {
  color: var(--black);
  background-color: transparent;
  text-decoration: none;
}

.oic__tooltip {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  transform: translateY(-5px);
  background-color: var(--white);
  border: 1px solid var(--gray);
  padding: 5px;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1;
}
.oic__tooltip__content {
  display: flex;
  align-items: center;
}

.oic__reaction-button {
  font-size: 14px;
  background-color: var(--light);
  width: 25px;
  height: 25px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.oic__reaction-count {
  font-size: 14px;
}

/* LIVE div styling */
#cgc-live-cta {
  z-index: 999;
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 70px;
  height: 70px;
  padding: 15px;
  font-size: 14px;
  text-align: center;
  border-radius: 70px;
  display: flex;
  justify-content: center;
  align-items: center;
  background-color: var(--lighter);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: 0.3s ease-in-out;
  text-decoration: none;
  flex-direction: column;
  gap: 7px;
}

#cgc-live-cta:hover {
  background-color: var(--white);
}

#cgc-live-cta img {
  object-fit: contain;
}

#cgc-live-cta span {
  font-weight: bold;
  line-height: 1;
  letter-spacing: 1px;
  color: var(--red);
  transition: 0.3s ease-in-out;
}

#cgc-live-cta:hover span {
  color: var(--red);
}

.admin-badge {
  background-color: #007bff;
  color: #fff;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 5px;
}

/* Link preview */
.cgc-link-preview {
  display: flex;
  gap: 10px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  overflow: hidden;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.6);
  max-width: 520px;
}
.cgc-link-preview-thumb img {
  display: block;
  width: 150px;
  height: 100%;
  object-fit: cover;
}
.cgc-link-preview-body {
  padding: 8px;
  font-size: 13px;
  line-height: 1.2;
}
.cgc-link-preview-title {
  font-weight: 600;
  margin-bottom: 4px;
}
.cgc-link-preview-desc {
  color: #555;
  margin-bottom: 6px;
}
.cgc-link-preview-url {
  font-size: 12px;
  color: #777;
}

/* Responsiveness */
@media only screen and (max-width: 767px) {
  .oic {
    width: 100%;
  }
  .stream-chat {
    background-color: rgba(0, 0, 0, 0.07) !important;
  }
  .oic .oic__bottom {
    padding-left: 15px;
    padding-right: 15px;
  }
  .oic .oic__messages {
    padding-right: 15px;
  }
  .oic .oic__meta,
  .oic .oic__text,
  .oic .oic__time,
  .oic .oic__text a,
  .oic__bottom .oic__bottom__service span {
    color: var(--white);
  }
  .not-live {
    color: var(--white);
    text-align: center;
    font-size: 14px;
    width: 100%;
  }
  .oic .oic__bottom .oic__button,
  .oic__reply-button,
  .oic__react-button,
  .oic__reaction-counts,
  .oic__reaction-counts * {
    color: var(--white);
  }
  .oic .oic__text strong {
    color: var(--white);
    font-weight: 500;
  }
  .oic__reply-button:hover,
  .oic__react-button:hover {
    color: var(--white);
  }
  .oic__bottom button.service {
    background-color: var(--white);
  }
  .oic__bottom .oic__bottom__service {
    gap: 5px;
    -webkit-gap: 5px;
  }
  .oic__bottom .oic__bottom__service img {
    filter: none;
  }
  #cgc-live-cta {
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
  }
  .oic .oic__meta .username,
  .oic .oic__time {
    opacity: 0.5;
  }
}
