:root {
    --vsc-primary: #2563eb;
    --vsc-primary-dark: #1d4ed8;
    --vsc-primary-light: #3b82f6;
    --vsc-success: #10b981;
    --vsc-text-dark: #1f2937;
    --vsc-text-light: #6b7280;
    --vsc-border: #e5e7eb;
    --vsc-bg-light: #F5F5F5;
    --vsc-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --vsc-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --vsc-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --vsc-shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Container */
.vsc-chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.vsc-chat-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, var(--vsc-primary) 0%, var(--vsc-primary-dark) 100%);
    color: white;
    cursor: pointer;
    box-shadow: var(--vsc-shadow-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

    .vsc-chat-toggle.vsc-anim {
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .vsc-chat-toggle:hover {
        transform: scale(1.05);
        box-shadow: var(--vsc-shadow-xl);
    }

    .vsc-chat-toggle:active {
        transform: scale(0.95);
    }

    .vsc-chat-toggle::before {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.3);
        transform: translate(-50%, -50%);
        transition: width 0.6s, height 0.6s;
    }

    .vsc-chat-toggle:hover::before {
        width: 100%;
        height: 100%;
    }

.vsc-toggle-icon {
    position: absolute;
    transition: all 0.3s ease;
}

.vsc-toggle-icon-chat {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

.vsc-toggle-icon-close {
    opacity: 0;
    transform: rotate(-90deg) scale(0);
}

.vsc-chat-toggle.active .vsc-toggle-icon-chat {
    opacity: 0;
    transform: rotate(90deg) scale(0);
}

.vsc-chat-toggle.active .vsc-toggle-icon-close {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

/* Chat Panel */
.vsc-chat-panel {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 400px;
    width: min(420px, 92vw);
    height: 800px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 20px;
    box-shadow: var(--vsc-shadow-xl);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

    .vsc-chat-panel.vsc-anim {
        transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .vsc-chat-panel.open {
        opacity: 1;
        transform: translateY(0) scale(1);
        pointer-events: all;
    }

/* Header */
.vsc-chat-header {
    background: linear-gradient(135deg, var(--vsc-primary) 0%, var(--vsc-primary-dark) 100%);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
}

.vsc-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vsc-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.vsc-header-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.18);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease;
}

    .vsc-header-btn:hover {
        background: rgba(255, 255, 255, 0.28);
    }

    .vsc-header-btn:active {
        transform: scale(0.96);
    }

    .vsc-header-btn.is-active {
        background: rgba(255, 255, 255, 0.35);
    }

.vsc-header-icon {
    width: 21px;
    height: 21px;
    display: block;
    filter: brightness(0) invert(1);
}

.vsc-mic-overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 6;
}

    .vsc-mic-overlay.is-visible {
        opacity: 1;
        pointer-events: all;
    }

.vsc-mic-modal {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--vsc-shadow-xl);
    width: min(340px, 100%);
    display: flex;
    gap: 14px;
    align-items: flex-start;
    position: relative;
}

.vsc-mic-icon-wrap {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

    .vsc-mic-icon-wrap img {
        filter: brightness(0) invert(1);
    }

.vsc-mic-overlay .vsc-mic-icon-wrap img {
    filter: brightness(0.4) saturate(0);
}

.vsc-mic-modal-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.vsc-mic-title {
    font-weight: 600;
    color: var(--vsc-text-dark);
    font-size: 15px;
}

.vsc-mic-text {
    font-size: 13px;
    color: var(--vsc-text-light);
    line-height: 1.4;
}

.vsc-mic-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.vsc-mic-btn {
    border-radius: 10px;
    padding: 8px 14px;
    font-size: 13px;
    border: 1px solid var(--vsc-border);
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: var(--vsc-text-dark);
}

    .vsc-mic-btn:hover {
        border-color: var(--vsc-primary);
        color: var(--vsc-primary);
    }

.vsc-mic-btn-allow {
    background: var(--vsc-primary);
    border-color: var(--vsc-primary);
    color: white;
}

    .vsc-mic-btn-allow:hover {
        background: var(--vsc-primary-dark);
        border-color: var(--vsc-primary-dark);
        color: white;
    }

.vsc-new-modal {
    padding-top: 22px;
}

.vsc-new-close {
    position: absolute;
    top: 12px;
    right: 12px;
    border: none;
    background: transparent;
    color: var(--vsc-text-light);
    cursor: pointer;
}

    .vsc-new-close:hover {
        color: var(--vsc-text-dark);
    }

.vsc-chat-dropdown {
    min-width: 140px;
    border-radius: 12px;
    border: 1px solid var(--vsc-border);
    box-shadow: var(--vsc-shadow-lg);
    padding: 6px 0;
    right: 0;
    left: auto;
}

    .vsc-chat-dropdown .dropdown-item {
        font-size: 14px;
        padding: 8px 14px;
    }

.vsc-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.vsc-chat-header-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.vsc-chat-title {
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
}

.vsc-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.vsc-status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vsc-success);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Messages Area */
.vsc-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

    .vsc-chat-messages::-webkit-scrollbar {
        width: 6px;
    }

    .vsc-chat-messages::-webkit-scrollbar-track {
        background: transparent;
    }

    .vsc-chat-messages::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }

        .vsc-chat-messages::-webkit-scrollbar-thumb:hover {
            background: #94a3b8;
        }

