/**
 * KB Support Assistant - Stili CSS per Widget Supporto
 * Versione: 1.0
 * Data: 2025-01-27
 */

/* ========== WIDGET SUPPORTO ========== */

.kb-support-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 500px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow:
        0 20px 40px rgba(0, 0, 0, 0.15),
        0 10px 20px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    transform: translateY(20px) scale(0.95);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10001;
    overflow: hidden;
    pointer-events: none;
}

.kb-support-widget.visible {
    transform: translateY(0) scale(1);
    opacity: 1;
    pointer-events: auto;
}

@media (max-width: 520px) {
    .kb-support-widget {
        width: calc(100vw - 40px);
        max-width: 480px;
        bottom: 10px;
        right: 10px;
    }
}

/* Header */
.support-header {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px 16px 0 0;
}

.support-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    flex: 1;
}

.support-icon {
    font-size: 1.2rem;
    animation: gentle-bounce 2s ease-in-out infinite;
}

.support-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.support-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Content Area */
.support-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 400px;
    max-height: calc(80vh - 60px);
}

.support-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 20px;
}

/* Category Selection */
.support-welcome {
    text-align: center;
    margin-bottom: 24px;
}

.support-welcome h4 {
    color: #1f2937;
    margin-bottom: 8px;
    font-size: 1.25rem;
}

.support-categories {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    flex: 1;
}

.support-category-card {
    margin-right: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.support-category-card:hover {
    background: #f3f4f6;
    border-color: #10b981;
    transform: translateX(4px);
}

.category-icon {
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border-radius: 12px;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.category-info {
    flex: 1;
    text-align: left;
}

.category-info h5 {
    margin: 0 0 4px 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
}

.category-info p {
    margin: 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.category-arrow {
    color: #9ca3af;
    font-size: 1.25rem;
    flex-shrink: 0;
}

/* Chat Container */
.support-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scrollbar-width: thin;
    scrollbar-color: #e5e7eb transparent;
}

.support-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.support-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.support-chat-messages::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 3px;
}

.support-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

.support-chat-message {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 85%;
    animation: messageSlideIn 0.3s ease;
}

.support-chat-message.user {
    align-self: flex-end;
    align-items: flex-end;
}

.support-chat-message.assistant {
    align-self: flex-start;
    align-items: flex-start;
}

.message-content {
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.9375rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.support-chat-message.user .message-content {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border-bottom-right-radius: 4px;
}

.support-chat-message.assistant .message-content {
    background: #f3f4f6;
    color: #1f2937;
    border-bottom-left-radius: 4px;
}

/* Solo dentro il widget: evita conflitto con pagine chat (es. PersonalAssistant)
   che definiscono .message-actions { opacity:0 } visibile solo su .message:hover */
.kb-support-widget .message-actions {
    margin-top: 8px;
    opacity: 1;
}

.message-timestamp {
    font-size: 0.75rem;
    color: #9ca3af;
    padding: 0 4px;
}

.support-chat-message.typing .message-content {
    background: #f3f4f6;
    padding: 16px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.typing-dots span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typingDot 1.4s ease-in-out infinite;
}

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

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

/* Input Container */
.support-chat-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

#support-chat-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 0.9375rem;
    outline: none;
    transition: all 0.2s ease;
}

#support-chat-input:focus {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.support-mic-btn {
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    color: #6b7280;
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.support-mic-btn:hover {
    background: #e5e7eb;
    color: #10b981;
}

.support-mic-btn i {
    font-size: 1rem;
}

#support-send {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    border: none;
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

#support-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

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

/* Review Screen */
.support-review-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 0;
}

.review-section {
    margin-bottom: 24px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e5e7eb;
}

.review-section:last-child {
    border-bottom: none;
}

.review-section h5 {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.review-section p {
    color: #4b5563;
    margin: 4px 0;
    font-size: 0.9375rem;
}

.summary-box,
.message-box {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    color: #1f2937;
    font-size: 0.9375rem;
    line-height: 1.6;
    white-space: pre-wrap;
}

.support-review-actions {
    display: flex;
    gap: 12px;
    padding: 16px 0 0 0;
    border-top: 1px solid #e5e7eb;
    margin-top: auto;
}

.support-destination-options {
    display: grid;
    gap: 8px;
    margin-top: 8px;
}

.support-destination-option {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    color: #374151;
}

.support-destination-option input[type="checkbox"] {
    accent-color: #10b981;
}

.support-review-actions .btn {
    flex: 1;
    padding: 12px 20px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.kb-support-widget .btn {
    color: #111827;
}

.kb-support-widget .btn::before {
    content: none;
}

.kb-support-widget .btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
}

.kb-support-widget .btn-primary:hover,
.kb-support-widget .btn-primary:focus {
    background: linear-gradient(135deg, #0ea473 0%, #047857 100%);
    color: #ffffff;
}

.kb-support-widget .btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.kb-support-widget .btn-secondary:hover,
.kb-support-widget .btn-secondary:focus {
    background: #e5e7eb;
    color: #111827;
}

.support-review-actions .btn.btn-primary {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
}

.support-review-actions .btn.btn-primary:hover {
    background: linear-gradient(135deg, #0ea473 0%, #047857 100%);
    color: #ffffff;
}

.support-review-actions .btn.btn-secondary {
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #e5e7eb;
}

.support-review-actions .btn.btn-secondary:hover {
    background: #e5e7eb;
    color: #111827;
}

/* Success Message */
.success-message {
    text-align: center;
    padding: 40px 20px;
}

.success-icon {
    font-size: 4rem;
    color: #10b981;
    margin-bottom: 16px;
    animation: successScale 0.5s ease;
}

.success-message h4 {
    color: #1f2937;
    margin-bottom: 12px;
}

.success-message p {
    color: #6b7280;
    margin-bottom: 16px;
}

.success-details {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 8px;
    padding: 16px;
    margin: 20px 0;
    text-align: left;
}

.success-details code {
    background: #dcfce7;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
    color: #166534;
}

/* Loading Spinner */
.review-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.loading-spinner {
    font-size: 3rem;
    color: #10b981;
    margin-bottom: 16px;
}

.review-loading p {
    color: #6b7280;
    font-size: 1rem;
}

/* Error Message */
.error-message {
    margin-top: 16px;
}

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes typingDot {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-8px);
        opacity: 1;
    }
}

@keyframes gentle-bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-4px);
    }
}

@keyframes successScale {
    0% {
        transform: scale(0);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Utility Classes */
.d-none {
    display: none !important;
}

.text-muted {
    color: #6b7280;
}

.small {
    font-size: 0.875rem;
}

.mt-2 {
    margin-top: 0.5rem;
}

.mt-3 {
    margin-top: 1rem;
}

.me-2 {
    margin-right: 0.5rem;
}

