/**
 * CSS styles for chat widget
 * File: assets/css/chat-widget.css
 */

/* Base styles already in templates/chat-widget.php */
/* Additional styles and improvements */

/* Enhanced animations */
@keyframes atc-bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes atc-slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes atc-glow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 30px rgba(102, 126, 234, 0.8);
    }
}

/* Enhanced toggle button */
.atc-chat-toggle {
    animation: atc-bounceIn 0.6s ease-out;
}

.atc-chat-toggle:hover {
    animation: atc-glow 2s infinite;
}

/* Enhanced chat window appearance */
.atc-chat-window {
    animation: atc-slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Additional themes */
.atc-theme-gradient .atc-chat-toggle {
    background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
    background-size: 300% 300%;
    animation: atc-gradientShift 4s ease infinite;
}

@keyframes atc-gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.atc-theme-neon .atc-chat-toggle {
    background: #000;
    border: 2px solid #00ff88;
    box-shadow: 
        0 0 5px #00ff88,
        inset 0 0 5px #00ff88,
        0 0 20px #00ff88;
    color: #00ff88;
}

.atc-theme-glass .atc-chat-window {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.atc-theme-glass .atc-chat-header {
    background: rgba(102, 126, 234, 0.8);
    backdrop-filter: blur(20px);
}

.atc-theme-glass .atc-message-assistant .atc-message-bubble {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
}

/* Message effects */
.atc-message-bubble {
    transition: all 0.3s ease;
}

.atc-message-bubble:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Enhanced typing indicator */
.atc-typing-indicator {
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    background-size: 200% 100%;
    animation: atc-typingBg 2s infinite;
}

@keyframes atc-typingBg {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Confetti effect for new messages */
@keyframes atc-confetti {
    0% {
        transform: translateY(-10px) rotate(0deg);
        opacity: 1;
    }
    100% {
        transform: translateY(100px) rotate(720deg);
        opacity: 0;
    }
}

.atc-confetti {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #ff6b6b;
    pointer-events: none;
    animation: atc-confetti 1s linear forwards;
}

/* Connection status */
.atc-connection-status {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    transition: all 0.3s ease;
}

.atc-connection-status.disconnected {
    background: #ef4444;
    animation: atc-pulse 1s infinite;
}

.atc-connection-status.connecting {
    background: #f59e0b;
    animation: atc-pulse 0.5s infinite;
}

/* Sound visualization */
.atc-sound-wave {
    display: flex;
    align-items: center;
    gap: 2px;
}

.atc-sound-bar {
    width: 2px;
    height: 10px;
    background: currentColor;
    animation: atc-soundWave 1s infinite ease-in-out;
}

.atc-sound-bar:nth-child(2) { animation-delay: 0.1s; }
.atc-sound-bar:nth-child(3) { animation-delay: 0.2s; }
.atc-sound-bar:nth-child(4) { animation-delay: 0.3s; }

@keyframes atc-soundWave {
    0%, 100% { height: 4px; }
    50% { height: 12px; }
}

/* Enhanced notifications */
.atc-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border-left: 4px solid #4ade80;
    max-width: 300px;
    z-index: 1000000;
    animation: atc-slideIn 0.3s ease;
}

@keyframes atc-slideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Dark theme improvements */
.atc-theme-dark .atc-notification {
    background: #1f2937;
    color: white;
    border-left-color: #4ade80;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .atc-chat-toggle {
        border: 3px solid #000;
    }
    
    .atc-message-bubble {
        border: 2px solid #000;
    }
    
    .atc-send-button {
        border: 2px solid #000;
    }
}

/* Reduced motion for accessibility */
@media (prefers-reduced-motion: reduce) {
    .atc-chat-toggle,
    .atc-chat-window,
    .atc-message,
    .atc-typing-indicator {
        animation: none !important;
        transition: none !important;
    }
    
    .atc-chat-toggle:hover {
        transform: none;
    }
}

/* Print styles */
@media print {
    #atc-chat-widget {
        display: none !important;
    }
}

/* High resolution displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .atc-chat-toggle {
        border: 0.5px solid rgba(255, 255, 255, 0.3);
    }
}

/* RTL support */
[dir="rtl"] .atc-position-bottom-right {
    left: 20px;
    right: auto;
}

