/* Novera Smart Chat Frontend Styles */

#novera-smart-chat-button {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Position classes */
.novera-smart-chat-bottom-right {
    bottom: 20px;
    right: 20px;
}

.novera-smart-chat-bottom-left {
    bottom: 20px;
    left: 20px;
}

.novera-smart-chat-top-right {
    top: 20px;
    right: 20px;
}

.novera-smart-chat-top-left {
    top: 20px;
    left: 20px;
}

/* Main button */
.novera-smart-chat-button {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--novera-smart-chat-color, #25D366);
    color: white;
    text-decoration: none;
    border-radius: 25px;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    cursor: pointer;
    border: none;
    outline: none;
    max-width: 250px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.novera-smart-chat-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    text-decoration: none;
    color: white;
}

.novera-smart-chat-button:active {
    transform: translateY(0);
}

.novera-smart-chat-button:focus {
    outline: 2px solid rgba(37, 211, 102, 0.5);
    outline-offset: 2px;
}

/* Icon */
.novera-smart-chat-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Text */
.novera-smart-chat-text {
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.2;
    color: white;
}

/* Size variants */
.novera-smart-chat-small .novera-smart-chat-button {
    padding: 8px 15px;
    font-size: 12px;
    border-radius: 20px;
}

.novera-smart-chat-small .novera-smart-chat-icon {
    width: 16px;
    height: 16px;
}

.novera-smart-chat-medium .novera-smart-chat-button {
    padding: 12px 20px;
    font-size: 14px;
    border-radius: 25px;
}

.novera-smart-chat-medium .novera-smart-chat-icon {
    width: 20px;
    height: 20px;
}

.novera-smart-chat-large .novera-smart-chat-button {
    padding: 16px 25px;
    font-size: 16px;
    border-radius: 30px;
}

.novera-smart-chat-large .novera-smart-chat-icon {
    width: 24px;
    height: 24px;
}

/* Tooltip */
.novera-smart-chat-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 1000000;
    max-width: 200px;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.3;
}

/* Tooltip positions */
.novera-smart-chat-bottom-right .novera-smart-chat-tooltip,
.novera-smart-chat-bottom-left .novera-smart-chat-tooltip {
    bottom: 100%;
    margin-bottom: 10px;
}

.novera-smart-chat-top-right .novera-smart-chat-tooltip,
.novera-smart-chat-top-left .novera-smart-chat-tooltip {
    top: 100%;
    margin-top: 10px;
}

.novera-smart-chat-bottom-right .novera-smart-chat-tooltip,
.novera-smart-chat-top-right .novera-smart-chat-tooltip {
    right: 0;
}

.novera-smart-chat-bottom-left .novera-smart-chat-tooltip,
.novera-smart-chat-top-left .novera-smart-chat-tooltip {
    left: 0;
}

/* Tooltip arrow */
.novera-smart-chat-tooltip::after {
    content: '';
    position: absolute;
    border: 5px solid transparent;
}

.novera-smart-chat-bottom-right .novera-smart-chat-tooltip::after,
.novera-smart-chat-bottom-left .novera-smart-chat-tooltip::after {
    top: 100%;
    border-top-color: rgba(0, 0, 0, 0.8);
}

.novera-smart-chat-top-right .novera-smart-chat-tooltip::after,
.novera-smart-chat-top-left .novera-smart-chat-tooltip::after {
    bottom: 100%;
    border-bottom-color: rgba(0, 0, 0, 0.8);
}

.novera-smart-chat-bottom-right .novera-smart-chat-tooltip::after,
.novera-smart-chat-top-right .novera-smart-chat-tooltip::after {
    right: 20px;
}

.novera-smart-chat-bottom-left .novera-smart-chat-tooltip::after,
.novera-smart-chat-top-left .novera-smart-chat-tooltip::after {
    left: 20px;
}

/* Show tooltip */
#novera-smart-chat-button:hover .novera-smart-chat-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* Pulse animation */
@keyframes novera-smart-chat-pulse {
    0% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
    50% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4), 0 0 0 8px rgba(37, 211, 102, 0.2);
    }
    100% {
        box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    }
}

.novera-smart-chat-button.novera-smart-chat-pulse {
    animation: novera-smart-chat-pulse 2s infinite;
}

