/* Simple Chat Widget Styles - Modern, Clean, Responsive */

:root {
    --chat-primary: #007bff;
    --chat-primary-hover: #0056b3;
    --chat-success: #28a745;
    --chat-danger: #dc3545;
    --chat-warning: #ffc107;
    --chat-light: #f8f9fa;
    --chat-dark: #343a40;
    --chat-border: #dee2e6;
    --chat-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    --chat-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.2);
    --chat-radius: 12px;
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --chat-z-index: 10000;
}

/* Main Chat Widget Container */
#simple-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--chat-z-index);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    width: 60px;
    height: 60px;
    background: var(--chat-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--chat-shadow);
    transition: var(--chat-transition);
    position: relative;
    color: white;
}

.chat-toggle:hover {
    background: var(--chat-primary-hover);
    box-shadow: var(--chat-shadow-hover);
    transform: scale(1.05);
}

.chat-toggle.active {
    background: var(--chat-success);
}

/* Unread Badge */
.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: var(--chat-danger);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: var(--chat-radius);
    box-shadow: var(--chat-shadow);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: var(--chat-transition);
    overflow: hidden;
}

.chat-window.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.chat-window.minimized {
    height: 60px;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: var(--chat-primary);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: var(--chat-radius) var(--chat-radius) 0 0;
}

.chat-header-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.status-indicator {
    font-size: 12px;
    opacity: 0.9;
}

.status-indicator.online {
    color: #4caf50;
}

.status-indicator.online::before {
    content: '●';
    margin-right: 5px;
}

.chat-header-actions {
    display: flex;
    gap: 10px;
}

.minimize-btn,
.close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

.minimize-btn:hover,
.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Container */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.messages-list {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Message Styles */
.message {
    display: flex;
    max-width: 80%;
    animation: messageSlide 0.3s ease-out;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.message.support {
    align-self: flex-start;
}

.message.system {
    align-self: center;
    max-width: 100%;
}

.message-content {
    background: var(--chat-light);
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
}

.message.user .message-content {
    background: var(--chat-primary);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.support .message-content {
    background: white;
    border: 1px solid var(--chat-border);
    border-bottom-left-radius: 6px;
}

.message.system .message-content {
    background: var(--chat-warning);
    color: var(--chat-dark);
    text-align: center;
    font-size: 14px;
}

.message-text {
    margin-bottom: 4px;
    line-height: 1.4;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    text-align: right;
}

.message.user .message-time {
    text-align: left;
}

.message.system .message-time {
    text-align: center;
}

/* Typing Indicator */
.typing-indicator {
    padding: 0 20px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #666;
    font-size: 14px;
}

.typing-dots {
    display: flex;
    gap: 3px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: typingDot 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typingDot {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Message Input Container */
.message-input-container {
    padding: 15px 20px;
    border-top: 1px solid var(--chat-border);
    background: white;
}

.input-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    background: var(--chat-light);
    border-radius: 24px;
    padding: 8px 12px;
    border: 1px solid var(--chat-border);
    transition: border-color 0.2s;
}

.input-wrapper:focus-within {
    border-color: var(--chat-primary);
}

#message-input {
    flex: 1;
    border: none;
    outline: none;
    background: none;
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.4;
    resize: none;
    min-height: 20px;
    max-height: 120px;
    font-family: inherit;
}

#message-input::placeholder {
    color: #999;
}

.send-button {
    width: 36px;
    height: 36px;
    background: var(--chat-primary);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
    flex-shrink: 0;
}

.send-button:hover:not(:disabled) {
    background: var(--chat-primary-hover);
    transform: scale(1.05);
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #simple-chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 90px;
        right: -10px;
        border-radius: var(--chat-radius) var(--chat-radius) 0 0;
    }

    .chat-window.open {
        height: calc(100vh - 100px);
    }

    .messages-list {
        padding: 15px;
    }

    .message {
        max-width: 85%;
    }

    .message-input-container {
        padding: 10px 15px;
    }
}

@media (max-width: 480px) {
    .chat-toggle {
        width: 50px;
        height: 50px;
    }

    .chat-window {
        width: calc(100vw - 10px);
        right: -5px;
    }

    .chat-header {
        padding: 12px 15px;
    }

    .messages-list {
        padding: 10px;
    }

    .message-input-container {
        padding: 8px 10px;
    }
}

/* Dark theme support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #2d3748;
        color: white;
    }

    .message.support .message-content {
        background: #4a5568;
        color: white;
        border-color: #718096;
    }

    .message-input-container {
        background: #2d3748;
        border-color: #4a5568;
    }

    .input-wrapper {
        background: #4a5568;
        border-color: #718096;
    }

    #message-input {
        color: white;
    }

    #message-input::placeholder {
        color: #a0aec0;
    }
}

/* Accessibility improvements */
.chat-toggle:focus,
.send-button:focus,
.minimize-btn:focus,
.close-btn:focus {
    outline: 2px solid var(--chat-primary);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --chat-border: #000;
        --chat-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    }

    .message.support .message-content {
        border: 2px solid var(--chat-border);
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}