/* Expert Consultation Widget Styles */

/* Main Widget Button (5th button) - Positioned on the right */
#expert-consultation-widget {
    position: fixed;
    bottom: 24px;
    right: 24px; /* Positioned on the right side */
    z-index: 99999999 !important; /* Higher z-index than Thinking Partner (9999999) */
    display: block !important;
    visibility: visible !important;
}

#expert-consultation-button {
    width: 60px;
    height: 60px;
    border-radius: 30px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35), 0 2px 10px rgba(37, 99, 235, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    overflow: visible;
    color: white;
    animation: expertConsultationGlow 2s ease-in-out infinite;
}

@keyframes expertConsultationGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.45), 0 2px 10px rgba(37, 99, 235, 0.35), 0 0 0 0 rgba(59, 130, 246, 0.6);
    }
    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.65), 0 2px 10px rgba(37, 99, 235, 0.5), 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

#expert-consultation-button:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 30px rgba(59, 130, 246, 0.55), 0 4px 15px rgba(37, 99, 235, 0.45);
    animation: none;
}

#expert-consultation-button.active {
    width: 72px;
    height: 72px;
    border-radius: 36px;
    transform: scale(1.2);
    box-shadow: 0 8px 35px rgba(59, 130, 246, 0.55), 0 4px 15px rgba(37, 99, 235, 0.45);
}

#expert-consultation-button svg {
    width: 32px;
    height: 32px;
    position: relative;
    z-index: 1;
    color: white;
    filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
    animation: expertConsultationHandGlow 2s ease-in-out infinite;
}

@keyframes expertConsultationHandGlow {
    0%, 100% {
        filter: drop-shadow(0 0 4px rgba(255, 255, 255, 0.8));
    }
    50% {
        filter: drop-shadow(0 0 8px rgba(255, 255, 255, 1)) drop-shadow(0 0 12px rgba(255, 255, 255, 0.6));
    }
}

/* Always show widget (handled by auth gating in JS) */
#expert-consultation-widget { 
    display: block !important; 
    visibility: visible !important;
}

/* Slide Box Animation - Replaces popup bubble */
.expert-consultation-slide-box {
    position: absolute;
    right: calc(100% + 15px); /* Position LEFT of button (button is on the right) */
    left: auto;
    top: 50%;
    transform: translateY(-50%) translateX(-20px); /* Start hidden to the left (inside button) */
    background: linear-gradient(135deg, #3B82F6 0%, #1E40AF 100%);
    border-radius: 16px;
    padding: 14px 18px;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.35), 0 2px 8px rgba(37, 99, 235, 0.25);
    min-width: 200px;
    max-width: 250px;
    width: max-content;
    opacity: 0;
    pointer-events: none;
    border: 2px solid rgba(255, 255, 255, 0.2);
    white-space: nowrap;
    z-index: 1000000;
    /* Ensure box stays within viewport */
    max-width: min(250px, calc(100vw - 100px));
}

.expert-consultation-slide-box.animate {
    animation: slideBoxAnimation 5s ease-in-out;
}

@keyframes slideBoxAnimation {
    0% {
        opacity: 0;
        transform: translateY(-50%) translateX(-20px); /* Start hidden to the left (inside button) */
    }
    10% {
        opacity: 1;
        transform: translateY(-50%) translateX(0); /* Slide out to the left (visible) */
    }
    20%, 80% {
        opacity: 1;
        transform: translateY(-50%) translateX(0); /* Stay visible */
        animation-timing-function: ease-in-out;
    }
    90% {
        opacity: 1;
        transform: translateY(-50%) translateX(10px); /* Start moving back to the right */
    }
    100% {
        opacity: 0;
        transform: translateY(-50%) translateX(20px); /* Hide back to the right (inside button) */
    }
}

/* Pulsing effect during display */
@keyframes slideBoxPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.3), 0 2px 8px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 6px 30px rgba(59, 130, 246, 0.5), 0 4px 15px rgba(59, 130, 246, 0.4);
    }
}

.expert-consultation-slide-box.animate {
    animation: slideBoxAnimation 5s ease-in-out, slideBoxPulse 2s ease-in-out 0.5s infinite;
}

.expert-consultation-slide-box-content {
    text-align: center;
}

.expert-consultation-slide-box-content p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.4;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.expert-consultation-slide-box-subtitle {
    font-size: 12px !important;
    font-weight: 400 !important;
    color: rgba(255, 255, 255, 0.9) !important;
    margin-top: 4px !important;
}

