/* CyberShield Secure Chat - World-Class Dark Blue Glass Theme */

/* In-App Alert Banner */
.chat-alert-banner {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(-120%);
  width: min(420px, calc(100vw - 32px));
  z-index: 10000;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(15,23,42,0.98) 0%, rgba(6,13,24,0.98) 100%);
  border: 1px solid rgba(37,99,235,0.4);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5), 0 0 0 1px rgba(148,163,184,0.1);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  cursor: pointer;
}

.chat-alert-banner.chat-alert-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

.chat-alert-content {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
}

.chat-alert-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(37,99,235,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #06b6d4;
  font-size: 18px;
}

.chat-alert-text {
  flex: 1;
  min-width: 0;
}

.chat-alert-sender {
  font-weight: 700;
  font-size: 15px;
  color: #f1f5f9;
  margin-bottom: 2px;
}

.chat-alert-preview {
  font-size: 13px;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-alert-dismiss {
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}

.chat-alert-dismiss:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.1);
}

/* Chat Panel */
.chat-indicator { position: relative; }
.chat-indicator .indicator-icon { color: #06b6d4; }
.chat-indicator:hover .indicator-icon { color: #22d3ee; }
.chat-indicator .chat-badge {
  position: absolute; top: -4px; right: -4px;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.chat-panel {
  position: fixed; top: 0; right: -400px; width: 380px; height: 100vh;
  background: linear-gradient(165deg, rgba(15,23,42,0.97) 0%, rgba(6,13,24,0.98) 50%, rgba(15,23,42,0.95) 100%);
  border-left: 1px solid rgba(59,130,246,0.25);
  box-shadow: -16px 0 60px rgba(0,0,0,0.55), inset 1px 0 0 rgba(255,255,255,0.04);
  z-index: 9998;
  transition: right 0.28s cubic-bezier(0.32, 0.72, 0.38, 1);
  display: flex;
  flex-direction: column;
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
}

.chat-panel.open { right: 0; }

.chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: linear-gradient(135deg, rgba(59,130,246,0.12) 0%, rgba(6,13,24,0.4) 100%);
  border-bottom: 1px solid rgba(59,130,246,0.15);
  backdrop-filter: blur(8px);
}

.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 14px;
  font-weight: 700;
  font-size: 17px;
  color: #f1f5f9;
  letter-spacing: 0.3px;
}

.chat-panel-title i { color: #10b981; }

.chat-panel-close {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148,163,184,0.2);
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  border-radius: 10px;
  transition: all 0.2s;
}

.chat-panel-close:hover {
  color: #f1f5f9;
  background: rgba(255,255,255,0.1);
  border-color: rgba(37,99,235,0.3);
}

.chat-notification-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: #94a3b8;
  user-select: none;
}
.chat-notification-toggle input { display: none; }
.chat-toggle-slider {
  width: 36px;
  height: 20px;
  background: rgba(148,163,184,0.3);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
}
.chat-toggle-slider::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: #94a3b8;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.2s;
}
.chat-notification-toggle input:checked + .chat-toggle-slider {
  background: rgba(37,99,235,0.5);
}
.chat-notification-toggle input:checked + .chat-toggle-slider::after {
  transform: translateX(16px);
  background: #10b981;
}
.chat-toggle-label { margin-left: 4px; }

.chat-panel-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chat-panel-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.chat-view { flex: 1; overflow: hidden; display: flex; flex-direction: column; }

.chat-my-id {
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(37,99,235,0.12) 0%, rgba(6,13,24,0.3) 100%);
  border-bottom: 1px solid rgba(148,163,184,0.12);
  font-size: 13px;
  border-radius: 0 0 12px 12px;
}

.chat-my-id-label { color: #94a3b8; margin-right: 8px; }
.chat-my-id-value {
  color: #06b6d4;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.5px;
}

.chat-users-list { flex: 1; overflow-y: auto; padding: 8px; }

.chat-user-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, rgba(37,99,235,0.08) 0%, rgba(6,13,24,0.2) 100%);
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.chat-user-item:hover {
  background: linear-gradient(135deg, rgba(37,99,235,0.18) 0%, rgba(6,13,24,0.35) 100%);
  border-color: rgba(37,99,235,0.35);
  transform: translateX(4px);
}

.chat-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(37,99,235,0.35) 0%, rgba(6,182,212,0.2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #60a5fa;
  font-size: 18px;
}

