/* Chat Widget Container */
.chat-widget-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: 'Cairo', sans-serif;
}

/* RTL Support */
html[dir="rtl"] .chat-widget-container {
    right: auto;
    left: 20px;
}

/* Trigger Button */
.chat-trigger-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2e0056 0%, #57078d 100%);
    /* Primary gradient */
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(46, 0, 86, 0.25);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chat-trigger-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(46, 0, 86, 0.35);
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 550px;
    background-color: #fff;
    border-radius: 18px;
    box-shadow: 0 5px 40px rgba(0, 0, 0, 0.16);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    transform: scale(0);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

html[dir="rtl"] .chat-window {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.chat-window.open {
    transform: scale(1);
    opacity: 1;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #2e0056 0%, #57078d 50%, #6b01df 100%);
    /* Matched site gradient */
    padding: 20px;
    padding-bottom: 60px;
    color: white;
    position: relative;
}

.chat-header-actions {
    display: flex;
    justify-content: flex-end;
}

.chat-close-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
}

.chat-close-btn:hover {
    color: white;
}

.chat-welcome-text {
    margin-top: 10px;
}

.chat-icon-large {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 15px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chat-welcome-text h2 {
    margin: 0;
    font-size: 28px;
    font-weight: 800;
    line-height: 1.2;
    color: white;
}

/* Chat Body */
.chat-body {
    flex: 1;
    background-color: #f8fafc;
    padding: 0 20px;
    position: relative;
    overflow-y: auto;
}

.chat-agent-card {
    background-color: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.05);
    margin-top: -20px;
    /* Overlap with header */
    position: relative;
    z-index: 10;
}

.agent-profile {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
}

.agent-avatar-wrapper {
    position: relative;
    margin-right: 15px;
}

html[dir="rtl"] .agent-avatar-wrapper {
    margin-right: 0;
    margin-left: 15px;
}

.agent-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #10b981;
    /* Green for online */
    border: 2px solid white;
    border-radius: 50%;
}

html[dir="rtl"] .status-indicator {
    right: auto;
    left: 2px;
}

.agent-info {
    flex: 1;
}

.agent-name {
    display: block;
    font-size: 14px;
    color: #64748b;
    margin-bottom: 4px;
}

.agent-greeting {
    margin: 0;
    font-size: 16px;
    color: #1e293b;
    line-height: 1.4;
}

.start-chat-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #2e0056 0%, #57078d 100%);
    /* Primary gradient */
    color: white;
    text-align: center;
    padding: 12px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
}

.start-chat-btn:hover {
    background: linear-gradient(135deg, #31005c 0%, #681dba 100%);
    box-shadow: 0 4px 12px rgba(46, 0, 86, 0.2);
    color: white;
}

.start-chat-btn i {
    margin-left: 8px;
}

html[dir="rtl"] .start-chat-btn i {
    margin-left: 0;
    margin-right: 8px;
}

/* Chat Footer Nav */
.chat-footer-nav {
    background-color: white;
    padding: 10px 20px;
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #e2e8f0;
    border-radius: 0 0 18px 18px;
}

.footer-nav-item {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    color: #64748b;
    cursor: pointer;
    font-size: 12px;
    padding: 5px;
}

.footer-nav-item i {
    font-size: 20px;
    margin-bottom: 4px;
}

.footer-nav-item.active {
    color: #2e0056;
    /* Primary color */
    font-weight: 600;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 40px);
        max-width: 350px;
        right: 0;
        bottom: 80px;
        height: 500px;
    }

    html[dir="rtl"] .chat-window {
        right: auto;
        left: 0;
    }
}