/**
 * Modern WhatsApp Chat Widgets Styles
 */

/* Base Chat Widget Styles */
.dw-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    border-radius: 20px;
    background: #ffffff;
    max-width: 380px;
    min-width: 320px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* Position Classes with Enhanced Animations */
.dw-chat-widget.bottom-right {
    bottom: 24px;
    right: 24px;
    animation: slideInFromRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.bottom-left {
    bottom: 24px;
    left: 24px;
    animation: slideInFromLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.top-right {
    top: 24px;
    right: 24px;
    animation: slideInFromTopRight 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.top-left {
    top: 24px;
    left: 24px;
    animation: slideInFromTopLeft 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Modern Chat Header */
.dw-chat-header {
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.dw-chat-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    border-radius: 20px 20px 0 0;
}

.dw-chat-header .dw-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
}

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

.dw-chat-header .dw-close {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.dw-chat-header .dw-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Modern Chat Body */
.dw-chat-body {
    padding: 20px;
    background: linear-gradient(135deg, #fafbfc 0%, #f8f9fa 100%);
}

/* Modern Welcome Message Bubble */
.dw-welcome-bubble {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    padding: 16px 20px;
    border-radius: 20px 20px 20px 6px;
    margin-bottom: 20px;
    position: relative;
    max-width: 90%;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 15px;
    line-height: 1.5;
    color: #2c3e50;
}

.dw-welcome-bubble::before {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 16px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.dw-welcome-bubble::after {
    content: '';
    position: absolute;
    bottom: -11px;
    left: 15px;
    width: 0;
    height: 0;
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-top: 11px solid rgba(0, 0, 0, 0.05);
}

/* Modern Support Agents List */
.dw-agents-list {
    margin-bottom: 20px;
    background: #ffffff;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dw-agent-item {
    display: flex;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: all 0.2s ease;
}

.dw-agent-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.dw-agent-item:hover {
    background: rgba(37, 211, 102, 0.05);
    margin: 0 -12px;
    padding: 12px;
    border-radius: 12px;
}

.dw-agent-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 16px;
    color: white;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.dw-agent-info {
    flex: 1;
}

.dw-agent-name {
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 2px;
}

.dw-agent-status {
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dw-agent-status::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}

.dw-agent-status.available {
    color: #25D366;
}

.dw-agent-status.available::before {
    background: #25D366;
    box-shadow: 0 0 6px rgba(37, 211, 102, 0.5);
}

.dw-agent-status.away {
    color: #ff9500;
}

.dw-agent-status.away::before {
    background: #ff9500;
    box-shadow: 0 0 6px rgba(255, 149, 0, 0.5);
}

/* Modern Input Fields */
.dw-input-group {
    margin-bottom: 16px;
    position: relative;
}

.dw-input-field {
    width: 100%;
    padding: 14px 18px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    font-size: 14px;
    background: #ffffff;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
    font-family: inherit;
}

.dw-input-field:focus {
    outline: none;
    border-color: #25D366;
    box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.1), 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-1px);
}

.dw-input-field::placeholder {
    color: #8e9aaf;
    font-weight: 400;
}

.dw-input-field:hover {
    border-color: rgba(37, 211, 102, 0.3);
}

/* WhatsApp Number Field */
.dw-number-field {
    position: relative;
}

.dw-number-field::before {
    content: '📱';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
}

.dw-number-field .dw-input-field {
    padding-left: 40px;
}

/* Reply Field */
.dw-reply-field {
    position: relative;
}

.dw-reply-field .dw-send-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #25D366;
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

/* Modern Action Button */
.dw-action-button {
    width: 100%;
    padding: 16px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
    position: relative;
    overflow: hidden;
}

.dw-action-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.dw-action-button:hover::before {
    left: 100%;
}

.dw-action-button:hover {
    background: linear-gradient(135deg, #128C7E 0%, #0f6b5f 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.dw-action-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.3);
}

.dw-action-button .dw-whatsapp-icon {
    margin-right: 10px;
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Modern Floating Icon */
.dw-floating-icon {
    position: fixed;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 999999;
    border: 3px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.dw-floating-icon::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #25D366, #128C7E, #25D366);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dw-floating-icon:hover::before {
    opacity: 1;
}

.dw-floating-icon:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 12px 40px rgba(37, 211, 102, 0.6), 0 4px 16px rgba(0, 0, 0, 0.15);
}

.dw-floating-icon:active {
    transform: scale(1.05);
}

.dw-floating-icon .dw-whatsapp-icon {
    color: white;
    font-size: 30px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
    transition: transform 0.3s ease;
}

.dw-floating-icon:hover .dw-whatsapp-icon {
    transform: scale(1.1);
}

/* Modern Group Invitation Button */
.dw-group-button {
    display: inline-flex;
    align-items: center;
    padding: 14px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 16px rgba(37, 211, 102, 0.3);
    position: relative;
    overflow: hidden;
}

.dw-group-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.dw-group-button:hover::before {
    left: 100%;
}

.dw-group-button:hover {
    background: linear-gradient(135deg, #128C7E 0%, #0f6b5f 100%);
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.4);
}

.dw-group-button:active {
    transform: translateY(0);
}

.dw-group-button .dw-whatsapp-icon {
    margin-right: 10px;
    font-size: 18px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/* Modern Chat Styles */
.dw-chat-widget.modern {
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dw-chat-widget.classic {
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.dw-chat-widget.minimal {
    border-radius: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
}

.dw-chat-widget.rounded {
    border-radius: 24px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Enhanced Responsive Design */
@media (max-width: 768px) {
    .dw-chat-widget {
        max-width: calc(100vw - 32px);
        min-width: 300px;
        border-radius: 16px;
    }
    
    .dw-chat-widget.bottom-right,
    .dw-chat-widget.bottom-left {
        bottom: 16px;
    }
    
    .dw-chat-widget.top-right,
    .dw-chat-widget.top-left {
        top: 16px;
    }
    
    .dw-chat-header {
        padding: 14px 18px;
        border-radius: 16px 16px 0 0;
    }
    
    .dw-chat-body {
        padding: 18px;
    }
    
    .dw-welcome-bubble {
        padding: 14px 18px;
        border-radius: 16px 16px 16px 4px;
    }
    
    .dw-input-field {
        padding: 12px 16px;
        border-radius: 10px;
    }
    
    .dw-action-button {
        padding: 14px 20px;
        border-radius: 12px;
    }
    
    .dw-floating-icon {
        width: 56px;
        height: 56px;
    }
    
    .dw-floating-icon .dw-whatsapp-icon {
        font-size: 26px;
    }
    
    .dw-group-button {
        padding: 12px 20px;
        border-radius: 12px;
    }
}

@media (max-width: 480px) {
    .dw-chat-widget {
        max-width: calc(100vw - 24px);
        min-width: 280px;
    }
    
    .dw-chat-widget.bottom-right,
    .dw-chat-widget.bottom-left {
        bottom: 12px;
    }
    
    .dw-chat-widget.top-right,
    .dw-chat-widget.top-left {
        top: 12px;
    }
}

/* Modern Animation Classes */
.dw-chat-widget.dw-slide-in {
    animation: slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.dw-fade-in {
    animation: fadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.dw-chat-widget.dw-scale-in {
    animation: scaleIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Enhanced Keyframe Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translateX(0) scale(1);
        opacity: 1;
    }
}

@keyframes slideInFromTopRight {
    from {
        transform: translate(-50%, -150%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes slideInFromTopLeft {
    from {
        transform: translate(-50%, -150%) scale(0.8);
        opacity: 0;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from {
        transform: translate(-50%, -50%) scale(0.3);
        opacity: 0;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
        opacity: 0.8;
    }
    to {
        transform: translate(-50%, -50%) scale(1);
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Hidden State */
.dw-chat-widget.dw-hidden {
    display: none;
}

/* Enhanced Custom Color Support */
.dw-chat-widget[data-button-color] .dw-chat-header {
    background: linear-gradient(135deg, var(--button-color, #25D366) 0%, var(--button-color-dark, #128C7E) 100%);
}

.dw-chat-widget[data-button-color] .dw-action-button,
.dw-chat-widget[data-button-color] .dw-floating-icon,
.dw-chat-widget[data-button-color] .dw-group-button {
    background: linear-gradient(135deg, var(--button-color, #25D366) 0%, var(--button-color-dark, #128C7E) 100%);
}

.dw-chat-widget[data-text-color] .dw-chat-header,
.dw-chat-widget[data-text-color] .dw-action-button,
.dw-chat-widget[data-text-color] .dw-group-button {
    color: var(--text-color, #ffffff);
}

.dw-chat-widget[data-border-color] {
    border-color: var(--border-color, #25D366);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border-color, #25D366);
}

/* Modern Hover Effects */
.dw-chat-widget:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Pulse Animation for Floating Icon */
@keyframes pulse {
    0% {
        box-shadow: 0 8px 32px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 8px 32px rgba(37, 211, 102, 0.6), 0 2px 8px rgba(0, 0, 0, 0.1), 0 0 0 4px rgba(37, 211, 102, 0.1);
    }
    100% {
        box-shadow: 0 8px 32px rgba(37, 211, 102, 0.4), 0 2px 8px rgba(0, 0, 0, 0.1);
    }
}

.dw-floating-icon {
    animation: pulse 2s infinite;
}

/* Loading State */
.dw-action-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.dw-action-button:disabled::before {
    display: none;
}

/* Focus States for Accessibility */
.dw-action-button:focus,
.dw-floating-icon:focus,
.dw-group-button:focus {
    outline: 2px solid #25D366;
    outline-offset: 2px;
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .dw-chat-widget {
        border: 2px solid #000;
    }
    
    .dw-welcome-bubble {
        border: 1px solid #000;
    }
    
    .dw-input-field {
        border: 2px solid #000;
    }
}
