/* ========================================================== */
/* KOROTKOV LIVE CHAT WIDGET - MODERN MANAGER INTERFACE       */
/* ========================================================== */
.kk-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--kk-font-sans, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
}

/* Floating Trigger Button */
.kk-chat-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #128a38 0%, #0fa938 100%);
  color: #ffffff;
  border: none;
  box-shadow: 0 10px 28px rgba(15, 169, 56, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s ease;
  outline: none;
}

.kk-chat-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 34px rgba(15, 169, 56, 0.55);
}

/* ENLARGED ICON INSIDE 60px BUTTON */
.kk-chat-btn__icon {
  font-size: 34px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.kk-chat-btn__icon i {
  font-size: 34px;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.kk-chat-btn__icon--close {
  display: none;
  font-size: 26px;
}

.kk-chat-btn__icon--close i {
  font-size: 26px;
}

.kk-chat-widget.is-open .kk-chat-btn__icon--chat {
  display: none;
}

.kk-chat-widget.is-open .kk-chat-btn__icon--close {
  display: flex;
}

.kk-chat-btn__badge {
  position: absolute;
  top: -3px;
  right: -3px;
  background: #ff334b;
  color: #ffffff;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  border: 2px solid #ffffff;
  box-shadow: 0 3px 8px rgba(255, 51, 75, 0.5);
  animation: kk-badge-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
  line-height: 1;
  z-index: 10;
}

@keyframes kk-badge-pop {
  0% { transform: scale(0); }
  75% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

.kk-chat-btn__badge.kk-badge-animate {
  animation: kk-badge-pop 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes kk-badge-pop {
  0% { transform: scale(0); }
  80% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.kk-chat-btn__pulse {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(15, 169, 56, 0.5);
  animation: kk-chat-pulse 2.2s infinite;
  pointer-events: none;
}

@keyframes kk-chat-pulse {
  0% { transform: scale(0.95); opacity: 0.8; }
  50% { transform: scale(1.25); opacity: 0; }
  100% { transform: scale(1.25); opacity: 0; }
}

.kk-chat-widget.is-open .kk-chat-btn__pulse {
  display: none;
}

/* Chat Window */
.kk-chat-window {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 385px;
  height: 560px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(12, 33, 25, 0.25), 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(20, 61, 52, 0.1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transform-origin: bottom right;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 10000;
}

.kk-chat-widget.is-open .kk-chat-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.kk-chat-window__header {
  padding: 14px 18px;
  background: linear-gradient(135deg, #11382e 0%, #174d40 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.kk-chat-window__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none !important;
  cursor: default !important;
}

.kk-chat-window__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  pointer-events: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  -webkit-user-drag: none !important;
}

.kk-chat-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #25d366;
  border: 2px solid #11382e;
}

.kk-chat-window__info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.kk-chat-window__info strong {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.2px;
}

.kk-chat-window__info small {
  font-size: 11.5px;
  color: #a4d4c5;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kk-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #25d366;
  display: inline-block;
  box-shadow: 0 0 6px #25d366;
}

.kk-chat-window__close {
  background: linear-gradient(135deg, #e85555 0%, #cf3232 100%);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(207, 50, 50, 0.45);
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background 0.2s ease;
  outline: none;
}

.kk-chat-window__close:hover {
  background: linear-gradient(135deg, #f06060 0%, #db3939 100%);
  color: #ffffff;
  transform: scale(1.08) translateY(-1px);
  box-shadow: 0 6px 18px rgba(207, 50, 50, 0.6);
}

.kk-chat-window__close:active {
  transform: scale(0.95);
}

/* Chat Body / Messages Area */
.kk-chat-window__body {
  flex: 1;
  padding: 14px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8faf9;
  scroll-behavior: smooth;
}

.kk-chat-window__body::-webkit-scrollbar {
  width: 5px;
}
.kk-chat-window__body::-webkit-scrollbar-thumb {
  background: #cfdcd6;
  border-radius: 10px;
}

/* System Notice Card (Do not leave / Response coming soon) */
.kk-chat-notice-card {
  background: #edf7f1;
  border: 1px solid #c2e5d1;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: #1a4231;
  display: flex;
  gap: 9px;
  align-items: flex-start;
  box-shadow: 0 2px 5px rgba(23, 77, 64, 0.04);
}

.kk-chat-notice-card__icon {
  font-size: 15px;
  color: #0fa938;
  margin-top: 1px;
  flex-shrink: 0;
}

.kk-chat-notice-card__content strong {
  color: #0f6128;
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

/* Message Bubbles */
.kk-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: kk-msg-fade 0.25s ease;
}

@keyframes kk-msg-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.kk-chat-msg--operator {
  align-self: flex-start;
}

.kk-chat-msg--visitor {
  align-self: flex-end;
}

.kk-chat-msg__bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
}

.kk-chat-msg--operator .kk-chat-msg__bubble {
  background: #ffffff;
  color: #143d34;
  border: 1px solid rgba(20, 61, 52, 0.1);
  border-top-left-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
}

.kk-chat-msg--visitor .kk-chat-msg__bubble {
  background: linear-gradient(135deg, #128a38 0%, #0fa938 100%);
  color: #ffffff;
  border-top-right-radius: 4px;
  box-shadow: 0 3px 10px rgba(15, 169, 56, 0.25);
}

.kk-chat-msg__time {
  font-size: 10px;
  color: #8c9e97;
  margin-top: 3px;
  padding: 0 4px;
}

.kk-chat-msg--visitor .kk-chat-msg__time {
  align-self: flex-end;
}

/* Immediate Acknowledgment Notice */
.kk-chat-ack-notice {
  background: #fff8e6;
  border: 1px dashed #e8c468;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.4;
  color: #7d5705;
  animation: kk-msg-fade 0.3s ease;
}

.kk-chat-ack-notice strong {
  color: #634300;
}

/* Footer Wrap */
.kk-chat-window__footer-wrap {
  flex-shrink: 0;
  background: #ffffff;
  border-top: 1px solid rgba(20, 61, 52, 0.08);
}

/* Visitor Identity Form Bar */
.kk-chat-user-bar {
  padding: 10px 14px;
  background: #f7faf8;
  border-bottom: 1px solid rgba(20, 61, 52, 0.06);
  transition: all 0.25s ease;
}

.kk-chat-user-bar__title {
  font-size: 11px;
  font-weight: 600;
  color: #2b5646;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.kk-chat-user-bar__title i {
  color: #0fa938;
}

.kk-chat-field-group {
  display: flex;
  gap: 8px;
}

.kk-chat-field-wrap {
  flex: 1;
  position: relative;
  min-width: 0;
}

.kk-chat-input-field {
  width: 100%;
  height: 35px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1.5px solid #d4dfda;
  font-size: 12px;
  font-family: inherit;
  color: #143d34;
  background: #ffffff;
  outline: none;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.kk-chat-input-field::placeholder {
  color: #8c9e97;
}

.kk-chat-input-field:focus {
  border-color: #0fa938;
  box-shadow: 0 0 0 3px rgba(15, 169, 56, 0.15);
}

/* RED HIGHLIGHT ERROR STATE FOR NAME */
.kk-chat-input-field.is-invalid {
  border-color: #e63946 !important;
  background-color: #fff5f5 !important;
  color: #c9182b !important;
  box-shadow: 0 0 0 3px rgba(230, 57, 70, 0.25) !important;
  animation: kk-shake 0.4s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

@keyframes kk-shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-3px, 0, 0); }
  40%, 60% { transform: translate3d(3px, 0, 0); }
}

.kk-field-error-tooltip {
  display: none;
  position: absolute;
  top: -24px;
  left: 0;
  background: #e63946;
  color: #ffffff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.35);
  z-index: 10;
  animation: kk-pop 0.2s ease;
}

@keyframes kk-pop {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.kk-field-error-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 12px;
  border: 4px solid transparent;
  border-top-color: #e63946;
}

.kk-chat-field-wrap.has-error .kk-field-error-tooltip {
  display: block;
}

/* Visitor Badge (when contact info is saved) */
.kk-chat-user-badge {
  padding: 7px 14px;
  background: #edf7f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11.5px;
  color: #143d34;
  border-bottom: 1px solid rgba(20, 61, 52, 0.06);
}

.kk-badge-info {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.kk-badge-info i {
  color: #0fa938;
}

.kk-badge-info strong {
  color: #11382e;
  font-weight: 700;
}

.kk-badge-contact-val {
  color: #3f6858;
  font-size: 11px;
}

.kk-badge-edit-btn {
  background: none;
  border: none;
  color: #0fa938;
  font-size: 11px;
  text-decoration: underline;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
  font-weight: 600;
}

.kk-badge-edit-btn:hover {
  color: #128a38;
}

/* Chat Input Form */
.kk-chat-window__footer {
  padding: 10px 14px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: #ffffff;
}

.kk-chat-window__footer textarea {
  flex: 1;
  resize: none;
  height: 38px;
  max-height: 90px;
  border: 1.5px solid #d4dfda;
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  font-family: inherit;
  color: #143d34;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.kk-chat-window__footer textarea:focus {
  border-color: #0fa938;
  box-shadow: 0 0 0 3px rgba(15, 169, 56, 0.15);
}

.kk-chat-window__footer button {
  width: 40px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(135deg, #128a38 0%, #0fa938 100%);
  color: #ffffff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
}

.kk-chat-window__footer button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 169, 56, 0.35);
}

/* Mobile Adaptation */
@media (max-width: 480px) {
  .kk-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  .kk-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100vh;
    border-radius: 0;
    transform: translateY(100%);
  }
  .kk-chat-widget.is-open .kk-chat-window {
    transform: translateY(0);
  }
}
