/* Mobile Header Navigation */
.top-nav-minimal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 55px;
  z-index: 10001;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
  padding: 0 16px;
}

/* Logo Styles */
.header-logo {
  display: flex;
  align-items: center;
  height: 100%;
}

.header-logo img {
  height: 35px;
  width: auto;
  display: block;
}

/* Messages Page Header Styles - FIXED */
.mobile-only-nav .add-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.mobile-only-nav .add-icon:hover {
  opacity: 0.7;
}

/* FIX: Make add icon bigger */
.mobile-only-nav .add-icon img {
  height: 28px; /* Changed from 22px */
  width: auto;
}

/* User name styles - only for messages page */
.header-user-name {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  padding: 0 10px;
}

.user-name-text {
  font-size: 16px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

/* FIX: Center user name properly on messages page */
.mobile-only-nav .header-user-name {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  max-width: 60%;
  margin: 0;
  padding: 0;
}

.mobile-only-nav .add-icon {
  margin-left: auto;
}

/* Heart Icon Styles */
.nav-btn.heart-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 8px;
  transition: opacity 0.2s ease;
}

.nav-btn.heart-icon:hover {
  opacity: 0.7;
}

.nav-btn.heart-icon img {
  display: block;
  height: 27px;
  width: auto;
}

/* Settings Icon Styles */
.nav-btn.settings-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 8px;
  transition: opacity 0.2s ease;
}

.nav-btn.settings-icon:hover {
  opacity: 0.7;
}

.nav-btn.settings-icon img {
  display: block;
  height: 27px;
  width: auto;
}

/* Back Button Styles */
.nav-btn.back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.nav-btn.back-btn:hover {
  opacity: 0.7;
}

.nav-btn.back-btn img {
  display: block;
  height: 25px;
  width: auto;
}

/* Ellipsis Menu Styles */
.nav-btn.ellipsis-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-left: auto; /* Pushes ellipsis to the right */
}

.nav-btn.ellipsis-menu-btn:hover {
  opacity: 0.7;
}

.nav-btn.ellipsis-menu-btn img {
  display: block;
  height: 22px;
  width: auto;
}

/* Content Spacing */
.site-content {
  position: relative;
  z-index: 1;
}

/* Header Action Buttons Container */
.header-action-buttons {
  display: flex;
  align-items: center;
  gap: 8px; /* Reduced gap between buttons */
  margin-left: 8px; /* Small gap after back button */
  margin-right: 0; /* Remove right margin */
}

/* Header Like Button - Icon only, no container */
.header-like-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  padding: 8px;
  width: auto;
  height: auto;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Header Dislike Button - Icon only, no container */
