/* Additional Styles for Better Visual Polish */

/* No Results Message */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-secondary);
}

.no-results i {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.no-results p {
  font-size: 16px;
  margin: 0;
}

/* Enhanced Loading Animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.chat-item,
.contact-item,
.message {
  animation: fadeInUp 0.3s ease-out;
}

/* Better Button Hover States */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-primary:hover::before {
  left: 100%;
}

/* Improved Scrollbars for Webkit */
.tab-content::-webkit-scrollbar,
.messages-container::-webkit-scrollbar {
  width: 6px;
}

.tab-content::-webkit-scrollbar-track,
.messages-container::-webkit-scrollbar-track {
  background: var(--sidebar-bg);
  border-radius: 3px;
}

.tab-content::-webkit-scrollbar-thumb,
.messages-container::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
  transition: background 0.2s;
}

.tab-content::-webkit-scrollbar-thumb:hover,
.messages-container::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

/* Status Text Animation */
.status-text {
  position: relative;
}

.status-text::after {
  content: '';
  position: absolute;
  right: -8px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 4px;
  background-color: var(--status-online);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* Message Bubble Improvements */
.message-bubble {
  position: relative;
  max-width: 100%;
  word-wrap: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.message.own .message-bubble::after {
  content: '';
  position: absolute;
  top: 8px;
  left: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-right-color: var(--message-own-bg);
}

.message:not(.own) .message-bubble::after {
  content: '';
  position: absolute;
  top: 8px;
  right: -8px;
  width: 0;
  height: 0;
  border: 8px solid transparent;
  border-left-color: var(--message-bg);
}

/* Enhanced Search Animation */
.search-box input:focus + .fa-search {
  color: var(--primary-color);
  transform: scale(1.1);
}

/* Pinned Messages Enhanced Style */
.pinned-messages {
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border-left: 4px solid #f59e0b;
}

[data-theme="dark"] .pinned-messages {
  background: linear-gradient(135deg, #451a03 0%, #78350f 100%);
  border-left-color: #f59e0b;
}

/* Floating Action Button for Mobile */
.fab {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 56px;
  height: 56px;
  background-color: var(--primary-color);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 24px;
  box-shadow: 0 4px 12px rgba(71, 222, 128, 0.4);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 1000;
  display: none;
}

.fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(71, 222, 128, 0.6);
}

@media (max-width: 768px) {
  .fab {
    display: flex;
  }
}

/* Improved Focus Indicators */
.message-input input:focus {
  outline: none;
}

.message-input:focus-within {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(71, 222, 128, 0.1);
}

/* Enhanced Transitions */
.sidebar,
.main-content {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Better Dark Mode Contrast */
[data-theme="dark"] .message-bubble {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .chat-item.active {
  box-shadow: inset 0 0 0 1px rgba(71, 222, 128, 0.3);
}

/* Pulse Animation for Notifications */
@keyframes pulseGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(71, 222, 128, 0.7);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(71, 222, 128, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(71, 222, 128, 0);
  }
}

.notification {
  animation: pulseGlow 2s infinite;
}

/* Improved Typography */
.app-logo span {
  font-weight: 700;
  letter-spacing: -0.5px;
}

.section-header h3 {
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* Better Avatar Styles */
.avatar {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: box-shadow 0.2s;
}

.avatar:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Smooth Color Transitions */
* {
  transition-property: background-color, border-color, color, fill, stroke;
  transition-duration: 0.2s;
  transition-timing-function: ease-in-out;
}

/* Preserve User Preferences */
@media (prefers-reduced-motion: reduce) {
  .fab,
  .avatar,
  .btn-primary,
  .btn-icon {
    transition: none;
  }
  
  .loading-content .app-logo,
  .status-text::after {
    animation: none;
  }
}

/* High Contrast Improvements */
@media (prefers-contrast: high) {
  .message-bubble {
    border: 1px solid var(--text-primary);
  }
  
  .btn-primary {
    border: 2px solid var(--primary-dark);
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .chat-header,
  .message-input-container,
  .fab {
    display: none !important;
  }
  
  .main-content {
    width: 100% !important;
  }
  
  .message {
    break-inside: avoid;
  }
}
