/**
 * Chatbot Module Styles
 * Digital Agency AI Assistant
 */

/* ===== ZAŠTITA OD KOPIRANJA ===== */
#chatbot-widget {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Poruke su zaštićene od selekcije */
.chatbot-message {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
}

/* Input polje - omogući selekciju za korisnike */
#chatbot-input {
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
}

/* Toggle Button */
.chatbot-toggle-btn {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: pulse-chat 2s ease-in-out infinite;
}

.chatbot-toggle-btn:hover {
    animation: none;
}

@keyframes pulse-chat {
    0%, 100% {
        box-shadow: 0 10px 25px rgba(99, 102, 241, 0.2);
    }
    50% {
        box-shadow: 0 10px 35px rgba(99, 102, 241, 0.4);
    }
}

/* Chat Window */
.chatbot-window {
    animation: slideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: calc(100vh - 80px);
}

.chatbot-window.hidden {
    display: none !important;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(20px, 20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }
}

/* Messages Container */
#chatbot-messages {
    background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
}

#chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

#chatbot-messages::-webkit-scrollbar-track {
    background: #e5e7eb;
    border-radius: 10px;
}

#chatbot-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 10px;
}

#chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Message Styles */
.chatbot-window .flex.justify-end > div {
    animation: fadeInRight 0.3s ease-out;
    word-wrap: break-word;
    word-break: break-word;
}

.chatbot-window .flex.justify-start > div {
    animation: fadeInLeft 0.3s ease-out;
    word-wrap: break-word;
    word-break: break-word;
}

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

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Input Area */
#chatbot-input {
    transition: all 0.3s ease;
}

#chatbot-input:focus {
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    border-color: #4f46e5;
}

#chatbot-input::placeholder {
    color: #9ca3af;
}

/* Send Button */
#chatbot-send {
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(99, 102, 241, 0.2);
}

#chatbot-send:hover {
    box-shadow: 0 6px 12px rgba(99, 102, 241, 0.3);
    transform: translateY(-2px);
}

#chatbot-send:active {
    transform: translateY(0);
}

/* Responsive Design */
@media (max-width: 640px) {
    /* Chat window — compact size, leaves room for toggle button */
    .chatbot-window {
        position: fixed !important;
        left: 16px !important;
        right: 16px !important;
        bottom: 80px !important;
        width: auto !important;
        height: 65vh !important;
        max-height: 520px !important;
        max-width: none !important;
    }

    /* Messages area — adjust for smaller window */
    .chatbot-window #chatbot-messages {
        padding: 12px !important;
    }

    /* Input area — slightly more compact */
    .chatbot-window #chatbot-input-area {
        padding: 10px 12px !important;
    }

    .chatbot-window #chatbot-input {
        padding: 8px 12px !important;
        font-size: 14px !important;
    }

    /* Toggle button — 64px, bigger tap target on mobile */
    .chatbot-toggle-btn {
        width: 64px !important;
        height: 64px !important;
    }

    .chatbot-toggle-btn svg {
        width: 32px !important;
        height: 32px !important;
    }

    /* Close button — bigger touch target on mobile (min 44px) */
    #chatbot-close {
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }

    #chatbot-close svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    #chatbot-messages {
        background: linear-gradient(180deg, #1f2937 0%, #111827 100%);
    }

    #chatbot-input {
        background-color: #374151;
        color: #f3f4f6;
        border-color: #4b5563;
    }

    #chatbot-input::placeholder {
        color: #9ca3af;
    }

    .chatbot-window .flex.justify-start > div {
        background-color: #374151;
        color: #f3f4f6;
    }

    #chatbot-messages::-webkit-scrollbar-track {
        background: #374151;
    }

    #chatbot-messages::-webkit-scrollbar-thumb {
        background: #4b5563;
    }
}

/* Print styles */
@media print {
    #chatbot-widget {
        display: none !important;
    }
}

/* Accessibility */
#chatbot-send:focus,
#chatbot-input:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

.chatbot-toggle-btn:focus {
    outline: 2px solid #4f46e5;
    outline-offset: 2px;
}

/* Animation for form fields */
.form-field {
    animation: slideDown 0.3s ease-out;
}

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

/* Loading state */
.chatbot-loading {
    display: flex;
    gap: 4px;
}

.chatbot-loading span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #d1d5db;
    animation: bounce 1.4s infinite;
}

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

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

@keyframes bounce {
    0%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-8px);
    }
}

/* Typing indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #d1d5db;
    border-radius: 50%;
    animation: blink 1.4s infinite;
}

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

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

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

@keyframes blink {
    0%, 60%, 100% {
        opacity: 0.3;
    }
    30% {
        opacity: 1;
    }
}

/* Gradient backgrounds */
.gradient-bg-indigo-cyan {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
}

.gradient-text {
    background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
