/**
 * Oncoematologia Search Widget - Complete v3.0
 * CSS per Chat UI personalizzata
 * WIDGET SECTION: Usa lo stile originale v2.0.1 che funzionava
 */

/* ============================================
   SEARCH WIDGET (stile originale v2.0.1)
   ============================================ */

.oncologia-widget-complete {
    max-width: 1040px;
    margin: 40px auto;
    padding: 0 20px;
}

.oncologia-search-bar {
    position: relative;
    display: block;
    max-width: 100%;
    margin: 0 auto 24px;
}

.oncologia-search-input {
    width: 100%;
    border: 1px solid #DDDDDD;
    border-radius: 50px;
    outline: none;
    font-size: 17px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    padding: 16px 60px 16px 24px;
    color: #333;
    background: #ffffff;
    font-style: italic;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.oncologia-search-input::placeholder {
    color: #999;
    font-style: italic;
}

.oncologia-search-input:focus {
    border-color: #4A7FC7;
    box-shadow: 0 2px 8px rgba(74, 127, 199, 0.15);
}

.oncologia-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    color: #666;
    padding: 0;
}

.oncologia-search-btn:hover {
    background: #F5F5F5;
}

.oncologia-search-btn:active {
    background: #EEEEEE;
}

.oncologia-search-btn svg {
    width: 24px;
    height: 24px;
    display: block;
    stroke: #666;
}

.oncologia-quick-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 16px;
}

.quick-label {
    font-size: 15px;
    color: #333;
    font-weight: 400;
    margin-right: 4px;
}

.quick-btn {
    background: #F0F0F0;
    border: none;
    padding: 10px 20px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    color: #4A5F8E;
    font-weight: 500;
    border-radius: 6px;
}

.quick-btn:hover {
    background: #E0E0E0;
    color: #3A4F7E;
}

.quick-btn:active {
    background: #D0D0D0;
    transform: scale(0.98);
}

/* ============================================
   CHAT MODAL
   ============================================ */

.oncologia-chat-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999999;
}

.oncologia-chat-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.chat-container {
    position: relative;
    width: 90%;
    max-width: 800px;
    height: 85vh;
    max-height: 700px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   CHAT HEADER
   ============================================ */

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: linear-gradient(135deg, #3D5A8F 0%, #2E4670 100%);
    color: white;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.chat-avatar {
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-avatar svg {
    width: 24px;
    height: 24px;
    stroke-width: 2.5;
}

.chat-title strong {
    display: block;
    font-size: 16px;
    margin-bottom: 4px;
}

.chat-title small {
    font-size: 13px;
    opacity: 0.8;
}

.chat-close-btn {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 8px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chat-close-btn svg {
    width: 20px;
    height: 20px;
}

.chat-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ============================================
   CHAT MESSAGES
   ============================================ */

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    background: #F9FAFB;
}

.chat-message {
    margin-bottom: 20px;
    animation: fadeIn 0.3s ease-out;
}

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

.message-bot {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message-bot-avatar {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #3D5A8F 0%, #2E4670 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.message-bot-avatar svg {
    width: 20px;
    height: 20px;
    stroke: white;
    stroke-width: 2.5;
}

.message-bot-content {
    flex: 1;
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.message-user {
    display: flex;
    justify-content: flex-end;
}

.message-user-content {
    background: #3D5A8F;
    color: white;
    padding: 14px 20px;
    border-radius: 12px;
    max-width: 70%;
}

/* Welcome Message */
.welcome-message {
    background: linear-gradient(135deg, #E8EDF5 0%, #F9FAFB 100%);
    padding: 24px;
    border-radius: 12px;
    margin-bottom: 24px;
}

.welcome-message h3 {
    margin: 0 0 12px 0;
    font-size: 18px;
    color: #1F2937;
}

.welcome-message p {
    margin: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #4B5563;
}

.welcome-message strong {
    color: #3D5A8F;
}

/* Quick Questions in Chat */
.quick-questions-chat {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
}

.quick-question-btn {
    background: white;
    border: 2px solid #E8EDF5;
    padding: 12px 16px;
    border-radius: 10px;
    text-align: left;
    font-size: 14px;
    color: #3D5A8F;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.quick-question-btn:hover {
    background: #3D5A8F;
    color: white;
    border-color: #3D5A8F;
    transform: translateX(4px);
}

/* Citations */
.message-citations {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #E8EDF5;
}

.citation-label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 600;
    margin-bottom: 8px;
    display: block;
}

.citation-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #3D5A8F;
    text-decoration: none;
    padding: 6px 12px;
    background: #F3F4F6;
    border-radius: 6px;
    margin-right: 8px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.citation-link svg {
    width: 14px;
    height: 14px;
}

.citation-link:hover {
    background: #3D5A8F;
    color: white;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.typing-indicator .message-bot-avatar {
    /* Same as message-bot-avatar */
}

.typing-dots {
    background: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 6px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #9CA3AF;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

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

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

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

/* ============================================
   CHAT INPUT AREA
   ============================================ */

.chat-input-area {
    display: flex;
    gap: 12px;
    padding: 20px 24px;
    background: white;
    border-top: 1px solid #E8EDF5;
}

.chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid #E8EDF5;
    border-radius: 12px;
    font-size: 15px;
    font-family: inherit;
    resize: none;
    max-height: 120px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    outline: none;
    border-color: #3D5A8F;
    box-shadow: 0 0 0 3px rgba(61, 90, 143, 0.1);
}

.chat-send-btn {
    width: 48px;
    height: 48px;
    background: #3D5A8F;
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.chat-send-btn svg {
    width: 20px;
    height: 20px;
}

.chat-send-btn:hover:not(:disabled) {
    background: #2E4670;
    transform: scale(1.05);
}

.chat-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .chat-container {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .oncologia-quick-buttons {
        justify-content: center;
    }
    
    .quick-label {
        width: 100%;
        text-align: center;
    }
    
    .message-user-content {
        max-width: 85%;
    }
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */

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

.chat-messages::-webkit-scrollbar-track {
    background: #F3F4F6;
}

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

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94A3B8;
}
