/* ===================================================================
 * Chat Widget Styles - Eventa
 * Modern Real-time Chat Interface
 * ------------------------------------------------------------------- */

/* =================================
   CHAT WIDGET CORE
   ================================= */
.chat-widget {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

/* Chat Toggle Button */
.chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 40px rgba(99, 102, 241, 0.4);
    transition: all 0.3s cubic-bezier(0.23, 1, 0.32, 1);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 50px rgba(99, 102, 241, 0.5);
}

.chat-button:active {
    transform: scale(0.95);
}

.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.9;
    }
}

/* =================================
   CHAT WINDOW
   ================================= */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideInUp 0.3s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* =================================
   CHAT HEADER
   ================================= */
.chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    color: white;
    padding: 1.5rem;
}

.chat-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    width: 100%; /* ✅ Added: Fill the full width */
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.chat-status div {
    min-width: 0; /* ✅ Added: Allow text to truncate if needed */
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #10b981;
    box-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
    animation: pulse 2s infinite;
    flex-shrink: 0; /* Prevent shrinking */
}

.status-indicator.offline {
    background: #ef4444;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.chat-status h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap; /* ✅ Added: Prevent wrapping */
}

.chat-status p {
    margin: 0;
    font-size: 13px;
    opacity: 0.9;
    white-space: nowrap; /* ✅ Added: Prevent wrapping */
}

.minimize-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0; /* ✅ Keeps it on the right */
}

.minimize-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.minimize-btn:active {
    transform: scale(0.95);
}

/* =================================
   CHAT BODY
   ================================= */
.chat-body {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    background: #f9fafb;
}

/* Custom Scrollbar */
.chat-body::-webkit-scrollbar {
    width: 6px;
}

.chat-body::-webkit-scrollbar-track {
    background: transparent;
}

.chat-body::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

.chat-body::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* =================================
   WELCOME SCREEN
   ================================= */
.welcome-screen {
    text-align: center;
    padding: 2rem 1rem;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.welcome-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 1.5rem;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 36px;
    color: white;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.welcome-screen h4 {
    font-size: 24px;
    color: #111827;
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.welcome-screen p {
    color: #6b7280;
    margin-bottom: 2rem;
    line-height: 1.6;
}

/* =================================
   CHAT FORM
   ================================= */
.chat-form input,
.chat-form textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    margin-bottom: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.chat-form input:focus,
.chat-form textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.chat-form .btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 15px;
}

.chat-form .btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.chat-form .btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =================================
   CHAT MESSAGES
   ================================= */
.chat-messages {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.message {
    display: flex;
    gap: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-admin {
    flex-direction: row;
}

.message-visitor {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    font-size: 16px;
}

.message-visitor .message-avatar {
    background: #e5e7eb;
    color: #6b7280;
}

.message-content {
    max-width: 70%;
}

.message-sender {
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
    font-weight: 600;
}

.message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 14px;
    color: #111827;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    word-wrap: break-word;
}

.message-visitor .message-text {
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    color: white;
}

.message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
}

/* =================================
   TYPING INDICATOR
   ================================= */
.typing-indicator .message-text {
    padding: 12px 20px;
    background: white;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #6b7280;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* =================================
   CHAT FOOTER
   ================================= */
.chat-footer {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.chat-input-form {
    display: flex;
    gap: 8px;
}

.chat-input-form input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s;
}

.chat-input-form input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #6366f1 0%, #ec4899 100%);
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.3);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.offline-notice {
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef3c7;
    color: #92400e;
    border-radius: 8px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* =================================
   RESPONSIVE DESIGN
   ================================= */
@media (max-width: 480px) {
    .chat-widget {
        bottom: 1rem;
        right: 1rem;
    }

    .chat-window {
        width: calc(100vw - 2rem);
        height: calc(100vh - 100px);
        bottom: 70px;
        right: -1rem;
    }

    .message-content {
        max-width: 80%;
    }
}

/* =================================
   UTILITY CLASSES
   ================================= */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.slide-up {
    animation: slideInUp 0.3s ease;
}