/* Entry animation */
@keyframes novera-smart-chat-slideIn {
    from {
        opacity: 0;
        transform: translateY(100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#novera-smart-chat-button.novera-smart-chat-loaded {
    animation: novera-smart-chat-slideIn 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Button states */
.novera-smart-chat-page-hidden {
    visibility: hidden;
}

.novera-smart-chat-test-mode {
    border: 2px dashed #ff6b6b;
}

.novera-smart-chat-test-mode::after {
    content: 'TEST';
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ff6b6b;
    color: white;
    font-size: 8px;
    padding: 2px 4px;
    border-radius: 2px;
    font-weight: bold;
}

/* Mobile responsiveness - Clean CSS-only approach */
@media (max-width: 768px) {
    .novera-smart-chat-bottom-right {
        bottom: 15px;
        right: 15px;
    }
    
    .novera-smart-chat-bottom-left {
        bottom: 15px;
        left: 15px;
    }
    
    .novera-smart-chat-top-right {
        top: 15px;
        right: 15px;
    }
    
    .novera-smart-chat-top-left {
        top: 15px;
        left: 15px;
    }
    
    .novera-smart-chat-button {
        padding: 10px 16px;
        font-size: 13px;
        max-width: calc(100vw - 30px);
    }
}

/* Very small screens */
@media (max-width: 480px) {
    .novera-smart-chat-text {
        display: none;
    }
    
    .novera-smart-chat-button {
        padding: 12px;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        justify-content: center;
    }
    
    .novera-smart-chat-small .novera-smart-chat-button {
        width: 40px;
        height: 40px;
        padding: 10px;
    }
    
    .novera-smart-chat-large .novera-smart-chat-button {
        width: 60px;
        height: 60px;
        padding: 15px;
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .novera-smart-chat-button {
        border: 2px solid white;
    }
    
    .novera-smart-chat-tooltip {
        border: 1px solid white;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .novera-smart-chat-button,
    .novera-smart-chat-tooltip,
    #novera-smart-chat-button {
        transition: none;
        animation: none;
    }
    
    .novera-smart-chat-button.novera-smart-chat-pulse {
        animation: none;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .novera-smart-chat-tooltip {
        background: rgba(255, 255, 255, 0.9);
        color: #000;
    }
    
    .novera-smart-chat-tooltip::after {
        border-top-color: rgba(255, 255, 255, 0.9);
        border-bottom-color: rgba(255, 255, 255, 0.9);
    }
}

/* RTL support */
[dir="rtl"] .novera-smart-chat-button {
    flex-direction: row-reverse;
}

[dir="rtl"] .novera-smart-chat-bottom-right {
    left: 20px;
    right: auto;
}

[dir="rtl"] .novera-smart-chat-bottom-left {
    right: 20px;
    left: auto;
}

[dir="rtl"] .novera-smart-chat-top-right {
    left: 20px;
    right: auto;
}

[dir="rtl"] .novera-smart-chat-top-left {
    right: 20px;
    left: auto;
}

/* Print hiding */
@media print {
    #novera-smart-chat-button {
        display: none !important;
    }
}

/* Focus-visible support */
.novera-smart-chat-button:focus-visible {
    outline: 2px solid rgba(37, 211, 102, 0.8);
    outline-offset: 2px;
}

.novera-smart-chat-button:focus:not(:focus-visible) {
    outline: none;
}

/* Loading state */
.novera-smart-chat-button.novera-smart-chat-loading {
    pointer-events: none;
    opacity: 0.7;
}

.novera-smart-chat-button.novera-smart-chat-loading .novera-smart-chat-icon {
    animation: novera-smart-chat-spin 1s linear infinite;
}

@keyframes novera-smart-chat-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Hover effects with additional styles */
.novera-smart-chat-button::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%);
    transform: translateX(-100%);
    transition: transform 0.6s;
    border-radius: inherit;
}

.novera-smart-chat-button:hover::before {
    transform: translateX(100%);
}

.novera-smart-chat-button.novera-smart-chat-hovered {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
}

/* Keyboard focus styling */
.novera-smart-chat-button.novera-smart-chat-keyboard-focus {
    outline: 2px solid rgba(37, 211, 102, 0.8);
    outline-offset: 2px;
}

/* Night mode for special theming */
.novera-smart-chat-night-mode .novera-smart-chat-button {
    background: #128C7E;
}

.novera-smart-chat-night-mode .novera-smart-chat-button:hover {
    box-shadow: 0 6px 20px rgba(18, 140, 126, 0.5);
}

/* Enhanced accessibility */
@media (prefers-reduced-motion: no-preference) {
    .novera-smart-chat-button:hover {
        animation: none;
    }
}

/* Custom properties for easy theming */
#novera-smart-chat-button {
    --novera-smart-chat-primary: #25D366;
    --novera-smart-chat-shadow: rgba(37, 211, 102, 0.4);
    --novera-smart-chat-shadow-hover: rgba(37, 211, 102, 0.5);
}

.novera-smart-chat-button {
    background: var(--novera-smart-chat-color, var(--novera-smart-chat-primary));
    box-shadow: 0 4px 12px var(--novera-smart-chat-shadow);
}

.novera-smart-chat-button:hover {
    box-shadow: 0 6px 20px var(--novera-smart-chat-shadow-hover);
}