/* New Message Modal - SOLIUS Domain-Driven OOP */
/* Glassmorphism design for starting new private chats */

.new-message-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
  to {
    opacity: 1;
  }
}

.new-message-modal {
  position: relative;
  width: 372px;
  height: 528px;
  background: #00091E;
  border-radius: 20px;
  padding: 24px 24px 32px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  gap: 16px;
  opacity: 0;
  transform: translateY(20px);
  animation: slideUp 0.3s ease 0.1s forwards;
}

@keyframes slideUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Header */
.new-message-modal-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

.new-message-modal-close {
  align-self: flex-end;
  padding: 6px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: #536285;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.new-message-modal-close:hover {
  background: #111a40;
  color: #FFFFFF;
}

.new-message-modal-title {
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 32px;
  text-align: center;
  color: #FFFFFF;
  margin: 0;
  width: 100%;
}

/* Search Input Container */
.new-message-search-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0px;
  gap: 10px;
  width: 100%;
  height: 64px;
}

/* Search Input */
.new-message-search {
  width: 100%;
  height: 44px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border: none;
  border-radius: 12px;
  padding: 12px 16px;
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #FFFFFF;
  outline: none;
  transition: all 0.2s ease;
}

.new-message-search::placeholder {
  color: #536285;
}

.new-message-search:focus {
  background: rgba(255, 255, 255, 0.08);
}

/* Results Container */
.new-message-results-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  flex: 1;
  overflow: hidden;
}

/* Search Results */
.search-results {
  width: 100%;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Custom Scrollbar */
.search-results::-webkit-scrollbar {
  width: 6px;
}

.search-results::-webkit-scrollbar-track {
  background: rgba(85, 93, 255, 0.05);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.search-results::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Search Result Item */
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 48px;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
  border-radius: 8px;
}

.search-result-item:hover {
  background: #111a40;
}

/* Result Avatar */
.result-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(85, 93, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.result-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Avatar Fallback (when no image) */
.result-avatar-fallback {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #555DFF 0%, #7178FE 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF;
  font-size: 20px;
  font-weight: 600;
  flex-shrink: 0;
}

/* 🔥 AGENT #9: Gradient avatar for direct wallet addresses */
.result-avatar-fallback.gradient-avatar {
  background: linear-gradient(135deg, #555DFF 0%, #303365 100%);
  box-shadow: 0 0 16px rgba(85, 93, 255, 0.3);
  border: 1px solid rgba(85, 93, 255, 0.4);
  font-family: 'Montserrat', sans-serif;
  font-weight: 600;
}

/* Result Info */
.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 5px;
  height: 48px;
}

.result-name-row {
  display: flex;
  align-items: center;
  width: 100%;
  height: 20px;
}

.result-name {
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 16px;
  line-height: 20px;
  color: #FFFFFF;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.result-status-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  height: 20px;
}

.result-status {
  flex: 1;
  font-family: 'Montserrat', sans-serif;
  font-weight: 400;
  font-size: 14px;
  line-height: 20px;
  color: #536285;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Result Checkbox */
.result-checkbox {
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid #555DFF;
  border-radius: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-top: -17px;
}

.search-result-item.selected .result-checkbox {
  background: #555DFF;
}

.result-checkbox svg {
  width: 16px;
  height: 16px;
  color: #00091E;
  display: none;
}

.search-result-item.selected .result-checkbox svg {
  display: block;
}

/* Empty State */
.search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
  color: #536285;
  text-align: center;
}

.search-empty-icon {
  font-size: 48px;
  opacity: 0.5;
}

.search-empty-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #536285;
}

/* Loading State */
.search-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 40px 20px;
}

.search-loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(85, 93, 255, 0.2);
  border-top: 3px solid #555DFF;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.search-loading-text {
  font-family: 'Montserrat', sans-serif;
  font-size: 14px;
  line-height: 20px;
  color: #536285;
}

/* Start Chat Button (Glossy Button from Landing Page) */
.btn-start-chat {
  position: relative;
  width: 100%;
  height: 55px;
  background: transparent;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  isolation: isolate;
  flex-shrink: 0;
}

/* Glow layer behind button */
.btn-start-chat .btn-glow {
  position: absolute;
  width: 98px;
  height: 24px;
  right: 21px;
  top: 14px;
  background: linear-gradient(266.42deg, #000DFF -21.15%, rgba(85, 93, 255, 0) 88.34%);
  border: 2px solid #969CFF;
  filter: blur(10px);
  border-radius: 40px;
  pointer-events: none;
  z-index: -1;
}

/* Button surface - glass icing effect */
.btn-start-chat .btn-content {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 32px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 40px;
  font-family: 'Montserrat', sans-serif;
  font-weight: 500;
  font-size: 20px;
  line-height: 28px;
  color: #FFFFFF;
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.4),
    0 4px 12px rgba(0, 13, 255, 0.3);
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn-start-chat:hover {
  background: none;
}

.btn-start-chat:hover .btn-content {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 
    inset 0 1px 0 0 rgba(255, 255, 255, 0.6),
    0 6px 16px rgba(0, 13, 255, 0.4);
}

.btn-start-chat:disabled .btn-content {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .new-message-modal {
    width: calc(100% - 40px);
    max-height: calc(100% - 80px);
    padding: 24px;
    gap: 20px;
  }

  .new-message-modal-title {
    font-size: 20px;
    line-height: 28px;
  }

  .search-results {
    max-height: 300px;
  }

  .result-avatar,
  .result-avatar-fallback {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  .result-name {
    font-size: 14px;
  }

  .result-status {
    font-size: 12px;
  }
}

/* Accessibility */
.new-message-search:focus,
.new-message-modal-close:focus,
.search-result-item:focus {
  outline: 2px solid #555DFF;
  outline-offset: 2px;
}