/* Welcome Hero */
.vsc-welcome-hero {
    position: relative;
    flex: 0 0 auto;
    padding: 22px;
    border-radius: 14px;
    color: white;
    overflow: hidden;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9) 0%, rgba(29, 78, 216, 0.95) 100%), url('/img/promocije.jpg');
    background-size: cover;
    background-position: center;
    box-shadow: var(--vsc-shadow-sm);
    animation: slideIn 0.4s ease-out;
}

.vsc-welcome-hero-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vsc-welcome-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

    .vsc-welcome-title img {
        width: 20px;
        height: 20px;
        display: block;
    }

.vsc-beta {
    margin-left: auto;
    font-weight: 700;
}

.vsc-welcome-subtitle {
    font-size: 14px;
    line-height: 1.5;
    opacity: 0.95;
}

.vsc-quick-questions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.vsc-quick-btn {
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    padding: 6px 12px;
    font-size: 12px;
    background: rgba(255, 255, 255, 0.14);
    color: white;
    cursor: pointer;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

    .vsc-quick-btn:hover {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.7);
    }

    .vsc-quick-btn:active {
        transform: scale(0.98);
    }

/* Message Row */
.vsc-message-row {
    display: flex;
    gap: 8px;
    animation: slideIn 0.3s ease-out;
}

    .vsc-message-row.user {
        justify-content: flex-end;
    }

    .vsc-message-row.bot {
        justify-content: flex-start;
    }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Message Bubble */
.vsc-message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    white-space: pre-wrap;
}

.vsc-message-row.user .vsc-message-bubble {
    background: linear-gradient(135deg, var(--vsc-primary) 0%, var(--vsc-primary-dark) 100%);
    color: white;
    border-bottom-right-radius: 4px;
    box-shadow: var(--vsc-shadow-sm);
}

.vsc-message-row.bot .vsc-message-bubble {
    background: var(--vsc-bg-light);
    color: var(--vsc-text-dark);
    border-bottom-left-radius: 4px;
}

/* HTML formatting inside messages */
.vsc-message-bubble strong,
.vsc-message-bubble b {
    font-weight: 600;
    display: inline-block;
}

.vsc-message-bubble p strong,
.vsc-message-bubble p b {
    display: inline;
}

.vsc-message-bubble em,
.vsc-message-bubble i {
    font-style: italic;
}

