/* Enhanced Chat Experience Styles */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

* {
    font-family: 'Inter', sans-serif;
}

/* Custom Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translateY(0);
    }
    40%, 43% {
        transform: translateY(-8px);
    }
    70% {
        transform: translateY(-4px);
    }
    90% {
        transform: translateY(-2px);
    }
}

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

/* Utility Classes */
.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}

.animate-fade-in {
    animation: fadeIn 0.5s ease-out;
}

.animate-bounce {
    animation: bounce 1.4s infinite;
}

.animate-pulse-slow {
    animation: pulse 2s infinite;
}

/* Scrollbar Styling */
.overflow-y-auto {
    scrollbar-width: thin;
    scrollbar-color: rgba(156, 163, 175, 0.5) transparent;
}

.overflow-y-auto::-webkit-scrollbar {
    width: 6px;
}

.overflow-y-auto::-webkit-scrollbar-track {
    background: transparent;
}

.overflow-y-auto::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 3px;
}

.overflow-y-auto::-webkit-scrollbar-thumb:hover {
    background: rgba(156, 163, 175, 0.8);
}

/* Message Bubble Enhancements */
.message-bubble {
    position: relative;
    word-wrap: break-word;
    word-break: break-word;
}

.message-bubble::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.message-user::before {
    bottom: 0;
    right: -8px;
    border-width: 0 0 12px 8px;
    border-color: transparent transparent #3b82f6 transparent;
}

.message-friend::before {
    bottom: 0;
    left: -8px;
    border-width: 0 8px 12px 0;
    border-color: transparent #ffffff transparent transparent;
}

/* Theme Variations */
.theme-dark {
    background: #111827;
    color: #f9fafb;
}

.theme-dark .bg-white {
    background: #1f2937 !important;
    color: #f9fafb;
}

.theme-dark .border-gray-200 {
    border-color: #374151 !important;
}

.theme-dark .text-gray-600 {
    color: #9ca3af !important;
}

.theme-dark .text-gray-900 {
    color: #f9fafb !important;
}

.theme-colorful {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-colorful .bg-white {
    background: rgba(255, 255, 255, 0.95) !important;
    backdrop-filter: blur(10px);
}

/* Mobile Responsive Enhancements */
@media (max-width: 768px) {
    .max-w-xs {
        max-width: 280px;
    }
    
    .lg\:max-w-md {
        max-width: 320px;
    }
    
    /* Hide sidebar by default on mobile */
    .sidebar-mobile {
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
    }
    
    .sidebar-mobile.open {
        transform: translateX(0);
    }
}

/* Focus States for Accessibility */
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

/* Loading States */
.loading-dots {
    display: inline-flex;
    align-items: center;
}

.loading-dots::after {
    content: '';
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Message Reactions */
.message-reaction {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: #f3f4f6;
    border-radius: 12px;
    font-size: 12px;
    margin: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.message-reaction:hover {
    background: #e5e7eb;
    transform: scale(1.05);
}

.message-reaction.active {
    background: #dbeafe;
    color: #3b82f6;
}

/* Typing Indicator Animation */
.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #9ca3af;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Online Status Indicator */
.status-indicator {
    position: relative;
}

.status-indicator::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    background: #10b981;
    border: 2px solid #ffffff;
    border-radius: 50%;
    bottom: -2px;
    right: -2px;
}

.status-indicator.offline::after {
    background: #6b7280;
}

/* Message Send Animation */
.message-send {
    animation: messageSend 0.3s ease-out;
}

@keyframes messageSend {
    0% {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Custom Gradient Backgrounds */
.gradient-blue-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.gradient-pink-orange {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.gradient-green-blue {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

/* Enhanced Button Styles */
.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(102, 126, 234, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Glass Morphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Profile Avatar Enhancements */
.avatar {
    position: relative;
    overflow: hidden;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.avatar:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

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

/* Chat Input Enhancements */
.chat-input {
    transition: all 0.3s ease;
    border: 2px solid #e5e7eb;
}

.chat-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

/* Notification Badges */
.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .auto-dark {
        background: #1f2937;
        color: #f9fafb;
    }
}

/* Print Styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    .print-only {
        display: block !important;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .message-bubble {
        border: 2px solid currentColor;
    }
    
    .btn-primary {
        border: 2px solid #000;
    }
}