/* ISISA Chat Widget Styles */

#isisa-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: 'SUSE', 'Work Sans', sans-serif;
  color: #f8fafc;
}

#isisa-chat-fab {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e6fb7 0%, #3b82f6 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 32px rgba(30, 111, 183, 0.4);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
}
#isisa-chat-fab:hover {
  transform: scale(1.08) translateY(-4px);
  box-shadow: 0 12px 40px rgba(30, 111, 183, 0.6);
}

#isisa-chat-fab svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: transform 0.3s ease;
}

#isisa-chat-fab.isisa-open svg {
  transform: rotate(90deg) scale(0);
  opacity: 0;
}

#isisa-chat-close-icon {
  position: absolute;
  width: 28px;
  height: 28px;
  fill: #fff;
  transform: rotate(-90deg) scale(0);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

#isisa-chat-fab.isisa-open #isisa-chat-close-icon {
  transform: rotate(0) scale(1);
  opacity: 1;
}

#isisa-chat-unread-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #ef4444;
  color: white;
  font-size: 11px;
  font-weight: 700;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #060913;
  display: none;
}

#isisa-chat-panel {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 360px;
  height: 540px;
  max-height: calc(100vh - 120px);
  background: rgba(15, 21, 35, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid #23314a;
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#isisa-chat-panel.isisa-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Header */
.isisa-chat-header {
  padding: 16px 20px;
  background: #161e31;
  border-bottom: 1px solid #23314a;
  display: flex;
  align-items: center;
  gap: 12px;
}
.isisa-chat-header-info {
  flex-grow: 1;
}
.isisa-chat-h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
  line-height: 1.2;
}
.isisa-chat-subtitle {
  font-size: 12px;
  color: #8b9bb4;
  margin-top: 2px;
}
.isisa-chat-header-btn {
  background: transparent;
  border: none;
  color: #8b9bb4;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-size: 18px;
}
.isisa-chat-header-btn:hover {
  background: #23314a;
  color: #f8fafc;
}

