/* ========================================== */
/* AUTOMIZE BRANDED CHATBOT - COMPLETE CSS */
/* Version: 4.5 with Full Animations */
/* WordPress Plugin Safe - No :root or body conflicts */
/* ========================================== */

/* ========================================== */
/* IMPORT CAIRO FONT */
/* ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@200;300;400;500;600;700;800;900&display=swap');

/* ========================================== */
/* SCOPED VARIABLES - WordPress Safe */
/* ========================================== */
#chat-widget-button,
#chat-widget-container {
    --primary-color: #4ECDC4;
    --secondary-color: #44A08D;
    --slate-900: #0f172a;
    --slate-800: #1e293b;
    --slate-700: #334155;
    --slate-600: #475569;
    --slate-400: #94a3b8;
    --slate-300: #cbd5e1;
    --white: #ffffff;
    --green-300: #86efac;
}

/* ========================================== */
/* SCOPED STYLES - Apply font only to chat widget */
/* ========================================== */
#chat-widget-button *,
#chat-widget-container * {
    font-family: 'Cairo', sans-serif !important;
    box-sizing: border-box;
}

/* Remove global * and body styles to avoid WordPress conflicts */

/* ========================================== */
/* CHAT WIDGET BUTTON (FLOATING) */
/* ========================================== */
#chat-widget-button {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 4rem;
    height: 4rem;
    border-radius: 50%;
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--white);
    font-size: 1.75rem;
    cursor: pointer;
    z-index: 1001;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    animation: button-entrance 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55), button-float 2s ease-in-out infinite;
}

.chat-button-pulse {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    animation: pulse-ring 2s ease-out infinite;
    z-index: 1;
    pointer-events: none;
}

@keyframes button-entrance {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes button-float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse-ring {
    0% {
        transform: scale(1);
        opacity: 0.5;
    }
    100% {
        transform: scale(1.5);
        opacity: 0;
    }
}

#chat-widget-button:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 0 40px rgba(78, 205, 196, 0.6);
}

#chat-widget-button:active {
    transform: scale(0.9);
}

.button-icon {
    animation: icon-wiggle 1s ease-in-out infinite;
    animation-delay: 2s;
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.button-icon img.emoji {
    width: 1.75rem;
    height: 1.75rem;
    display: inline-block;
    vertical-align: middle;
}

@keyframes icon-wiggle {
    0%, 100% {
        transform: rotate(0deg);
    }
    25% {
        transform: rotate(10deg);
    }
    75% {
        transform: rotate(-10deg);
    }
}

/* ========================================== */
/* CHAT WIDGET CONTAINER */
/* ========================================== */
#chat-widget-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    width: 100%;
    max-width: 28rem;
    height: 600px;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(24px);
    border-radius: 1.5rem;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--slate-700);
    z-index: 1000;
    animation: chat-entrance 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    direction: rtl;
}

#chat-widget-container.open {
    display: flex;
}

@keyframes chat-entrance {
    from {
        opacity: 0;
        transform: translateX(100px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* ========================================== */
/* CHAT HEADER */
/* ========================================== */
#chat-widget-header {
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
    animation: header-slide-in 0.4s ease 0.1s both;
}

@keyframes header-slide-in {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.header-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.2;
    background-image: radial-gradient(circle, white 1px, transparent 1px);
    background-size: 20px 20px;
    animation: pattern-slide 4s linear infinite;
}

@keyframes pattern-slide {
    from {
        background-position: 0px 0px;
    }
    to {
        background-position: 20px 20px;
    }
}

.header-left {
    display: flex;
    align-items: center;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

.chat-close-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 10;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1) rotate(90deg);
}

.chat-close-btn:active {
    transform: scale(0.9);
}

.header-avatar {
    width: 2.5rem;
    height: 2.5rem;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
    z-index: 10;
    animation: avatar-bounce 2s ease-in-out infinite;
    animation-delay: 3s;
    flex-shrink: 0;
}

.avatar-icon {
    font-size: 1.25rem;
}

.header-content {
    flex: 1;
    text-align: right;
    position: relative;
    z-index: 10;
    margin-left: 0.75rem;
    margin-right: 1rem;
}

.header-title {
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
}

.header-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: flex-end;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.95);
    margin-top: 0.125rem;
}

.status-indicator {
    width: 0.5rem;
    height: 0.5rem;
    background: var(--green-300);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(134, 239, 172, 0.5);
    animation: status-pulse 2s ease-in-out infinite;
}

