/* ================================================
   AI Guided Chatbot - Frontend Styles
   Design moderno con bottoni e flow guidato
   ================================================ */

:root {
    --guided-chatbot-primary: #6366f1;
    --guided-chatbot-secondary: #8b5cf6;
    --guided-chatbot-background: #ffffff;
    --guided-chatbot-text: #1f2937;
}

/* Container */
.guided-chatbot-container {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Trigger Button */
.guided-chatbot-trigger {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--guided-chatbot-trigger, var(--guided-chatbot-primary)) 0%, var(--guided-chatbot-secondary) 100%);
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.guided-chatbot-trigger:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.6);
}

.guided-chatbot-trigger svg {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.guided-chatbot-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 11px;
    font-weight: bold;
    padding: 3px 7px;
    border-radius: 12px;
    box-shadow: 0 2px 4px rgba(239, 68, 68, 0.4);
    animation: bounce 0.5s ease;
}

/* Chat Window */
.guided-chatbot-window {
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 100px);
    background: var(--guided-chatbot-background);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideIn 0.3s ease;
}

/* Header */
.guided-chatbot-header {
    background: linear-gradient(135deg, var(--guided-chatbot-primary) 0%, var(--guided-chatbot-secondary) 100%);
    color: white;
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.guided-chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.guided-chatbot-header-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.guided-chatbot-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.guided-chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 6px;
}

.status-dot {
    width: 8px;
    height: 8px;
    background: #10b981;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.guided-chatbot-header-actions {
    display: flex;
    gap: 8px;
}

.guided-chatbot-header-btn {
    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: all 0.2s;
}

.guided-chatbot-header-btn svg {
    fill: white;
    stroke: white;
}

.guided-chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* Icon buttons - override global button styles */
.guided-chatbot-icon-btn {
    background: rgba(255, 255, 255, 0.2) !important;
    border: none !important;
    color: white !important;
    width: 32px !important;
    height: 32px !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    padding: 0 !important;
}

.guided-chatbot-icon-btn svg {
    fill: white;
    stroke: white;
}

.guided-chatbot-icon-btn:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    transform: scale(1.1);
}

/* Body */
.guided-chatbot-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(180deg, #f9fafb 0%, #ffffff 100%);
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.guided-chatbot-body::-webkit-scrollbar {
    width: 6px;
}

.guided-chatbot-body::-webkit-scrollbar-thumb {
    background: var(--guided-chatbot-primary);
    border-radius: 10px;
}

/* Messages */
.guided-chatbot-messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.guided-chatbot-message {
    display: flex;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.guided-chatbot-message.bot {
    align-items: flex-start;
}

.guided-chatbot-message.user {
    justify-content: flex-end;
}

.guided-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
}

.guided-message-bubble {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    line-height: 1.5;
    font-size: 14px;
}

.guided-chatbot-message.bot .guided-message-bubble {
    background: white;
    color: var(--guided-chatbot-text);
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.guided-chatbot-message.user .guided-message-bubble {
    background: linear-gradient(135deg, var(--guided-chatbot-primary) 0%, var(--guided-chatbot-secondary) 100%);
    color: white;
}

/* Typing Indicator */
.guided-chatbot-typing {
    display: flex;
    align-items: center;
    gap: 8px;
    animation: fadeIn 0.3s ease;
}

.guided-typing-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.guided-typing-bubble {
    background: white;
    padding: 12px 16px;
    border-radius: 16px;
    display: flex;
    gap: 4px;
    border: 1px solid #e5e7eb;
}

.guided-typing-bubble span {
    width: 8px;
    height: 8px;
    background: var(--guided-chatbot-primary);
    border-radius: 50%;
    animation: typingDot 1.4s infinite;
}

.guided-typing-bubble span:nth-child(2) {
    animation-delay: 0.2s;
}

.guided-typing-bubble span:nth-child(3) {
    animation-delay: 0.4s;
}

/* Form Card */
.guided-chatbot-form-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.guided-chatbot-form-card h4 {
    margin: 0 0 16px;
    color: var(--guided-chatbot-text);
    font-size: 16px;
}

.guided-form-group {
    margin-bottom: 16px;
}

.guided-form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--guided-chatbot-text);
    font-size: 13px;
    font-weight: 500;
}

.guided-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.guided-form-group input:focus {
    outline: none;
    border-color: var(--guided-chatbot-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Category Buttons Grid */
.guided-categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

.guided-category-btn {
    background: white !important;
    border: 2px solid transparent !important;
    border-radius: 12px !important;
    padding: 16px !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-align: left !important;
    color: inherit !important;
}

.guided-category-btn:hover {
    border-color: inherit !important;
    transform: translateY(-2px) !important;
    box-shadow: 0 4px 12px rgba(99, 130, 246, 0.2) !important;
    background: white !important;
}

.guided-category-icon {
    font-size: 32px;
    line-height: 1;
}

.guided-category-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--guided-chatbot-text);
}

/* Action Buttons */
.guided-actions-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    animation: fadeIn 0.3s ease;
}

/* Buttons */
.guided-btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    border: none;
    width: 100%;
    text-align: center;
}

.guided-btn-primary {
    background: linear-gradient(135deg, var(--guided-chatbot-primary) 0%, var(--guided-chatbot-secondary) 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.guided-btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.guided-btn-secondary {
    background: white;
    color: var(--guided-chatbot-primary);
    border: 2px solid var(--guided-chatbot-primary);
}

.guided-btn-secondary:hover {
    background: var(--guided-chatbot-primary);
    color: white;
}

.guided-btn-link {
    background: transparent;
    color: #6b7280;
    padding: 8px;
}

.guided-btn-link:hover {
    color: var(--guided-chatbot-text);
}

/* Phone Display */
.guided-phone-display {
    background: white;
    padding: 32px;
    border-radius: 12px;
    text-align: center;
    border: 1px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: fadeIn 0.3s ease;
}

.phone-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.guided-phone-display p {
    margin: 0 0 12px;
    color: #6b7280;
    font-size: 14px;
}

.phone-number {
    display: block;
    font-size: 28px;
    font-weight: bold;
    color: var(--guided-chatbot-primary);
    text-decoration: none;
    margin-bottom: 20px;
}

.phone-number:hover {
    color: var(--guided-chatbot-secondary);
}

/* LatePoint Container */
#guided-latepoint-container {
    animation: fadeIn 0.3s ease;
}

/* Footer */
.guided-chatbot-footer {
    padding: 12px 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
    text-align: center;
}

.guided-chatbot-footer small {
    color: #9ca3af;
    font-size: 12px;
}

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

@keyframes bounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes typingDot {

    0%,
    60%,
    100% {
        transform: translateY(0);
    }

    30% {
        transform: translateY(-8px);
    }
}

/* Responsive */
@media (max-width: 480px) {
    .guided-chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 80px);
        border-radius: 12px;
    }

    .guided-chatbot-container {
        right: 10px;
        bottom: 10px;
    }
}