.header-dislike-btn {
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
  overflow: visible;
  padding: 8px;
  width: auto;
  height: auto;
  background-color: transparent;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

/* Icon styling for header buttons */
.header-like-btn .btn-icon,
.header-dislike-btn .btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.header-like-btn .btn-icon img,
.header-dislike-btn .btn-icon img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

/* Green like button icon */
.header-like-btn .btn-icon img {
  filter: brightness(0) saturate(100%) invert(47%) sepia(67%) saturate(415%) hue-rotate(87deg) brightness(95%) contrast(92%);
}

/* Red dislike button icon */
.header-dislike-btn .btn-icon img {
  filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(7483%) hue-rotate(349deg) brightness(91%) contrast(101%);
}

/* Remove text - we're using icons only */
.header-like-btn .btn-text,
.header-dislike-btn .btn-text {
  display: none;
}

/* Hover effects - Only scale the icon */
.header-like-btn:hover .btn-icon img {
  transform: scale(1.1);
  filter: brightness(0) saturate(100%) invert(47%) sepia(67%) saturate(600%) hue-rotate(87deg) brightness(95%) contrast(92%); /* Brighter green on hover */
}

.header-dislike-btn:hover .btn-icon img {
  transform: scale(1.1);
  filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(9000%) hue-rotate(349deg) brightness(91%) contrast(101%); /* Brighter red on hover */
}

.header-like-btn:active .btn-icon img,
.header-dislike-btn:active .btn-icon img {
  transform: scale(0.95);
}

/* Remove any background color changes on active state */
.header-like-btn:active,
.header-dislike-btn:active {
  background: transparent;
  background-color: transparent;
}

/* Ensure no background on hover - only icon effects */
.header-like-btn:hover,
.header-dislike-btn:hover {
  background: transparent;
  background-color: transparent;
}

/* Remove any outline on focus while keeping accessibility */
.header-like-btn:focus,
.header-dislike-btn:focus {
  outline: none;
  background: transparent;
  background-color: transparent;
}

/* Add a visual indicator for focus that doesn't create a grey box */
.header-like-btn:focus-visible,
.header-dislike-btn:focus-visible {
  outline: 2px solid #007bff;
  outline-offset: 2px;
  border-radius: 4px;
  background: transparent;
  background-color: transparent;
}

/* Loading state */
.header-like-btn.loading,
.header-dislike-btn.loading {
  cursor: not-allowed;
  opacity: 0.7;
  background: transparent;
  background-color: transparent;
}

.header-like-btn.loading .btn-icon,
.header-dislike-btn.loading .btn-icon {
  animation: spin 1s linear infinite;
}

.header-like-btn.loading .btn-icon img,
.header-dislike-btn.loading .btn-icon img {
  filter: grayscale(100%) opacity(70%); /* Gray out loading icons */
}

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

/* Success state - Apply to icon only */
.header-like-btn.success .btn-icon img {
  /* Keep original colors but add a slight glow */
  filter: brightness(0) saturate(100%) sepia(100%) hue-rotate(120deg) saturate(500%) drop-shadow(0 0 4px rgba(76, 175, 80, 0.5));
}

/* Dislike success state */
.header-dislike-btn.success .btn-icon img {
  filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(7483%) hue-rotate(349deg) brightness(91%) contrast(101%) drop-shadow(0 0 4px rgba(244, 67, 54, 0.5));
}

.header-like-btn.success,
.header-dislike-btn.success {
  background: transparent;
  background-color: transparent;
}

/* Matched badge in header actions */
.header-action-buttons .matched-badge {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: #4CAF50;
  color: white;
  border-radius: 20px;
  font-weight: 500;
  font-size: 14px;
}

/* Ensure header buttons align properly with new structure */
.mobile-only-nav .header-action-buttons {
  display: flex;
  align-items: center;
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
  .header-like-btn,
  .header-dislike-btn {
    padding: 10px; /* More touch area */
    background: transparent;
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;
  }
  
  .header-like-btn:active .btn-icon img,
  .header-dislike-btn:active .btn-icon img {
    transform: scale(0.85);
  }
  
  /* Remove background on active for touch */
  .header-like-btn:active,
  .header-dislike-btn:active {
    background: transparent;
    background-color: transparent;
  }
  
  /* Make icons slightly more vibrant on touch devices */
  .header-like-btn .btn-icon img {
    filter: brightness(0) saturate(100%) invert(47%) sepia(67%) saturate(500%) hue-rotate(87deg) brightness(95%) contrast(92%);
  }
  
  .header-dislike-btn .btn-icon img {
    filter: brightness(0) saturate(100%) invert(37%) sepia(93%) saturate(8000%) hue-rotate(349deg) brightness(91%) contrast(101%);
  }
}

/* Specifically target iOS Safari */
@supports (-webkit-touch-callout: none) {
  .header-like-btn:active,
  .header-dislike-btn:active {
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;
  }
}

/* For Android/Chrome */
@media (hover: none) and (pointer: coarse) {
  .header-like-btn:active,
  .header-dislike-btn:active {
    background-color: transparent;
    -webkit-tap-highlight-color: transparent;
  }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .header-like-btn .btn-icon img,
  .header-dislike-btn .btn-icon img,
  .header-like-btn:hover .btn-icon img,
  .header-dislike-btn:hover .btn-icon img {
    transition: none;
    transform: none;
  }
  
  .header-like-btn,
  .header-dislike-btn {
    background: transparent;
    background-color: transparent;
  }
  
  .header-like-btn:active,
  .header-dislike-btn:active {
    background: transparent;
    background-color: transparent;
  }
}

/* Adjustments for very small screens */
@media (max-width: 360px) {
  .header-action-buttons {
    gap: 6px;
    margin-left: 6px;
  }
  
  .header-like-btn .btn-icon,
  .header-dislike-btn .btn-icon {
    width: 24px;
    height: 24px;
  }
  
  .header-action-buttons {
    margin-right: 8px;
    gap: 8px;
  }
}

/* Tablet styles - match profiles-matches sizing */
@media (min-width: 768px) {
  .header-like-btn .btn-icon,
  .header-dislike-btn .btn-icon {
    width: 36px;
    height: 36px;
  }
  
  .header-action-buttons {
    gap: 10px;
    margin-left: 10px;
  }
}

/* Mobile styles - match profiles-matches sizing */
@media (max-width: 480px) {
  .header-like-btn .btn-icon,
  .header-dislike-btn .btn-icon {
    width: 28px;
    height: 28px;
  }
  
  .header-action-buttons {
    gap: 8px;
  }
}

/* For very tall screens or landscape mobile */
@media (max-height: 700px) and (orientation: landscape) {
  .header-like-btn .btn-icon,
  .header-dislike-btn .btn-icon {
    width: 24px;
    height: 24px;
  }
  
  .header-action-buttons {
    gap: 6px;
  }
}

@media (max-height: 600px) and (orientation: landscape) {
  .header-like-btn .btn-icon,
  .header-dislike-btn .btn-icon {
    width: 22px;
    height: 22px;
  }
  
  .header-action-buttons {
    gap: 6px;
  }
}

/* Chat Header Styles for Mobile */
.chat-header-user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  margin: 0 10px;
  min-width: 0;
  overflow: hidden;
}

