/* FILE: public/assets/css/cooperation.css */

.cooperation-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  width: min(420px, calc(100vw - 24px));
  height: min(720px, calc(100vh - 48px));
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}

.cooperation-widget--open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.cooperation-widget__panel {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.24);
}

.cooperation-widget__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #111827;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

.cooperation-iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

/* Страница /cooperation.html */

.coop-body {
  margin: 0;
  background: #f3f4f6;
  color: #111827;
}

.coop-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-height: 0;
  background: #ffffff;
}

.coop-header {
  flex: 0 0 auto;
  padding: 18px 20px 16px;
  border-bottom: 1px solid #e5e7eb;
  background: rgba(255, 255, 255, 0.96);
}

.coop-header__title {
  margin: 0 0 6px;
  color: #111827;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 700;
}

.coop-header__subtitle {
  color: #6b7280;
  font-size: 14px;
  line-height: 1.55;
}

.coop-main {
  flex: 1 1 auto;
  min-height: 0;
  background: #f8fafc;
}

.coop-messages {
  height: 100%;
  padding: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  -webkit-overflow-scrolling: touch;
}

.coop-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.coop-row--user {
  justify-content: flex-end;
}

.coop-row--lidon {
  justify-content: flex-start;
}

.coop-avatar {
  width: 34px;
  height: 34px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}

.coop-avatar--lidon {
  background: #111827;
  color: #ffffff;
}

.coop-avatar--user {
  background: #dbeafe;
  color: #1d4ed8;
}

.coop-bubble {
  max-width: min(78%, 520px);
  padding: 12px 14px;
  border-radius: 18px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.06);
}

.coop-bubble--lidon {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 8px;
}

.coop-bubble--user {
  background: #111827;
  color: #ffffff;
  border: 1px solid #111827;
  border-bottom-right-radius: 8px;
}

.coop-bubble__text {
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

.coop-bubble__meta {
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.4;
  opacity: 0.72;
}

.coop-attachment {
  margin-top: 10px;
}

.coop-attachment__img {
  display: block;
  max-width: 220px;
  border-radius: 12px;
}

.coop-attachment__file {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.06);
  color: inherit;
  font-size: 14px;
  line-height: 1.4;
}

.coop-composer {
  flex: 0 0 auto;
  border-top: 1px solid #e5e7eb;
  background: #ffffff;
  padding: 14px 16px 16px;
}

.coop-attach {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  background: #f9fafb;
}

.coop-attach__preview {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 12px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
}

.coop-attach__preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.coop-attach__meta {
  min-width: 0;
  flex: 1 1 auto;
}

.coop-attach__name {
  color: #111827;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 600;
  word-break: break-word;
}

.coop-attach__hint {
  margin-top: 2px;
  color: #6b7280;
  font-size: 12px;
  line-height: 1.45;
}

.coop-attach__remove {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
}

.coop-attach__fileicon {
  font-size: 18px;
  line-height: 1;
}

.coop-composer__row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.coop-iconbtn,
.coop-send {
  width: 44px;
  height: 44px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #ffffff;
  color: #111827;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    background-color 0.12s ease,
    border-color 0.12s ease,
    transform 0.12s ease;
}

.coop-iconbtn:hover,
.coop-send:hover {
  background: #f9fafb;
  transform: translateY(-1px);
}

.coop-composer__text {
  flex: 1 1 auto;
  min-height: 48px;
  max-height: 180px;
  padding: 12px 14px;
  border: 1px solid #d1d5db;
  border-radius: 18px;
  background: #ffffff;
  color: #111827;
  font-size: 14px;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  transition:
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.coop-composer__text::placeholder {
  color: #9ca3af;
}

.coop-composer__text:focus {
  border-color: #94a3b8;
  box-shadow: 0 0 0 4px rgba(148, 163, 184, 0.18);
}

@media (max-width: 640px) {
  .cooperation-widget {
    left: 10px;
    right: 10px;
    top: calc(env(safe-area-inset-top, 0px) + 14px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
    width: auto;
    height: auto;
    max-height: calc(100vh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  }

  @supports (height: 100dvh) {
    .cooperation-widget {
      max-height: calc(100dvh - 28px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
    }
  }

  .cooperation-widget__panel {
    border-radius: 20px;
  }

  .cooperation-widget__close {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 26px;
  }

  .coop-shell {
    height: 100vh;
    min-height: 0;
  }

  @supports (height: 100dvh) {
    .coop-shell {
      height: 100dvh;
    }
  }

  .coop-header {
    padding: 16px 58px 14px 16px;
  }

  .coop-header__title {
    font-size: 18px;
  }

  .coop-header__subtitle {
    font-size: 13px;
  }

  .coop-messages {
    padding: 14px;
    gap: 12px;
  }

  .coop-bubble {
    max-width: 86%;
    padding: 11px 12px;
  }

  .coop-bubble__text {
    font-size: 13px;
  }

  .coop-composer {
    padding: 12px 12px calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .coop-composer__row {
    gap: 8px;
  }

  .coop-iconbtn,
  .coop-send {
    width: 42px;
    height: 42px;
  }

  .coop-composer__text {
    min-height: 44px;
    max-height: 120px;
    padding: 11px 12px;
    font-size: 13px;
  }

  .coop-attach {
    gap: 10px;
    padding: 10px;
  }

  .coop-attach__preview {
    width: 42px;
    height: 42px;
  }
}

@media (max-width: 380px) {
  .cooperation-widget {
    left: 6px;
    right: 6px;
    top: calc(env(safe-area-inset-top, 0px) + 10px);
    bottom: calc(env(safe-area-inset-bottom, 0px) + 10px);
  }

  .cooperation-widget__panel {
    border-radius: 16px;
  }

  .coop-header {
    padding-left: 14px;
  }

  .coop-messages {
    padding: 12px;
  }

  .coop-composer {
    padding-left: 10px;
    padding-right: 10px;
  }
}