/* Views Container */
.isisa-chat-views {
  display: flex;
  width: 200%;
  flex: 1 1 0;
  min-height: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.isisa-chat-views.show-msgs {
  transform: translateX(-50%);
}

.isisa-chat-view {
  width: 50%;
  height: 100%;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
}

/* Conversation List */
.isisa-chat-conv-list {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 12px;
  min-height: 0;
}
.isisa-chat-conv-list::-webkit-scrollbar { width: 6px; }
.isisa-chat-conv-list::-webkit-scrollbar-thumb { background: #23314a; border-radius: 10px; }

.isisa-conv-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.isisa-conv-item:hover {
  background: #1b253c;
}
.isisa-conv-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #23314a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.isisa-conv-details {
  flex-grow: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.isisa-conv-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.isisa-conv-name {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.isisa-conv-time {
  font-size: 11px;
  color: #8b9bb4;
  white-space: nowrap;
}
.isisa-conv-last-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.isisa-conv-last {
  font-size: 12px;
  color: #8b9bb4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.isisa-conv-unread {
  background: #ef4444;
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
  margin-left: 8px;
}

/* Messages View */
.isisa-chat-msg-list {
  flex: 1 1 0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}
.isisa-chat-msg-list::-webkit-scrollbar { width: 6px; }
.isisa-chat-msg-list::-webkit-scrollbar-thumb { background: #23314a; border-radius: 10px; }

.isisa-chat-date-sep {
  text-align: center;
  font-size: 11px;
  color: #8b9bb4;
  margin: 8px 0;
  position: relative;
}
.isisa-chat-date-sep::before,
.isisa-chat-date-sep::after {
  content: '';
  position: absolute;
  top: 50%;
  width: calc(50% - 40px);
  height: 1px;
  background: #23314a;
}
.isisa-chat-date-sep::before { left: 0; }
.isisa-chat-date-sep::after { right: 0; }

.isisa-msg {
  max-width: 85%;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.isisa-msg.me {
  align-self: flex-end;
  align-items: flex-end;
}
.isisa-msg.other {
  align-self: flex-start;
  align-items: flex-start;
}
.isisa-msg-sender {
  font-size: 11px;
  color: #8b9bb4;
  margin-left: 4px;
}
.isisa-msg.me .isisa-msg-sender {
  display: none;
}
.isisa-msg-bubble {
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  word-wrap: break-word;
}
.isisa-msg.me .isisa-msg-bubble {
  background: #3b82f6;
  color: #fff;
  border-bottom-right-radius: 6px;
}
.isisa-msg.other .isisa-msg-bubble {
  background: #23314a;
  color: #f8fafc;
  border-bottom-left-radius: 6px;
}
.isisa-msg-time {
  font-size: 10px;
  color: #8b9bb4;
  margin-top: 2px;
}

/* Input Area */
.isisa-chat-input-area {
  padding: 12px 16px;
  background: #161e31;
  border-top: 1px solid #23314a;
  display: flex;
  gap: 10px;
  align-items: center;
}
.isisa-chat-input {
  flex-grow: 1;
  background: #0f1523;
  border: 1px solid #23314a;
  border-radius: 20px;
  padding: 12px 16px;
  color: #f8fafc;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  max-height: 80px;
}
.isisa-chat-input:focus {
  border-color: #3b82f6;
}
.isisa-chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #3b82f6;
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.isisa-chat-send:hover {
  filter: brightness(1.15);
  transform: scale(1.05);
}
.isisa-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.isisa-chat-send svg {
  fill: currentColor;
  width: 18px;
  height: 18px;
  margin-left: 2px;
}

.isisa-chat-emoji-btn {
  background: transparent;
  border: none;
  color: #8b9bb4;
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.isisa-chat-emoji-btn:hover {
  color: #f8fafc;
}

.isisa-emoji-picker {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 10px;
  background: #161e31;
  border: 1px solid #23314a;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 10;
}
.isisa-emoji-picker::-webkit-scrollbar { width: 6px; }
.isisa-emoji-picker::-webkit-scrollbar-thumb { background: #23314a; border-radius: 10px; }

.isisa-emoji-item {
  cursor: pointer;
  font-size: 20px;
  text-align: center;
  transition: transform 0.2s;
  user-select: none;
}
.isisa-emoji-item:hover {
  transform: scale(1.3);
}

.isisa-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #8b9bb4;
  font-size: 14px;
}

.isisa-new-chat-btn {
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  border: 1px dashed #3b82f6;
  background: rgba(59, 130, 246, 0.05);
  color: #3b82f6;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  margin-bottom: 12px;
  transition: all 0.2s;
}
.isisa-new-chat-btn:hover {
  background: rgba(59, 130, 246, 0.1);
  border-style: solid;
}

/* Modals inside chat widget */
#isisa-chat-modal {
  position: absolute;
  inset: 0;
  background: rgba(6, 9, 19, 0.85);
  backdrop-filter: blur(4px);
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  justify-content: center;
}
#isisa-chat-modal.isisa-show {
  opacity: 1;
  pointer-events: all;
}
.isisa-modal-content {
  background: #161e31;
  border: 1px solid #23314a;
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 100%;
}
.isisa-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.isisa-modal-header h3 {
  margin: 0;
  font-size: 16px;
}
.isisa-modal-close {
  background: transparent;
  border: none;
  color: #8b9bb4;
  font-size: 20px;
  cursor: pointer;
}
.isisa-user-list {
  overflow-y: auto;
  border: 1px solid #23314a;
  border-radius: 8px;
  max-height: 240px;
}
.isisa-user-list::-webkit-scrollbar { width: 6px; }
.isisa-user-list::-webkit-scrollbar-thumb { background: #23314a; border-radius: 10px; }

.isisa-user-item {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #23314a;
  cursor: pointer;
  transition: background 0.2s;
}
.isisa-user-item:hover {
  background: #1b253c;
}
.isisa-user-item:last-child {
  border-bottom: none;
}
.isisa-modal-btn {
  background: #3b82f6;
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.isisa-modal-input {
  background: #0f1523;
  border: 1px solid #23314a;
  border-radius: 8px;
  padding: 10px;
  color: white;
  font-family: inherit;
  font-size: 14px;
}

.isisa-mobile-only {
  display: none;
}

@media (max-width: 600px) {
  #isisa-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  #isisa-chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
    border: none;
    transform: translateY(100%);
  }
  .isisa-mobile-only {
    display: flex;
  }
}