@media (max-width: 768px) {
    .expert-consultation-slide-box {
        left: auto;
        right: calc(100% + 15px);
        max-width: calc(100vw - 120px);
        min-width: 180px;
    }
    
    .expert-consultation-slide-box.animate {
        animation: slideBoxAnimationMobile 5s ease-in-out, slideBoxPulse 2s ease-in-out 0.5s infinite;
    }
    
    @keyframes slideBoxAnimationMobile {
        0% {
            opacity: 0;
            transform: translateY(-50%) translateX(20px);
        }
        10% {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
        20%, 80% {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
            animation-timing-function: ease-in-out;
        }
        90% {
            opacity: 1;
            transform: translateY(-50%) translateX(10px);
        }
        100% {
            opacity: 0;
            transform: translateY(-50%) translateX(20px);
        }
    }
}

/* Panel - Always fullscreen */
#expert-consultation-panel {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    background: #ffffff;
    border-radius: 0 !important;
    box-shadow: none;
    display: none;
    flex-direction: column;
    z-index: 2147483647 !important;
    overflow: hidden;
    transition: opacity 0.3s ease;
}

#expert-consultation-panel.open {
    display: flex;
}

/* Header */
#expert-consultation-header {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}

#expert-consultation-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

#expert-consultation-header-left img {
    height: 32px;
}

#expert-consultation-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: white;
}

#expert-consultation-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.expert-consultation-header-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.expert-consultation-header-btn:hover {
    background: rgba(255,255,255,0.25);
}

#expert-consultation-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

#expert-consultation-close:hover {
    background: rgba(255,255,255,0.25);
}

/* Progress Bar */
.expert-consultation-progress-bar {
    background: #ffffff;
    padding: 12px 20px;
    border-bottom: 1px solid #e8e8e8;
    flex-shrink: 0;
}

.expert-consultation-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #2d3436;
}

.expert-consultation-progress-track {
    height: 8px;
    background: #e1e4e8;
    border-radius: 4px;
    overflow: hidden;
}

.expert-consultation-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3B82F6 0%, #2563EB 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Messages */
#expert-consultation-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    background: #ffffff;
}

.expert-consultation-message {
    display: flex;
    max-width: 80%;
    animation: fadeIn 0.3s ease;
}

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

.expert-consultation-message-user {
    align-self: flex-end;
    margin-left: auto;
}

.expert-consultation-message-assistant {
    align-self: flex-start;
}

.expert-consultation-message-content {
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.expert-consultation-message-user .expert-consultation-message-content {
    background: #f5f5f5;
    color: #2d3436;
    border: 1px solid #e8e8e8;
}

.expert-consultation-message-assistant .expert-consultation-message-content {
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%) !important;
    color: #ffffff !important;
    border: none !important;
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.25) !important;
}

.expert-consultation-loading-dots {
    display: flex;
    gap: 4px;
}

.expert-consultation-loading-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #3B82F6;
    animation: loadingDot 1.4s ease-in-out infinite;
}

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

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

@keyframes loadingDot {
    0%, 60%, 100% {
        transform: scale(1);
        opacity: 0.5;
    }
    30% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Input Area */
#expert-consultation-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e8e8e8;
    flex-shrink: 0;
    background: #ffffff;
}

#expert-consultation-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

#expert-consultation-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    background: #fafafa;
    color: #2d3436;
}

#expert-consultation-input:focus {
    outline: none;
    border-color: #3B82F6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#expert-consultation-send {
    padding: 10px 20px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

#expert-consultation-send:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

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

/* Send Inquiry Button */
#expert-consultation-send-inquiry-container {
    padding: 20px;
    text-align: center;
}

.expert-consultation-send-inquiry-button {
    padding: 14px 32px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4), 0 2px 10px rgba(37, 99, 235, 0.3);
    transition: all 0.3s ease;
    animation: expertConsultationGlow 2s ease-in-out infinite;
}

.expert-consultation-send-inquiry-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(59, 130, 246, 0.6), 0 4px 15px rgba(37, 99, 235, 0.5);
    animation: none;
}

.expert-consultation-send-inquiry-button:active {
    transform: translateY(0);
}

/* Article Box (under article) */
#expert-consultation-article-box {
    width: 100%;
    margin: 48px 0 0 0;
    padding: 32px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(37, 99, 235, 0.05) 100%);
    border: 2px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    text-align: center;
    animation: expertConsultationBoxGlow 3s ease-in-out infinite;
    display: block !important;
    opacity: 1 !important;
}