@keyframes status-pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.3);
        opacity: 0.6;
    }
}

@keyframes avatar-bounce {
    0%, 100% {
        transform: rotate(0deg) scale(1);
    }
    10% {
        transform: rotate(10deg) scale(1.05);
    }
    20% {
        transform: rotate(-10deg) scale(1.05);
    }
    30% {
        transform: rotate(10deg) scale(1.05);
    }
    40% {
        transform: rotate(0deg) scale(1);
    }
}

/* ========================================== */
/* CHAT BODY / MESSAGES AREA */
/* ========================================== */
#chat-widget-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 1.25rem;
    background: linear-gradient(to bottom, var(--slate-900), var(--slate-800));
    position: relative;
    direction: rtl;
    scroll-behavior: smooth;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

/* Custom scrollbar */
#chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

#chat-widget-body::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#chat-widget-body::-webkit-scrollbar-thumb {
    background: rgba(78, 205, 196, 0.3);
    border-radius: 10px;
}

#chat-widget-body::-webkit-scrollbar-thumb:hover {
    background: rgba(78, 205, 196, 0.5);
}

/* Animated particles */
.chat-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(78, 205, 196, 0.3);
    border-radius: 50%;
    pointer-events: none;
}

/* Animated particles */
.chat-particle {
    position: absolute;
    width: 4px;
    height: 4px;
    background: rgba(78, 205, 196, 0.3);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
}

.chat-particle:nth-child(1) {
    width: 4px;
    height: 4px;
    right: 15%;
    top: 90%;
    animation: particle-float-1 5s ease-in-out infinite;
}

.chat-particle:nth-child(2) {
    width: 4px;
    height: 4px;
    right: 45%;
    top: 95%;
    animation: particle-float-2 7s ease-in-out infinite 2s;
}

.chat-particle:nth-child(3) {
    width: 4px;
    height: 4px;
    right: 75%;
    top: 85%;
    animation: particle-float-3 6s ease-in-out infinite 4s;
}

.chat-particle:nth-child(4) {
    width: 4px;
    height: 4px;
    right: 30%;
    top: 80%;
    animation: particle-float-1 8s ease-in-out infinite 1s;
}

.chat-particle:nth-child(5) {
    width: 4px;
    height: 4px;
    right: 60%;
    top: 92%;
    animation: particle-float-2 6.5s ease-in-out infinite 3s;
}

.chat-particle:nth-child(6) {
    width: 4px;
    height: 4px;
    right: 85%;
    top: 88%;
    animation: particle-float-3 7.5s ease-in-out infinite 5s;
}

.chat-particle:nth-child(7) {
    width: 4px;
    height: 4px;
    right: 10%;
    top: 93%;
    animation: particle-float-1 5.5s ease-in-out infinite 2.5s;
}

.chat-particle:nth-child(8) {
    width: 4px;
    height: 4px;
    right: 50%;
    top: 87%;
    animation: particle-float-2 6.8s ease-in-out infinite 4.5s;
}

.chat-particle:nth-child(9) {
    width: 4px;
    height: 4px;
    right: 22%;
    top: 82%;
    animation: particle-float-3 7.2s ease-in-out infinite 1.8s;
}

.chat-particle:nth-child(10) {
    width: 4px;
    height: 4px;
    right: 68%;
    top: 94%;
    animation: particle-float-1 6.3s ease-in-out infinite 3.2s;
}

.chat-particle:nth-child(11) {
    width: 4px;
    height: 4px;
    right: 38%;
    top: 89%;
    animation: particle-float-2 7.8s ease-in-out infinite 2.8s;
}

.chat-particle:nth-child(12) {
    width: 4px;
    height: 4px;
    right: 92%;
    top: 91%;
    animation: particle-float-3 5.8s ease-in-out infinite 4.2s;
}

.chat-particle:nth-child(13) {
    width: 4px;
    height: 4px;
    right: 18%;
    top: 86%;
    animation: particle-float-1 6.9s ease-in-out infinite 3.6s;
}

.chat-particle:nth-child(14) {
    width: 4px;
    height: 4px;
    right: 55%;
    top: 83%;
    animation: particle-float-2 7.4s ease-in-out infinite 1.2s;
}

.chat-particle:nth-child(15) {
    width: 4px;
    height: 4px;
    right: 78%;
    top: 96%;
    animation: particle-float-3 6.6s ease-in-out infinite 5.4s;
}

