/* Support Chat Widget Styles */
.support-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10000;
    font-family: 'Roboto', sans-serif;
}

.chat-button {
    width: 50px;
    height: 50px;
    background: linear-gradient(45deg, #0078ff, #0056cc);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 120, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
    color: #fff;
}

.chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 120, 255, 0.6);
}

.chat-button i {
    font-size: 20px;
    margin-bottom: 1px;
}

.chat-button-text {
    font-size: 8px;
    font-weight: 600;
}

.chat-notification {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 16px;
    height: 16px;
    background: #ff4444;
    border-radius: 50%;
    border: 2px solid #fff;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.8;
    }
}

.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 320px;
    height: 500px;
    max-height: calc(100vh - 100px);
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(45deg, #0078ff, #0056cc);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-header-info i {
    font-size: 20px;
}

.chat-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chat-status {
    font-size: 11px;
    opacity: 0.9;
}

.chat-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

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

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

.message-content {
    padding: 10px 14px;
    border-radius: 10px;
    word-wrap: break-word;
}

.user-message .message-content {
    background: linear-gradient(45deg, #0078ff, #0056cc);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.bot-message .message-content {
    background: #ffffff;
    color: #333;
    border: 1px solid #e0e0e0;
    border-bottom-left-radius: 4px;
}

.error-message .message-content {
    background: #ffebee;
    color: #c62828;
    border: 1px solid #ffcdd2;
}

.message-content p {
    margin: 0;
    line-height: 1.4;
    font-size: 13px;
}

.message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

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

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

.typing-indicator {
    align-self: flex-start;
}

.typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #999;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.chat-input-container {
    display: flex;
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e0e0e0;
    gap: 8px;
}

.chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.chat-input:focus {
    border-color: #0078ff;
}

.chat-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(45deg, #0078ff, #0056cc);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s;
}

.chat-send:hover:not(:disabled) {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 120, 255, 0.4);
}

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

/* Scrollbar styling */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* RTL Support for Persian */
body[dir="rtl"] .support-chat-widget,
html[lang="fa"] .support-chat-widget {
    right: auto;
    left: 20px;
}

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

body[dir="rtl"] .chat-header,
html[lang="fa"] .chat-header {
    flex-direction: row-reverse;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .chat-window {
        width: calc(100vw - 30px);
        max-width: 340px;
        height: 400px;
        max-height: calc(100vh - 100px);
        bottom: 70px;
    }

    .chat-button {
        width: 50px;
        height: 50px;
    }

    .chat-button i {
        font-size: 20px;
    }

    .chat-button-text {
        font-size: 8px;
    }

    .support-chat-widget {
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        height: 400px;
        max-height: calc(100vh - 90px);
        bottom: 70px;
        border-radius: 10px;
    }
    
    .support-chat-widget {
        bottom: 10px;
        right: 10px;
    }

    .chat-button {
        width: 50px;
        height: 50px;
        box-shadow: 0 4px 12px rgba(0, 120, 255, 0.5);
    }

    .chat-button-text {
        font-size: 8px;
    }

    .chat-header {
        padding: 14px 16px;
    }

    .chat-header-info {
        gap: 10px;
    }

    .chat-header-info i {
        font-size: 20px;
    }

    .chat-title {
        font-size: 15px;
    }

    .chat-status {
        font-size: 11px;
    }

    .chat-close {
        width: 30px;
        height: 30px;
        font-size: 18px;
    }

    .chat-messages {
        padding: 16px;
        gap: 12px;
    }

    .message-content {
        padding: 10px 14px;
    }

    .message-content p {
        font-size: 13px;
        line-height: 1.4;
    }

    .message-time {
        font-size: 10px;
        margin-top: 3px;
    }

    .chat-input-container {
        padding: 12px;
        gap: 8px;
    }

    .chat-input {
        padding: 12px 14px;
        font-size: 14px; /* Prevents zoom on iOS */
        min-height: 44px; /* Touch-friendly */
    }

    .chat-send {
        width: 44px;
        height: 44px;
        min-width: 44px;
        font-size: 16px;
    }
}

/* RTL Mobile Support */
@media (max-width: 480px) {
    body[dir="rtl"] .support-chat-widget,
    html[lang="fa"] .support-chat-widget {
        right: auto;
        left: 10px;
    }

    body[dir="rtl"] .chat-window,
    html[lang="fa"] .chat-window {
        right: auto;
        left: 10px;
    }
}

/* Touch Device Optimizations */
@media (hover: none) and (pointer: coarse) {
    .chat-button:hover {
        transform: none;
    }

    .chat-send:hover:not(:disabled) {
        transform: none;
    }

    .chat-close:hover {
        background: rgba(255, 255, 255, 0.15);
    }

    .chat-button,
    .chat-send,
    .chat-close {
        -webkit-tap-highlight-color: rgba(0, 120, 255, 0.3);
    }
}