@keyframes expertConsultationBoxGlow {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.2), 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 4px 20px rgba(59, 130, 246, 0.4), 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

.expert-consultation-article-content h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 700;
    color: #2d3436;
}

.expert-consultation-article-content p {
    margin: 0 0 24px 0;
    font-size: 16px;
    color: #636e72;
}

.expert-consultation-article-cta {
    padding: 14px 32px;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.expert-consultation-article-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

.expert-consultation-article-cta:active {
    transform: translateY(0);
}

/* Disclaimer - Hidden */
#expert-consultation-disclaimer {
    display: none !important;
}

/* Homepage CTA Box */
.expert-consultation-homepage-cta {
    padding: 80px 0;
    background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%);
    position: relative;
    overflow: hidden;
}

.expert-consultation-homepage-cta::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
}

.expert-consultation-homepage-cta-inner {
    position: relative;
    z-index: 1;
}

.expert-consultation-homepage-cta-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.expert-consultation-homepage-cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    margin: 0 auto 24px;
    color: white;
    animation: expertConsultationGlow 2s ease-in-out infinite;
}

.expert-consultation-homepage-cta-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: #ffffff;
    margin: 0 0 16px 0;
    line-height: 1.2;
}

.expert-consultation-homepage-cta-description {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.95);
    margin: 0 0 32px 0;
    line-height: 1.6;
}

.expert-consultation-homepage-cta-button {
    display: inline-block;
    padding: 18px 40px;
    font-size: 1.125rem;
    font-weight: 600;
    color: #3B82F6;
    background: #ffffff;
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.expert-consultation-homepage-cta-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
    background: #f8f8f8;
}

.expert-consultation-homepage-cta-button:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .expert-consultation-homepage-cta {
        padding: 60px 0;
    }
    
    .expert-consultation-homepage-cta-title {
        font-size: 1.875rem;
    }
    
    .expert-consultation-homepage-cta-description {
        font-size: 1.125rem;
    }
    
    .expert-consultation-homepage-cta-button {
        padding: 16px 32px;
        font-size: 1rem;
    }
}

/* Responsive */
@media (max-width: 768px) {
    #expert-consultation-widget {
        left: auto;
        right: 91px; /* Positioned LEFT of black button (56px button + 20px margin + 15px gap) */
        bottom: 20px; /* At bottom of screen */
    }
    
    /* Ensure button maintains exact size on mobile */
    #expert-consultation-button {
        width: 56px !important;
        height: 56px !important;
        min-width: 56px !important;
        min-height: 56px !important;
        max-width: 56px !important;
        max-height: 56px !important;
        border-radius: 28px !important;
    }
    
    #expert-consultation-button.active {
        width: 56px !important;
        height: 56px !important;
        border-radius: 28px !important;
    }

    #expert-consultation-panel {
        width: 100vw !important;
        height: 100vh !important;
    }

    #expert-consultation-article-box {
        padding: 24px;
        margin: 32px 0 0 0;
    }
    
    /* Slide box positioning on mobile is handled by CSS animation - no additional rules needed */
}

/* Very small screens */
@media (max-width: 480px) {
    #expert-consultation-widget {
        bottom: 15px;
        left: auto;
        right: 87px; /* Positioned LEFT of black button (52px button + 15px margin + 15px gap + 5px adjustment) */
    }
    
    /* Very small screens - Match black menu button size exactly */
    #expert-consultation-button {
        width: 52px !important;
        height: 52px !important;
        min-width: 52px !important;
        min-height: 52px !important;
        max-width: 52px !important;
        max-height: 52px !important;
        border-radius: 26px !important;
        padding: 0 !important;
        margin: 0 !important;
    }
    
    #expert-consultation-button.active {
        width: 52px !important;
        height: 52px !important;
        border-radius: 26px !important;
        transform: scale(1) !important;
    }
    
    #expert-consultation-button svg {
        width: 24px !important;
        height: 24px !important;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .expert-consultation-slide-box {
        background: #2d3436;
        color: white;
    }

    .expert-consultation-slide-box-content p {
        color: white;
    }

    #expert-consultation-panel {
        background: #1a1a1a;
    }

    .expert-consultation-message-assistant .expert-consultation-message-content {
        background: linear-gradient(135deg, #3B82F6 0%, #2563EB 50%, #1E40AF 100%) !important;
        color: #ffffff !important;
    }

    #expert-consultation-input {
        background: #2d3436;
        border-color: #404040;
        color: white;
    }

    #expert-consultation-input-area {
        background: #1a1a1a;
    }
}

