/* Chat Widget Styles */

/* Floating Chat Button */
.chat-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    transition: all 0.3s ease;
    z-index: 9998;
    animation: pulse 2s infinite;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.6);
}

.chat-button.active {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(0, 123, 255, 0.8);
    }
}

/* Notification Badge */
.chat-button .notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #dc3545;
    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;
}

/* Chat Widget Container */
.chat-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 380px;
    height: 550px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

.chat-widget.active {
    display: flex;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.chat-header-info {
    display: flex;
    flex-direction: column;
}

.chat-status {
    font-size: 12px;
    opacity: 0.9;
    margin-top: 4px;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Welcome Screen */
.chat-welcome {
    padding: 30px 20px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.chat-welcome h4 {
    margin: 0 0 10px 0;
    color: #333;
    font-size: 20px;
}

.chat-welcome p {
    color: #666;
    margin: 0 0 20px 0;
    font-size: 14px;
}

.chat-welcome-form {
    width: 100%;
    max-width: 300px;
}

.chat-welcome-form input {
    width: 100%;
    padding: 12px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
}

.chat-welcome-form input:focus {
    outline: none;
    border-color: #007bff;
}

.chat-welcome-form button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-welcome-form button:hover {
    transform: translateY(-2px);
}

/* Chat Messages Area */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: none;
}

.chat-messages.active {
    display: block;
}

.chat-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease-out;
}

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

.chat-message.visitor {
    align-items: flex-end;
}

.chat-message.admin {
    align-items: flex-start;
}

.chat-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    position: relative;
}

.chat-message.visitor .chat-message-content {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.chat-message.admin .chat-message-content {
    background: white;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.chat-message-sender {
    font-size: 11px;
    color: #666;
    margin-bottom: 4px;
    font-weight: 600;
    align-self: inherit;
}

.chat-message.visitor .chat-message-sender {
    text-align: right;
    color: rgba(255, 255, 255, 0.9);
}

.chat-message.admin .chat-message-sender {
    text-align: left;
}

.chat-message-time {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 4px;
}

.chat-message.visitor .chat-message-time {
    color: rgba(255, 255, 255, 0.8);
}

.chat-message.admin .chat-message-time {
    color: #999;
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    align-items: center;
    padding: 12px 16px;
    background: white;
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    max-width: 60px;
    margin-bottom: 16px;
    border: 1px solid #e0e0e0;
}

.typing-indicator.active {
    display: flex;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: typing 1.4s infinite;
}

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

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

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

/* Chat Input Area */
.chat-input {
    padding: 16px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: none;
}

.chat-input.active {
    display: block;
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border-radius: 24px;
    padding: 8px 12px;
}

.chat-input-wrapper input {
    flex: 1;
    border: none;
    background: none;
    padding: 8px;
    font-size: 14px;
    outline: none;
}

.chat-input-wrapper button {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s;
}

.chat-input-wrapper button:hover {
    transform: scale(1.1);
}

.chat-input-wrapper button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* System Messages */
.chat-system-message {
    text-align: center;
    padding: 12px;
    margin: 16px auto;
    font-size: 13px;
    color: #d32f2f;
    background: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 12px;
    font-weight: 500;
    max-width: 90%;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
    }

    .chat-button {
        bottom: 15px;
        right: 15px;
        width: 56px;
        height: 56px;
    }
}

/* Scrollbar Styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}