.chat-particle:nth-child(16) {
    width: 4px;
    height: 4px;
    right: 42%;
    top: 90%;
    animation: particle-float-1 7.1s ease-in-out infinite 2.1s;
}

@keyframes particle-float-1 {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0;
    }
    100% {
        transform: translateY(-100px) translateX(10px);
        opacity: 0;
    }
}

@keyframes particle-float-2 {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 0;
    }
    100% {
        transform: translateY(-100px) translateX(-15px);
        opacity: 0;
    }
}

@keyframes particle-float-3 {
    0% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    50% {
        transform: translateY(-50px) translateX(5px);
    }
    90% {
        opacity: 0;
    }
    100% {
        transform: translateY(-100px) translateX(-5px);
        opacity: 0;
    }
}

#chat-widget-body::-webkit-scrollbar {
    width: 6px;
}

#chat-widget-body::-webkit-scrollbar-track {
    background: transparent;
}

#chat-widget-body::-webkit-scrollbar-thumb {
    background: var(--slate-600);
    border-radius: 10px;
}

#chat-widget-body::-webkit-scrollbar-thumb:hover {
    background: var(--slate-500);
}

/* ========================================== */
/* CHAT MESSAGES */
/* ========================================== */
.chat-message {
    display: flex;
    gap: 0.75rem;
    animation: message-slide-in 0.5s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes message-slide-in {
    from {
        opacity: 0;
        transform: translateY(25px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chat-message.bot-message {
    flex-direction: row-reverse;
}

.chat-message.user-message {
    flex-direction: row;
}

.message-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 2px solid var(--slate-700);
    animation: avatar-pop 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes avatar-pop {
    from {
        transform: scale(0) rotate(-180deg);
    }
    to {
        transform: scale(1) rotate(0deg);
    }
}

.message-avatar.bot-avatar {
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    color: var(--white);
    position: relative;
}

.message-avatar.bot-avatar::after {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: linear-gradient(45deg, var(--primary-color), var(--secondary-color), var(--primary-color));
    z-index: -1;
    animation: avatar-rotate 3s linear infinite;
    opacity: 0.6;
}

@keyframes avatar-rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.message-avatar.user-avatar {
    background: linear-gradient(to bottom right, var(--slate-600), var(--slate-700));
    color: var(--white);
    font-size: 1rem;
    font-weight: 600;
}

.message-content-wrapper {
    display: flex;
    flex-direction: column;
    max-width: 70%;
}

.bot-message .message-content-wrapper {
    align-items: flex-end;
}

.user-message .message-content-wrapper {
    align-items: flex-start;
}

.message-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    font-size: 1rem;
    word-wrap: break-word;
    line-height: 1.5;
    position: relative;
    overflow: hidden;
    animation: bubble-scale 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    animation-delay: 0.2s;
    animation-fill-mode: both;
}

@keyframes bubble-scale {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.message-bubble:hover {
    transform: scale(1.02);
    transition: transform 0.2s ease;
}

.bot-message .message-bubble {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: none;
    border-top-right-radius: 0.25rem;
    color: var(--white);
}

.user-message .message-bubble {
    background: rgba(51, 65, 85, 0.8);
    border: 1px solid var(--slate-600);
    backdrop-filter: blur(8px);
    border-top-left-radius: 0.25rem;
    box-shadow: 0 10px 15px -3px rgba(78, 205, 196, 0.2);
    color: var(--white);
}

/* HTML Content Formatting in Bot Messages */
.bot-message .message-bubble p {
    margin: 0.5rem 0;
    line-height: 1.6;
}

.bot-message .message-bubble p:first-child {
    margin-top: 0;
}

.bot-message .message-bubble p:last-child {
    margin-bottom: 0;
}

.bot-message .message-bubble a {
    color: var(--primary-color);
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

.bot-message .message-bubble a:hover {
    opacity: 0.8;
}

.bot-message .message-bubble strong,
.bot-message .message-bubble b {
    font-weight: 700;
    color: var(--white);
}

.bot-message .message-bubble em,
.bot-message .message-bubble i {
    font-style: italic;
}

.bot-message .message-bubble ul,
.bot-message .message-bubble ol {
    margin: 0.5rem 0;
    padding-right: 1.5rem;
    padding-left: 0;
}

.bot-message .message-bubble li {
    margin: 0.25rem 0;
    line-height: 1.6;
}

.bot-message .message-bubble code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: monospace;
    font-size: 0.875em;
}

.bot-message .message-bubble pre {
    background: rgba(255, 255, 255, 0.05);
    padding: 0.75rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}

.bot-message .message-bubble pre code {
    background: none;
    padding: 0;
}

.bot-message .message-bubble h1,
.bot-message .message-bubble h2,
.bot-message .message-bubble h3,
.bot-message .message-bubble h4,
.bot-message .message-bubble h5,
.bot-message .message-bubble h6 {
    margin: 0.75rem 0 0.5rem 0;
    font-weight: 600;
    line-height: 1.4;
    color: var(--white) !important;
}

.bot-message .message-bubble h1 { font-size: 1.5em; }
.bot-message .message-bubble h2 { font-size: 1.3em; }
.bot-message .message-bubble h3 { font-size: 1.1em; }
.bot-message .message-bubble h4 { font-size: 1em; }
.bot-message .message-bubble h5 { font-size: 0.9em; }
.bot-message .message-bubble h6 { font-size: 0.85em; }

.bot-message .message-bubble blockquote {
    border-right: 3px solid var(--primary-color);
    padding-right: 0.75rem;
    margin: 0.5rem 0;
    opacity: 0.9;
}

.bot-message .message-bubble hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    margin: 0.75rem 0;
}

.bot-message .message-bubble img {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

/* Animated shimmer for bot messages */
.bot-message .message-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, transparent, rgba(148, 163, 184, 0.2), transparent);
    animation: shimmer 3s ease-in-out infinite;
    animation-delay: 5s;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.message-timestamp {
    font-size: 0.75rem;
    color: var(--slate-400);
    margin-top: 0.25rem;
    padding: 0 0.5rem;
    animation: fade-in 0.3s ease;
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================== */
/* TYPING INDICATOR */
/* ========================================== */
.typing-indicator {
    display: flex;
    gap: 0.75rem;
    flex-direction: row-reverse;
    animation: message-slide-in 0.3s ease;
}

.typing-indicator .message-avatar {
    animation: avatar-pop 0.3s ease;
}

.typing-indicator .message-content-wrapper {
    align-items: flex-end;
}

.typing-bubble {
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    background: rgba(51, 65, 85, 0.8);
    border: 1px solid var(--slate-600);
    border-top-right-radius: 0.25rem;
    backdrop-filter: blur(8px);
    position: relative;
    overflow: hidden;
    animation: bubble-scale 0.3s ease;
}

.typing-bubble::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(78, 205, 196, 0.1), rgba(68, 160, 141, 0.1));
    animation: typing-shimmer 1.5s linear infinite;
}

@keyframes typing-shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
    position: relative;
    z-index: 10;
}

.typing-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    animation: typing-bounce 0.6s ease-in-out infinite;
}