[dir="rtl"] .atc-position-bottom-left {
    right: 20px;
    left: auto;
}

[dir="rtl"] .atc-message-user {
    flex-direction: row;
}

[dir="rtl"] .atc-message-assistant {
    flex-direction: row-reverse;
}

/* Additional utilities */
.atc-shake {
    animation: atc-shake 0.5s ease-in-out;
}

@keyframes atc-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.atc-flash {
    animation: atc-flash 0.5s ease-in-out;
}

@keyframes atc-flash {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Loading states for elements */
.atc-skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: atc-skeleton 1.5s infinite;
}

@keyframes atc-skeleton {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Advanced button states */
.atc-send-button.atc-sending {
    background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
    background-size: 200% 200%;
    animation: atc-sendingGradient 1s infinite;
}

@keyframes atc-sendingGradient {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* Widget size variants */
.atc-size-small {
    --atc-chat-width: 320px;
    --atc-chat-height: 450px;
    --atc-toggle-size: 50px;
}

.atc-size-large {
    --atc-chat-width: 420px;
    --atc-chat-height: 600px;
    --atc-toggle-size: 70px;
}

/* Custom scrollbar */
.atc-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.atc-chat-messages::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 3px;
}

.atc-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

.atc-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.3);
}

/* Status indicators */
.atc-status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.atc-status-online {
    background: #10b981;
    animation: atc-pulse 2s infinite;
}

.atc-status-busy {
    background: #f59e0b;
}

.atc-status-offline {
    background: #6b7280;
}

/* Message status indicators */
.atc-message-status {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.atc-message-sent::after {
    content: "✓";
    color: #10b981;
}

.atc-message-delivered::after {
    content: "✓✓";
    color: #10b981;
}

.atc-message-read::after {
    content: "✓✓";
    color: #3b82f6;
}

.atc-message-error::after {
    content: "!";
    color: #ef4444;
    background: #fee2e2;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

/* Attachment styles */
.atc-attachment {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    margin-top: 8px;
}

.atc-attachment-icon {
    width: 32px;
    height: 32px;
    background: #667eea;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-right: 8px;
    font-size: 16px;
}

.atc-attachment-info {
    flex: 1;
}

.atc-attachment-name {
    font-weight: 500;
    font-size: 14px;
}

.atc-attachment-size {
    font-size: 12px;
    color: #6b7280;
}

/* Quick replies */
.atc-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.atc-quick-reply {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    padding: 6px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.atc-quick-reply:hover {
    background: #f3f4f6;
    border-color: #667eea;
}

/* Emoji reactions */
.atc-message-reactions {
    display: flex;
    gap: 4px;
    margin-top: 8px;
}

.atc-reaction {
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    padding: 2px 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.atc-reaction:hover {
    background: rgba(102, 126, 234, 0.1);
}

.atc-reaction.active {
    background: rgba(102, 126, 234, 0.2);
}

/* Floating action button variations */
.atc-fab-pulse {
    animation: atc-fabPulse 2s infinite;
}

@keyframes atc-fabPulse {
    0% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4), 0 0 0 10px rgba(102, 126, 234, 0.1);
    }
    100% {
        box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
    }
}

/* Drag and drop overlay */
.atc-drop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(102, 126, 234, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.atc-drop-overlay.active {
    opacity: 1;
    visibility: visible;
}

.atc-drop-message {
    color: white;
    font-size: 18px;
    font-weight: 500;
    text-align: center;
}

/* Compact mode */
.atc-compact-mode .atc-chat-window {
    width: 300px;
    height: 400px;
}

.atc-compact-mode .atc-message-bubble {
    padding: 8px 12px;
    font-size: 13px;
}

.atc-compact-mode .atc-chat-header {
    padding: 12px 16px;
}

/* Full screen mode */
.atc-fullscreen .atc-chat-window {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 999999;
}

/* Performance optimizations */
.atc-chat-window {
    will-change: transform, opacity;
}

.atc-message {
    contain: layout style paint;
}

.atc-chat-toggle {
    will-change: transform;
}