/* Chat User Avatar Small */
.chat-user-avatar-small {
  width: 35px;
  height: 35px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid #e9ecef;
}

.chat-user-avatar-small.placeholder {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
}

/* Chat User Details Small */
.chat-user-details-small {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chat-user-name-small {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}

.chat-user-status-small {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #4CAF50;
  line-height: 1.2;
  white-space: nowrap;
}

.status-indicator-small {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4CAF50;
  display: inline-block;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* Info Icon for Chat Header */
.nav-btn.info-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  transition: opacity 0.2s ease;
  margin-left: auto;
}

.nav-btn.info-icon:hover {
  opacity: 0.7;
}

.nav-btn.info-icon img {
  display: block;
  height: 22px;
  width: auto;
  filter: brightness(0) saturate(100%) invert(47%) sepia(7%) saturate(750%) hue-rotate(180deg) brightness(95%) contrast(90%);
}

/* Adjust back button margin for chat header */
.mobile-only-nav .back-btn + .chat-header-user-info {
  margin-left: 0;
}

/* Chat container height adjustments for mobile */
@media (max-width: 768px) {
  .chat-container {
    height: calc(100vh - 55px); /* Subtract mobile header height */
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  
  /* Hide the duplicate header in page content on mobile */
  .chat-header {
    display: none !important;
  }
}

/* Desktop: Show the chat header in page content */
@media (min-width: 769px) {
  .chat-container {
    height: calc(100vh - 200px);
    max-height: 800px;
  }
  
  .chat-header {
    display: flex !important;
  }
}

/* Hide on Desktop */
@media (min-width: 768px) {
  .top-nav-minimal {
    display: none;
  }
  
  body:not(.home) .site-content {
    padding-top: 0;
  }
}