.typing-dot:nth-child(1) {
    animation-delay: 0s;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.15s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes typing-bounce {
    0%, 60%, 100% {
        transform: translateY(0) scale(1);
    }
    30% {
        transform: translateY(-10px) scale(1.2);
    }
}

/* ========================================== */
/* QUICK REPLIES */
/* ========================================== */
.quick-replies {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-bottom: 1.25rem;
    animation: fade-in-up 0.5s ease;
    animation-delay: 0.2s;
    animation-fill-mode: both;
    width: 100%;
}

.quick-reply-btn {
    padding: 0.5rem 1rem;
    border-radius: 9999px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: 2px solid var(--primary-color);
    color: var(--white);
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    animation: quick-reply-pop 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    flex-shrink: 1;
    white-space: normal;
    max-width: 48%;
    text-align: center;
    line-height: 1.3;
}

.quick-reply-btn:nth-child(1) {
    animation-delay: 0.3s;
    animation-fill-mode: both;
}

.quick-reply-btn:nth-child(2) {
    animation-delay: 0.4s;
    animation-fill-mode: both;
}

.quick-reply-btn:nth-child(3) {
    animation-delay: 0.5s;
    animation-fill-mode: both;
}

.quick-reply-btn:nth-child(4) {
    animation-delay: 0.6s;
    animation-fill-mode: both;
}

@keyframes quick-reply-pop {
    from {
        opacity: 0;
        transform: scale(0.7) translateY(30px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    border-color: var(--secondary-color);
    color: var(--white);
    transform: scale(1.05) translateY(-2px);
    box-shadow: 0 4px 12px rgba(78, 205, 196, 0.5);
}

.quick-reply-btn:active {
    transform: scale(0.95) translateY(0);
}

.reply-icon {
    animation: icon-rotate 2s ease-in-out infinite;
}

.quick-reply-btn:nth-child(1) .reply-icon {
    animation-delay: 0s;
}

.quick-reply-btn:nth-child(2) .reply-icon {
    animation-delay: 0.5s;
}

.quick-reply-btn:nth-child(3) .reply-icon {
    animation-delay: 1s;
}

.quick-reply-btn:nth-child(4) .reply-icon {
    animation-delay: 1.5s;
}

@keyframes icon-rotate {
    0%, 90%, 100% {
        transform: rotate(0deg);
    }
    92% {
        transform: rotate(10deg);
    }
    96% {
        transform: rotate(-10deg);
    }
}

/* ========================================== */
/* CHAT FOOTER / INPUT AREA */
/* ========================================== */
#chat-widget-footer {
    padding: 1.25rem;
    background: rgba(30, 41, 59, 0.95);
    backdrop-filter: blur(24px);
    border-top: 1px solid var(--slate-700);
    position: relative;
    overflow: hidden;
    animation: footer-slide-in 0.4s ease 0.2s both;
}

@keyframes footer-slide-in {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.footer-gradient-line {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(to right, transparent, var(--primary-color), transparent);
    animation: gradient-slide 3s linear infinite;
}

@keyframes gradient-slide {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
}

#chat-widget-input {
    flex: 1;
    padding: 0.75rem 1.25rem;
    border-radius: 9999px;
    border: 2px solid var(--slate-600);
    background: rgba(51, 65, 85, 0.5);
    color: var(--white);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    direction: rtl;
    text-align: right;
    order: 1;
}

#chat-widget-input::placeholder {
    color: var(--slate-400);
}

#chat-widget-input:focus {
    border-color: var(--primary-color);
    background: rgba(51, 65, 85, 0.8);
    box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.2);
}