.chat-user-info { flex: 1; min-width: 0; }
.chat-user-quick-call {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.chat-quick-call-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(16,185,129,0.15);
  border: 1px solid rgba(16,185,129,0.3);
  color: #10b981;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  transition: all 0.15s;
}
.chat-quick-call-btn:hover {
  background: rgba(16,185,129,0.3);
  color: #34d399;
  transform: scale(1.08);
}
.chat-user-name { font-weight: 600; color: #f1f5f9; font-size: 14px; }
.chat-user-id {
  font-size: 12px;
  color: #94a3b8;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 4px;
}

.chat-empty {
  padding: 24px 18px;
  text-align: center;
  color: #94a3b8;
  font-size: 13px;
  display: none;
}

.chat-empty.visible { display: block; }

.chat-conv-view { display: flex; flex-direction: column; }

.chat-conv-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: linear-gradient(135deg, rgba(37,99,235,0.12) 0%, rgba(6,13,24,0.3) 100%);
  border-bottom: 1px solid rgba(148,163,184,0.12);
}
.chat-conv-header-info { flex: 1; min-width: 0; }
.chat-conv-actions { display: flex; gap: 8px; }
.chat-call-btn, .chat-delete-chat-btn {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(148,163,184,0.2);
  color: #94a3b8;
  cursor: pointer;
  padding: 8px 10px;
  font-size: 14px;
  border-radius: 8px;
  transition: all 0.15s;
}
.chat-call-btn:hover { color: #10b981; background: rgba(16,185,129,0.2); border-color: rgba(16,185,129,0.4); }
.chat-delete-chat-btn:hover { color: #ef4444; background: rgba(239,68,68,0.2); border-color: rgba(239,68,68,0.4); }

.chat-back-btn {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(148,163,184,0.2);
  color: #94a3b8;
  cursor: pointer;
  padding: 8px;
  font-size: 16px;
  border-radius: 10px;
  transition: all 0.2s;
}

.chat-back-btn:hover {
  color: #f1f5f9;
  background: rgba(37,99,235,0.2);
  border-color: rgba(37,99,235,0.3);
}

.chat-conv-name { font-weight: 600; color: #f1f5f9; font-size: 15px; }
.chat-conv-lastseen { font-size: 12px; color: #64748b; margin-top: 2px; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-msg:hover {
  transform: scale(1.01);
}

.chat-msg.from-me {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(30,58,138,0.95) 0%, rgba(37,99,235,0.6) 100%);
  border: 1px solid rgba(37,99,235,0.4);
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 16px rgba(37,99,235,0.25);
}

.chat-msg.from-them {
  align-self: flex-start;
  background: linear-gradient(135deg, rgba(15,23,42,0.95) 0%, rgba(37,99,235,0.1) 100%);
  border: 1px solid rgba(148,163,184,0.2);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.chat-msg-time {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-msg.from-me .chat-msg-status {
  color: #10b981;
  margin-left: 4px;
}
.chat-msg-delete {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.4);
  cursor: pointer;
  padding: 2px 6px;
  font-size: 11px;
  margin-left: auto;
  border-radius: 4px;
  transition: all 0.15s;
}
.chat-msg-delete:hover { color: #ef4444; background: rgba(239,68,68,0.2); }
.chat-msg-pending { opacity: 0.85; }
.chat-msg-time { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.chat-file.chat-image img {
  max-width: 280px;
  max-height: 200px;
  border-radius: 8px;
  display: block;
  margin-top: 6px;
  cursor: pointer;
}
.chat-file.chat-image a { display: inline-block; }

.chat-input-area {
  display: flex;
  gap: 10px;
  padding: 14px 18px;
  background: linear-gradient(180deg, rgba(6,13,24,0.98) 0%, rgba(15,23,42,0.98) 100%);
  border-top: 1px solid rgba(148,163,184,0.2);
}

.chat-input {
  flex: 1;
  padding: 14px 18px;
  background: rgba(37,99,235,0.08);
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 14px;
  color: #f1f5f9;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.chat-input::placeholder { color: #64748b; }
.chat-input:focus {
  border-color: rgba(37,99,235,0.5);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(37,99,235,0.8) 0%, rgba(30,58,138,0.9) 100%);
  border: 1px solid rgba(37,99,235,0.4);
  color: #f1f5f9;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.chat-send-btn:hover {
  background: linear-gradient(135deg, rgba(37,99,235,0.95) 0%, rgba(30,58,138,1) 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 16px rgba(37,99,235,0.4);
}

.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.chat-attach-btn {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(37,99,235,0.15);
  border: 1px solid rgba(148,163,184,0.2);
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all 0.2s;
}

.chat-attach-btn:hover {
  color: #f1f5f9;
  background: rgba(37,99,235,0.3);
  border-color: rgba(37,99,235,0.4);
}

.chat-typing-indicator {
  padding: 6px 18px;
  font-size: 12px;
  color: #06b6d4;
  font-style: italic;
}

.chat-user-lastseen { font-size: 11px; color: #64748b; margin-top: 4px; }
.chat-conv-lastseen { font-size: 11px; color: #64748b; }

.chat-file { margin-top: 8px; }
.chat-file a {
  color: #60a5fa;
  text-decoration: none;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chat-file a:hover {
  text-decoration: underline;
  color: #93c5fd;
}
