/* ===================================
   Chat Widget Styles
   =================================== */

/* Chat Button (Floating) - Using CSS Variables */
.chat-button {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary, #17c3b2), var(--secondary, #06b6d4));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(23, 195, 178, 0.4);
    z-index: 9998;
    transition: all 0.3s ease;
    border: none;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(23, 195, 178, 0.6);
}

.chat-button .badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
}

/* Chat Window */
.chat-window {
    position: fixed;
    bottom: 100px;
    left: 30px;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    direction: rtl;
}

.chat-window.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, var(--primary, #17c3b2), var(--secondary, #06b6d4));
    color: white;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chat-header .status {
    font-size: 0.75rem;
    opacity: 0.9;
    margin-top: 0.25rem;
}

.chat-header .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-header .close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.25rem;
    background: #f9fafb;
}

.chat-message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
}

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

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

.message-bubble {
    max-width: 75%;
    padding: 0.75rem 1rem;
    border-radius: 18px;
    word-wrap: break-word;
    position: relative;
}

.message-bubble.user {
    background: linear-gradient(135deg, var(--primary, #17c3b2), var(--secondary, #06b6d4));
    color: white;
    border-bottom-right-radius: 4px;
}

.message-bubble.admin {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

.message-time {
    font-size: 0.7rem;
    color: #6b7280;
    margin-top: 0.25rem;
    padding: 0 0.5rem;
}

.message-status {
    font-size: 0.65rem;
    color: #9ca3af;
    margin-top: 0.15rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

/* Chat Input */
.chat-input-area {
    padding: 1rem;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    gap: 0.5rem;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 2px solid #e5e7eb;
    border-radius: 25px;
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s;
    direction: rtl;
}

.chat-input:focus {
    border-color: var(--primary, #17c3b2);
}

.chat-send-btn {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--primary, #17c3b2), var(--secondary, #06b6d4));
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.chat-send-btn:hover {
    transform: scale(1.05);
}

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

/* Empty State */
.chat-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #6b7280;
}

.chat-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: 18px;
    max-width: 75px;
    margin-bottom: 1rem;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    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);
    }
    30% {
        transform: translateY(-10px);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100% - 20px);
        left: 10px;
        right: 10px;
        height: calc(100vh - 100px);
        bottom: 90px;
    }
    
    .chat-button {
        bottom: 20px;
        left: 20px;
        width: 55px;
        height: 55px;
    }
}