#chat-widget-send {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: linear-gradient(to bottom right, var(--primary-color), var(--secondary-color));
    border: none;
    color: var(--white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 10px 15px -3px rgba(78, 205, 196, 0.3);
    position: relative;
    overflow: hidden;
    order: 2;
}

#chat-widget-send::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.2);
    transform: scale(0);
    opacity: 0;
    border-radius: 50%;
    transition: all 0.6s ease;
}

#chat-widget-send:hover::before {
    transform: scale(2);
    opacity: 0;
}

#chat-widget-send:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 15px -3px rgba(78, 205, 196, 0.5);
}

#chat-widget-send:active {
    transform: scale(0.95);
}

#chat-widget-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.send-icon {
    font-size: 1.25rem;
    position: relative;
    z-index: 10;
}

/* ========================================== */
/* RESPONSIVE DESIGN */
/* ========================================== */
@media (max-width: 640px) {
    #chat-widget-container {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        width: calc(100% - 1rem);
        max-width: none;
        height: calc(100vh - 1rem);
        max-height: 600px;
    }

    #chat-widget-button {
        right: 1rem;
        bottom: 1rem;
        width: 3.5rem;
        height: 3.5rem;
        font-size: 1.5rem;
    }

    #chat-widget-header {
        padding: 0.875rem 1rem;
    }

    .header-avatar {
        width: 2.25rem;
        height: 2.25rem;
    }

    .avatar-icon {
        font-size: 1.125rem;
    }

    .header-title {
        font-size: 1rem;
    }

    .header-status {
        font-size: 0.75rem;
    }

    .chat-close-btn {
        width: 1.75rem;
        height: 1.75rem;
        font-size: 0.875rem;
    }

    #chat-widget-body {
        padding: 1rem;
    }

    .message-bubble {
        font-size: 0.9375rem;
    }

    .quick-replies {
        gap: 0.4rem;
    }

    .quick-reply-btn {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        gap: 0.35rem;
        max-width: 48%;
    }

    #chat-widget-footer {
        padding: 1rem;
    }

    #chat-widget-input {
        padding: 0.625rem 1rem;
        font-size: 0.9375rem;
    }

    #chat-widget-send {
        width: 2.75rem;
        height: 2.75rem;
    }

    .send-icon {
        font-size: 1.125rem;
    }
}

/* ========================================== */
/* UTILITY CLASSES */
/* ========================================== */
.hidden {
    display: none !important;
}

.fade-out {
    animation: fade-out 0.3s ease forwards;
}

@keyframes fade-out {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

@keyframes fade-in-up {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Dynamic quick replies styling */
.dynamic-quick-replies {
    margin-top: 0.5rem;
}

.dynamic-quick-replies .quick-reply-btn {
    opacity: 0;
    animation: quick-reply-pop 0.7s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
