/* 
 * Matches Page Styles
 * 
 * Brand-specific styles only. Bootstrap handles most layout and components.
 * Use Bootstrap utilities wherever possible.
 */

/* Page container - Bootstrap handles flex via d-flex */
.matches-page-container {
  background: var(--nitecap-gradient);
}

/* Empty State - Using Bootstrap card, minimal custom styling */
.matches-empty-state {
  background: var(--nitecap-gradient);
}

.empty-state-content {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.empty-state-emoji {
  font-size: 4rem;
  line-height: 1;
}

/* Layout - Bootstrap handles flex via d-flex */
.matches-layout {
  /* Bootstrap handles flex layout */
}

/* Left Sidebar - Bootstrap handles flex and borders */
.matches-sidebar {
  /* Bootstrap handles width, flex, background, border */
}

.sidebar-title {
  /* Bootstrap handles padding, border, font-weight via utilities */
}

.conversations-list {
  /* Bootstrap handles flex, overflow via utilities */
}

/* Conversation Item - Brand-specific hover and selection states */
.conversation-item {
  cursor: pointer;
  transition: background-color 0.2s, border-left-color 0.2s;
  border-left: 3px solid transparent;
  border-bottom: 1px solid #e4e6eb;
}

.conversation-item:hover {
  background-color: #f0f2f5;
}

.conversation-item.selected {
  background-color: #f0f2f5;
  border-left-color: #1877f2;
  border-left-width: 3px;
}

.conversation-item.selected:hover {
  background-color: #e4e6eb;
}

.conversation-item.unread {
  background-color: #e3f2fd;
  border-left-color: transparent;
  border-left-width: 3px;
  font-weight: 600;
  position: relative;
}

.conversation-item.unread::before {
  content: '';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 8px;
  height: 8px;
  background-color: #1976d2;
  border-radius: 50%;
}

.conversation-item.unread:hover {
  background-color: #bbdefb;
}

.conversation-item.unread .conversation-name {
  color: #1565c0;
  font-weight: 700;
}

.conversation-item.unread .conversation-preview {
  color: #1c1e21;
  font-weight: 500;
}

/* If an item is both selected and unread, show unread styling with selected border */
.conversation-item.unread.selected {
  background-color: #e3f2fd;
  border-left-width: 3px;
  border-left-color: #1877f2;
}

/* Conversation link - Bootstrap handles flex via d-flex */
.conversation-link {
  /* Bootstrap handles flex, align-items, gap via utilities */
}

/* Avatar - Brand-specific gradient placeholder */
.conversation-avatar {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  position: relative;
}

.conversation-avatar-img {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  aspect-ratio: 1 / 1;
}

.conversation-avatar-placeholder {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  max-width: 48px;
  max-height: 48px;
  border-radius: 50%;
  aspect-ratio: 1 / 1;
  background: var(--nitecap-gradient);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 600;
}

/* Conversation content - Bootstrap handles flex via utilities */
.conversation-content {
  /* Bootstrap handles flex, min-width via utilities */
}

/* Chat Pane - Bootstrap handles flex via utilities */
.chat-pane {
  /* Bootstrap handles flex, background via utilities */
}

/* Chat placeholder - Bootstrap handles flex via utilities */
.chat-placeholder {
  /* Bootstrap handles flex, align-items, justify-content via utilities */
}

/* Chat view - Brand-specific backdrop blur */
.chat-view {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px 0 0 0;
}

/* Chat header - Bootstrap handles flex via utilities */
.chat-header {
  /* Bootstrap handles flex, padding, border via utilities */
}

/* Chat menu dropdown - Custom styling for dropdown */
.chat-menu .dropdown-toggle {
  text-decoration: none !important;
  border: none;
  box-shadow: none !important;
  font-size: 1.5rem !important;
  font-weight: bold !important;
  color: #1c1e21 !important;
  transition: opacity 0.2s ease;
}

.chat-menu .dropdown-toggle:hover,
.chat-menu .dropdown-toggle:focus {
  text-decoration: none !important;
  box-shadow: none !important;
  opacity: 0.7;
  color: #1c1e21 !important;
}

.chat-menu .dropdown-toggle::after {
  display: none; /* Hide Bootstrap's default dropdown arrow */
}

.chat-menu .dropdown-menu {
  min-width: 120px;
  margin-top: 0.25rem;
}

/* Messages container - Bootstrap handles flex, overflow via utilities */
.messages-container {
  /* Bootstrap handles flex, overflow, padding via utilities */
}

/* Message - Brand-specific message bubble styling */
.message {
  /* Bootstrap handles flex, margin via utilities */
}

.message-content {
  max-width: 70%;
  word-wrap: break-word;
  display: inline-block;
}

.message-own .message-content {
  background: #1877f2;
  color: white;
}

.message-other .message-content {
  background: white;
  color: #1c1e21;
  border: 1px solid #e4e6eb;
}

.message-time {
  /* Bootstrap handles font-size, color, margin via utilities */
}

/* Message input container - Bootstrap handles padding, background, border via utilities */
.message-input-container {
  /* Bootstrap handles padding, background, border via utilities */
}

/* Message input wrapper - Bootstrap handles flex via utilities */
.message-input-wrapper {
  /* Bootstrap handles flex, gap, align-items via utilities */
}

/* Emoji button - Brand-specific styling */
.emoji-button {
  font-size: 1.5rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background-color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none !important;
  border: none;
}

.emoji-button:hover,
.emoji-button:focus {
  background-color: #f0f2f5;
  text-decoration: none !important;
}

/* Emoji picker wrapper - Bootstrap handles position via utilities */
.emoji-picker-wrapper {
  /* Bootstrap handles position via utilities */
}

/* Emoji picker container - Brand-specific styling */
.emoji-picker-container {
  display: none;
  background: white;
  border: 1px solid #e4e6eb;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  padding: 0.75rem;
  max-width: 300px;
  max-height: 350px;
  overflow-y: auto;
  z-index: 1000;
}

.emoji-picker-container.show {
  display: block;
}

.emoji-picker-header {
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e4e6eb;
  margin-bottom: 0.5rem;
}

.emoji-picker-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: #1c1e21;
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 0.25rem;
}

