:root {
    --chat-primary: #00332b;
    --chat-secondary: #e4e3fc;
    --chat-user-bg: #075e54;
    --chat-admin-bg: #f0f0f0;
    --chat-border-radius: 12px;
    --chat-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: transparent;
}

.chat-widget-container {
    position: fixed;
    bottom: 20px;
    /*right: 20px;*/
    z-index: 10000;
    width: 380px;
    max-width: 90vw;
}

.chat-widget-container.position-right {
    right: 20px;
}

.chat-widget-container.position-left {
    left: 20px;
}

.chat-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--chat-primary) 0%, #424242 100%);
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--chat-shadow);
    transition: var(--chat-transition);
    position: relative;
    overflow: hidden;
    padding: 0;
    /*margin-left: auto;*/
    margin-bottom: 16px;
}

.position-right .chat-toggle {
    margin-left: auto;
}

.position-left .chat-toggle {
    margin-right: auto;
}

.chat-toggle::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(45deg);
    transition: all 0.6s;
    opacity: 0;
}

.chat-toggle:hover::before {
    opacity: 1;
    transform: rotate(45deg) translate(30%, 30%);
}

.chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.chat-toggle img {
    width: calc(100% - 4px);
    height: calc(100% - 4px);
    object-fit: cover;
    border-radius: 50%;
    object-position: center;
    aspect-ratio: 1 / 1;
}

.chat-container {
    background: white;
    border-radius: var(--chat-border-radius);
    box-shadow: var(--chat-shadow);
    transform: translateY(20px);
    opacity: 0;
    transition: var(--chat-transition);
    overflow: hidden;
    border: 1px solid rgba(0, 51, 43, 0.1);
    backdrop-filter: blur(10px);
    display: none;
    /* Added Scroll bug */
    /*height: 100%;*/
    /*overflow-y: auto;*/
    /*-webkit-overflow-scrolling: touch; !* برای iOS و کروم اندروید *!*/
}

.chat-container.show {
    transform: translateY(0);
    opacity: 1;
}

.chat-header {
    background: linear-gradient(135deg, var(--chat-primary) 0%, #004d42 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

.chat-header::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
}

.chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.chat-messages {
    height: 400px;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9ff 0%, #e4e3fc 100%);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    position: relative;
    word-wrap: break-word;
}

.chat-message p {
    margin: 0;
}

.user-message {
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    color: white;
    align-self: flex-start;
    border-bottom-right-radius: 4px;
}

.user-message p {
    color: white !important;
}

.admin-message {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    color: #0e1011;
    align-self: flex-end;
    border-bottom-left-radius: 4px;
    border: 1px solid #e9ecef;
}

.admin-message p {
    color: black !important;
}

.chat-input-area {
    background: white;
    padding: 12px;
    border-top: 1px solid #e0e0e0;
}

.chat-input {
    flex: 1; /* پر کردن فضای باقی‌مانده */
    resize: none;
    /*border: none;*/
    outline: none;

    border-radius: 20px !important;
    /*resize: none;*/
    max-height: 100px;
    border: 1px solid #e0e0e0 !important;
    font-family: inherit;
}

.chat-input:focus {
    border-color: var(--chat-primary) !important;
    box-shadow: 0 0 0 0.2rem rgba(0, 51, 43, 0.25) !important;
}

.chat-send-btn {
    background: var(--chat-primary);
    color: white;
    border: none;
    border-radius: 50% !important;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--chat-transition);
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
    fill: white;
    transform: scaleX(-1);
}

.chat-send-btn:hover:not(:disabled) {
    background: #004d42;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}



.new-message-banner {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    background: #004d42;
    color: white;
    border-radius: 20px;
    font-size: 13px;
    display: none;
    cursor: pointer;
    z-index: 10001;
    padding: 8px 16px;
}

.typing-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 24px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #666;
    border-radius: 50%;
    display: inline-block;
    animation: bounceDot 1.2s infinite ease-in-out !important;
}

.typing-dots span:nth-child(1) {
    animation-delay: 0.3s !important;
}
.typing-dots span:nth-child(2) {
    animation-delay: 0.15s !important;
}
.typing-dots span:nth-child(3) {
    animation-delay: 0s !important;
}

@keyframes bounceDot {
    0%,
    80%,
    100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    40% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

.operator-buttons {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.operator-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.operator-btn.btn-danger {
    background: #dc3545;
    color: white;
}

.operator-btn.btn-danger:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.operator-btn.btn-secondary {
    background: #6c757d;
    color: white;
}

.operator-btn.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.operator-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Feedback button styles */
.feedback-buttons {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 8px;
    background: #f8f9fa;
    border-radius: 12px;
    border: 1px solid #e9ecef;
}

.feedback-btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    background: white;
    color: #495057;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.feedback-like:hover:not(:disabled) {
    background: #d4edda;
    border-color: #28a745;
    color: #155724;
    transform: translateY(-1px);
}

.feedback-dislike:hover:not(:disabled) {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    transform: translateY(-1px);
}

.feedback-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.feedback-btn svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.feedback-thank-you {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 12px;
    color: #28a745;
    font-size: 13px;
    font-weight: 500;
    background: #d4edda;
    border-radius: 8px;
    border: 1px solid #c3e6cb;
}

.feedback-thank-you svg {
    width: 16px;
    height: 16px;
    stroke: #28a745;
}

.feedback-error {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: #721c24;
    font-size: 13px;
    font-weight: 500;
    background: #f8d7da;
    border-radius: 8px;
    border: 1px solid #f5c6cb;
}

/* Responsive adjustments for feedback buttons */
@media (max-width: 480px) {
    .feedback-buttons {
        flex-direction: row;
        gap: 6px;
    }

    .feedback-btn {
        font-size: 12px;
        padding: 6px 10px;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .chat-widget-container {
        width: calc(100vw - 20px);
        bottom: 10px;
    }

    .chat-widget-container.position-right {
        right: 10px;
    }

    .chat-widget-container.position-left {
        left: 10px;
    }
}
