/* Zino Chat Bot Styles */

/* دکمه شناور - سمت راست با طراحی AI */
.zino-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 110px;
    height: 110px;
    border-radius: 0;
    background: transparent;
    color: white;
    border: none;
    box-shadow: none;
    cursor: pointer;
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: visible;
}

/* انیمیشن پالس دکمه */
@keyframes aiPulse {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(99, 102, 241, 0.5), 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    50% {
        box-shadow: 0 8px 32px rgba(99, 102, 241, 0.6), 0 0 30px 8px rgba(139, 92, 246, 0);
    }
}

/* wrapper برای تصویر و بج - انیمیشن روی wrapper تا هر دو باهم حرکت کنن */
.zino-toggle-wrapper {
    position: relative;
    display: inline-block;
    animation: iconBounce 3s ease-in-out infinite;
}

/* آیکون toggle */
.zino-toggle-img {
    width: 110px;
    height: 110px;
    object-fit: cover;
    border-radius: 20px;
    filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

/* بج نسخه آزمایشی - چسبیده به پایین تصویر */
.zino-beta-badge {
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #ef4444, #f97316);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
    z-index: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
}

@keyframes iconBounce {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-6px) scale(1.03);
    }
}

/* انیمیشن ستاره‌ها */
.zino-ai-icon .sparkle-1 {
    animation: sparkle1 2s ease-in-out infinite;
    transform-origin: center;
}

.zino-ai-icon .sparkle-2 {
    animation: sparkle2 2s ease-in-out infinite 0.3s;
    transform-origin: center;
}

.zino-ai-icon .sparkle-3 {
    animation: sparkle3 2s ease-in-out infinite 0.6s;
    transform-origin: center;
}

@keyframes sparkle1 {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.5;
        transform: scale(0.8);
    }
}

@keyframes sparkle2 {
    0%, 100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.6;
        transform: scale(1.2) rotate(45deg);
    }
}

@keyframes sparkle3 {
    0%, 100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
    50% {
        opacity: 0.7;
        transform: scale(1.1) rotate(-45deg);
    }
}

.zino-chat-toggle:hover {
    transform: scale(1.1) translateY(-3px);
    box-shadow: 0 12px 40px rgba(99, 102, 241, 0.6), 0 0 40px rgba(139, 92, 246, 0.4);
    border-radius: 26px;
}

.zino-chat-toggle:hover .zino-ai-icon {
    animation: iconSpin 0.6s ease-in-out;
}

@keyframes iconSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }
    50% {
        transform: rotate(180deg) scale(1.15);
    }
    100% {
        transform: rotate(360deg) scale(1);
    }
}

.zino-chat-toggle:active {
    transform: scale(1.05);
}

.zino-chat-toggle.active {
    background: linear-gradient(135deg, #d946ef 0%, #8b5cf6 50%, #6366f1 100%);
    border-radius: 50%;
    animation: none;
}

.zino-chat-toggle.active .zino-ai-icon {
    transform: rotate(90deg);
}

/* متن AI در زیر آیکون */
.zino-chat-toggle::after {
    content: "AI Assistant";
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 0.5px;
    opacity: 0;
    white-space: nowrap;
    background: linear-gradient(135deg, #6366f1 0%, #d946ef 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    transition: opacity 0.3s;
}

.zino-chat-toggle:hover::after {
    opacity: 1;
}

.zino-chat-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* پنجره چت */
.zino-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 400px;
    height: 620px;
    max-height: calc(100vh - 130px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(99, 102, 241, 0.2), 0 0 1px rgba(0, 0, 0, 0.1);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUpRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(99, 102, 241, 0.1);
}

@keyframes slideUpRight {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* هدر چت */
.zino-chat-header {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.zino-chat-header::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.1) 50%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(100%);
    }
}

.zino-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.zino-chat-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: white;
}

.zino-chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.zino-chat-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.zino-chat-status {
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0.9;
}

.zino-status-dot {
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: blink 2s infinite;
}

@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

.zino-chat-header-actions {
    display: flex;
    gap: 8px;
}

.zino-chat-new,
.zino-chat-minimize {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.zino-chat-new:hover,
.zino-chat-minimize:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* پیام‌ها */
.zino-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    direction: rtl;
}

.zino-chat-welcome {
    text-align: right;
}

.zino-welcome-icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    border-radius: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    color: white;
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.35), 0 0 0 6px rgba(99, 102, 241, 0.08);
    animation: float 3s ease-in-out infinite;
    position: relative;
}

.zino-welcome-icon::after {
    content: "";
    position: absolute;
    top: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: radial-gradient(circle, rgba(255,255,255,0.9) 0%, rgba(255,255,255,0) 70%);
    animation: sparkleWelcome 2s ease-in-out infinite;
}

@keyframes sparkleWelcome {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(20deg) scale(1.3); }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

.zino-chat-welcome h5 {
    margin: 0 0 10px;
    font-size: 20px;
    color: #333;
}

.zino-chat-welcome p {
    color: #666;
    margin: 0 0 24px;
}