.emoji-item {
  font-size: 1.5rem;
  padding: 0.5rem;
  cursor: pointer;
  text-align: center;
  border-radius: 8px;
  transition: background-color 0.2s;
  user-select: none;
}

.emoji-item:hover {
  background-color: #f0f2f5;
}

/* Message input - Bootstrap handles form-control, custom border-radius */
.message-input {
  /* Bootstrap handles form-control styling */
  border-radius: 20px;
}

.message-input:focus {
  border-color: #1877f2;
  box-shadow: 0 0 0 0.2rem rgba(24, 119, 242, 0.25);
}

/* Send button - Bootstrap handles btn, custom border-radius */
.send-button {
  /* Bootstrap handles btn styling */
  border-radius: 20px;
}

.send-button:hover {
  background: #166fe5;
}

.send-button:disabled {
  background: #e4e6eb;
  color: #8a8d91;
  cursor: not-allowed;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .matches-sidebar {
    width: 300px;
  }
}

@media (max-width: 991.98px) {
  .matches-page-container {
    height: calc(100vh - 64px); /* Account for nav bar */
    overflow: hidden;
    margin-top: 0;
  }
  
  /* Ensure nav bar stays visible */
  .matches-page-container ~ .main-navigation,
  .main-navigation {
    z-index: 1000 !important;
    position: sticky !important;
    top: 0 !important;
  }
  
  /* On matches page, ensure nav bar dropdown is readable on mobile */
  body:has(.matches-page-container) .main-navigation .navbar-collapse {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px) !important;
    border-radius: 8px;
    margin-top: 0.5rem;
    padding: 0.5rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  }
  
  body:has(.matches-page-container) .main-navigation .navbar-collapse .nav-link {
    color: #1c1e21 !important;
  }
  
  body:has(.matches-page-container) .main-navigation .navbar-collapse .nav-welcome {
    color: #1c1e21 !important;
  }
  
  body:has(.matches-page-container) .main-navigation .navbar-collapse .nav-avatar-placeholder {
    color: #1c1e21 !important;
    border-color: rgba(0, 0, 0, 0.2) !important;
  }

  /* Hide desktop layout on mobile */
  .matches-layout {
    display: none !important;
  }

  /* Mobile: Full-screen conversation list */
  .matches-mobile-list {
    height: 100%;
  }

  .matches-sidebar-mobile {
    height: 100%;
  }

  /* Mobile: Full-screen chat view */
  .matches-mobile-chat {
    height: calc(100vh - 64px); /* Account for nav bar */
    position: fixed;
    top: 64px; /* Start below nav bar */
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--nitecap-gradient);
    z-index: 5; /* Below nav bar (z-index: 1000) */
  }

  .matches-mobile-chat.d-none {
    display: none !important;
  }

  .matches-mobile-chat:not(.d-none) {
    display: flex !important;
  }

  .emoji-picker-wrapper {
    left: auto;
    right: 0;
  }

  .emoji-picker-container {
    max-width: 250px;
    max-height: 300px;
  }

  .emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }

  /* Mobile chat view adjustments */
  .chat-view {
    border-radius: 0;
    background: white;
    height: 100%;
  }

  .messages-container {
    padding-bottom: env(safe-area-inset-bottom);
  }
}

@media (max-width: 480px) {
  .matches-sidebar {
    height: 35vh;
  }

  .chat-pane {
    height: 65vh;
  }

  .conversation-item {
    padding: 0.75rem;
  }

  .conversation-name {
    font-size: 1rem;
  }

  .message-input-wrapper {
    gap: 0.25rem;
  }

  .message-input {
    font-size: 0.875rem;
    padding: 0.5rem 0.75rem;
  }

  .send-button {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
}