.vsc-message-bubble a {
    color: inherit;
    text-decoration: underline;
    transition: opacity 0.2s ease;
}

    .vsc-message-bubble a:hover {
        opacity: 0.8;
    }

.vsc-message-row.user .vsc-message-bubble a {
    color: white;
}

.vsc-message-row.bot .vsc-message-bubble a {
    color: var(--vsc-primary);
    font-weight: 500;
}

.vsc-message-bubble ul,
.vsc-message-bubble ol {
    margin: 6px 0 !important;
    padding: 0 0 0 20px !important;
    list-style-position: outside !important;
}

.vsc-message-bubble p + ul,
.vsc-message-bubble p + ol {
    margin-top: 6px !important;
}

.vsc-message-bubble ul li,
.vsc-message-bubble ol li {
    margin: 0 0 3px 0 !important;
    padding: 0 !important;
    line-height: 1.4 !important;
    box-sizing: border-box !important;
    display: list-item !important;
}

    .vsc-message-bubble ul li:last-child,
    .vsc-message-bubble ol li:last-child {
        margin-bottom: 0 !important;
    }

    /* Ukloni bilo kakve dodatne elemente koji bi mogli stvarati razmak */
    .vsc-message-bubble ul li *,
    .vsc-message-bubble ol li * {
        margin: 0 !important;
        padding: 0 !important;
    }

    .vsc-message-bubble ul li p,
    .vsc-message-bubble ol li p {
        display: inline !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .vsc-message-bubble ul li br,
    .vsc-message-bubble ol li br {
        display: none !important;
    }

.vsc-message-bubble p {
    margin: 6px 0 !important;
}

    .vsc-message-bubble p:last-child {
        margin-bottom: 0 !important;
    }

    .vsc-message-bubble p:first-child {
        margin-top: 0 !important;
    }

.vsc-message-bubble code {
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.vsc-message-row.user .vsc-message-bubble code {
    background: rgba(255, 255, 255, 0.2);
}

.vsc-message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.vsc-message-row.user .vsc-message-bubble pre {
    background: rgba(255, 255, 255, 0.15);
}

.vsc-message-bubble pre code {
    background: none;
    padding: 0;
}

.vsc-message-bubble .vsc-cart-item {
    margin-bottom: 12px;
}

.vsc-message-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.vsc-action-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #FFF;
    border-radius: 8px;
    background: white;
    color: var(--vsc-text-light);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .vsc-action-btn img {
        opacity: 0.65;
        transition: opacity 0.2s ease;
    }

    .vsc-action-btn:hover {
        color: var(--vsc-primary);
        border-color: var(--vsc-border);
    }

        .vsc-action-btn:hover img {
            opacity: 0.9;
        }

    .vsc-action-btn.is-pressed {
        border-color: rgba(37, 99, 235, 0.35);
        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
        animation: vscActionPop 0.28s ease;
    }

    .vsc-action-btn.is-success {
        background: rgba(16, 185, 129, 0.12);
        border-color: rgba(16, 185, 129, 0.35);
    }

        .vsc-action-btn.is-success img {
            opacity: 0.95;
        }

    .vsc-action-btn.is-selected {
        background: rgba(59, 130, 246, 0.12);
        border-color: rgba(59, 130, 246, 0.4);
    }

        .vsc-action-btn.is-selected img {
            opacity: 0.95;
        }

        .vsc-action-btn.is-selected[data-action="up"] {
            background: rgba(37, 99, 235, 0.12);
            border-color: rgba(37, 99, 235, 0.45);
        }

        .vsc-action-btn.is-selected[data-action="down"] {
            background: rgba(29, 78, 216, 0.12);
            border-color: rgba(29, 78, 216, 0.45);
        }

@keyframes vscActionPop {
    0% {
        transform: scale(1);
    }

    60% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

/* Typing Indicator */
.vsc-typing-indicator {
    display: flex;
    gap: 8px;
    padding: 16px;
    background: var(--vsc-bg-light);
    border-radius: 16px;
    border-bottom-left-radius: 4px;
    width: fit-content;
    animation: slideIn 0.3s ease-out;
}

.vsc-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.vsc-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--vsc-text-light);
    animation: typingBounce 1.4s ease-in-out infinite;
}

    .vsc-typing-dot:nth-child(1) {
        animation-delay: 0s;
    }

    .vsc-typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }

    .vsc-typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }

@keyframes typingBounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }

    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Footer */
.vsc-chat-footer {
    padding: 16px 20px 20px;
    background: white;
    border-top: 1px solid var(--vsc-border);
    flex-shrink: 0;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
}

.vsc-chat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.vsc-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.vsc-chat-input {
    flex: 1;
    border: 1px solid var(--vsc-border);
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    overflow: hidden;
    transition: all 0.2s ease;
    outline: none;
}

    .vsc-chat-input:focus {
        border-color: var(--vsc-primary);
        box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    }

    .vsc-chat-input:disabled {
        background: var(--vsc-bg-light);
        cursor: not-allowed;
    }

.vsc-send-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--vsc-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
    position: relative;
}

    .vsc-send-button:hover:not(:disabled) {
        background: var(--vsc-primary-dark);
        transform: translateY(-1px);
        box-shadow: var(--vsc-shadow);
    }

    .vsc-send-button:active:not(:disabled) {
        transform: translateY(0);
    }

    .vsc-send-button:disabled {
        background: var(--vsc-border);
        cursor: not-allowed;
    }

.vsc-mic-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 12px;
    background: var(--vsc-primary);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

    .vsc-mic-button:hover:not(:disabled) {
        background: var(--vsc-primary-dark);
        transform: translateY(-1px);
        box-shadow: var(--vsc-shadow);
    }

    .vsc-mic-button:active:not(:disabled) {
        transform: translateY(0);
    }

    .vsc-mic-button:disabled {
        background: var(--vsc-border);
        cursor: not-allowed;
    }

    .vsc-mic-button.is-active {
        background: #ef4444 !important;
        box-shadow: var(--vsc-shadow);
    }

.vsc-mic-icon {
    display: block;
    filter: brightness(0) invert(1);
}

.vsc-send-icon {
    transition: opacity 0.2s ease;
}

.vsc-send-button.loading .vsc-send-icon {
    opacity: 0;
}

.vsc-spinner {
    position: absolute;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.vsc-send-button.loading .vsc-spinner {
    opacity: 1;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.vsc-input-hint {
    font-size: 12px;
    color: var(--vsc-text-light);
    padding: 0 4px;
}

    .vsc-input-hint span {
        font-weight: 500;
        color: var(--vsc-text-dark);
    }

/* Responsive */
@media (max-width: 480px) {
    .vsc-chat-container {
        bottom: 16px;
        right: 16px;
    }

    .vsc-chat-toggle {
        width: 56px;
        height: 56px;
    }

    .vsc-chat-panel {
        top: 0;
        right: 0;
        bottom: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        max-height: none;
        border-radius: 0;
    }

    .vsc-message-bubble {
        max-width: 85%;
    }

    .vsc-chat-header {
        border-top-left-radius: 0;
        border-top-right-radius: 0;
    }

    #vscChatResize {
        display: none;
    }

    .vsc-input-hint {
        display: none;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .vsc-chat-toggle,
    .vsc-chat-panel,
    .vsc-message-row,
    .vsc-welcome-message,
    .vsc-typing-indicator {
        animation: none;
        transition: none;
    }

    .vsc-action-btn {
        transition: none;
        animation: none;
    }
}

.vsc-product-item {
    margin-bottom: 25px;
}

    .vsc-product-item img {
        max-width: 100%;
        height: auto;
        display: block;
    }

/* Alarm */
.vsc-alarm-item {
    margin-bottom: 15px;
}