.zino-welcome-typing {
    font-size: 14px;
    line-height: 2;
    text-align: right;
    min-height: 40px;
    color: #374151;
}

.zino-welcome-typing br + br {
    display: block;
    content: "";
    margin-top: 4px;
}


/* بابل پیام‌ها */
.zino-chat-message {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.zino-message-content {
    display: flex;
    gap: 8px;
}

.zino-bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.zino-message-bubble {
    max-width: 90%;
    padding: 12px 16px;
    border-radius: 16px;
    position: relative;
}

.zino-chat-message-bot .zino-message-bubble {
    background: white;
    border: 1px solid #e9ecef;
    border-top-right-radius: 4px;
}

.zino-chat-message-user {
    display: flex;
    justify-content: flex-end;
}

.zino-chat-message-user .zino-message-bubble {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-top-left-radius: 4px;
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.2);
}

.zino-message-bubble p {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    word-break: keep-all;
    word-wrap: normal;
    white-space: normal;
    direction: rtl;
    text-align: right;
}

.zino-message-text strong {
    font-weight: 700;
    color: inherit;
}

.zino-message-text em {
    font-style: italic;
    color: inherit;
}

/* Typing cursor animation */
.zino-message-text.typing::after {
    content: '|';
    animation: blink-cursor 0.8s infinite;
    margin-left: 2px;
}

@keyframes blink-cursor {
    0%, 49% {
        opacity: 1;
    }
    50%, 100% {
        opacity: 0;
    }
}

.zino-message-time {
    font-size: 11px;
    opacity: 0.7;
    display: block;
    margin-top: 4px;
}

/* Suggested Actions */
.zino-suggested-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px 40px;
}

.zino-suggested-action {
    background: white;
    border: 1.5px solid #6366f1;
    color: #6366f1;
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.zino-suggested-action:hover {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

/* Action Link */
.zino-action-link-wrapper {
    padding: 0 0 12px 40px;
    animation: slideIn 0.3s ease-out;
}

.zino-action-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    text-decoration: none;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.zino-action-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    color: white;
    text-decoration: none;
}

.zino-action-link i {
    font-size: 14px;
}

/* Typing Indicator - AI Stars Style */
.zino-typing-indicator {
    margin: 0 0 12px 40px;
    width: fit-content;
}

.zino-ai-thinking {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: white;
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.08);
}

.zino-ai-thinking .bi-stars {
    font-size: 16px;
    background: linear-gradient(135deg, #6366f1, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: starSpin 2s linear infinite;
}

@keyframes starSpin {
    0% { transform: rotate(0deg) scale(1); }
    25% { transform: rotate(90deg) scale(1.2); }
    50% { transform: rotate(180deg) scale(1); }
    75% { transform: rotate(270deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

.zino-ai-thinking-text {
    font-size: 12px;
    background: linear-gradient(135deg, #6366f1, #d946ef);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.zino-ai-thinking-text.zino-step-fade {
    animation: stepFadeIn 0.4s ease-out;
}

@keyframes stepFadeIn {
    0% { opacity: 0; transform: translateY(4px); }
    100% { opacity: 1; transform: translateY(0); }
}

.zino-ai-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #8b5cf6;
    animation: aiDotBlink 1.2s ease-in-out infinite;
}

.zino-ai-dot:nth-child(3) { animation-delay: 0s; }
.zino-ai-dot:nth-child(4) { animation-delay: 0.2s; }
.zino-ai-dot:nth-child(5) { animation-delay: 0.4s; }

@keyframes aiDotBlink {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ورودی پیام */
.zino-chat-input-wrapper {
    border-top: 1px solid #e9ecef;
    background: white;
}

.zino-chat-input-form {
    display: flex;
    padding: 16px;
    gap: 8px;
}

.zino-chat-input {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 24px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.zino-chat-input:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.zino-chat-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.zino-chat-send i {
    color: white;
}

.zino-chat-send:hover {
    transform: scale(1.05);
}

.zino-chat-send:active {
    transform: scale(0.95);
}

.zino-chat-footer {
    text-align: center;
    padding: 8px 16px;
    font-size: 11px;
    color: #999;
}

.zino-chat-footer strong {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Responsive */
@media (max-width: 768px) {
    .zino-chat-window {
        width: calc(100% - 24px);
        height: calc(100vh - 110px);
        bottom: 95px;
        right: 12px;
        left: 12px;
    }

    .zino-chat-toggle {
        bottom: 12px;
        right: 12px;
        width: 75px;
        height: 75px;
    }

    .zino-toggle-img {
        width: 75px;
        height: 75px;
        border-radius: 14px;
    }

    .zino-beta-badge {
        font-size: 7px;
        padding: 1px 5px;
        bottom: -4px;
    }

    .zino-ai-icon {
        width: 32px;
        height: 32px;
    }

    .zino-chat-toggle::after {
        display: none;
    }
}

/* اسکرول بار سفارشی */
.zino-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.zino-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.zino-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.zino-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}
