/* ========================================
   AI AGENT WIDGET STYLES
   ======================================== */

/* AI Agent Widget Styles */
.ai-agent-widget {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10002;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.7) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    backdrop-filter: blur(12px) !important;
    z-index: 10000 !important;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    outline: none !important;
    box-sizing: border-box !important;
}

.ai-overlay.active {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}

.ai-toggle-btn {
    height: 50px;
    min-width: 200px;
    background: linear-gradient(135deg, rgba(91, 43, 130, 0.9), rgba(124, 58, 237, 0.9));
    border-radius: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 
        0 8px 32px rgba(91, 43, 130, 0.4),
        0 0 0 1px rgba(255, 255, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transition: all 0.3s ease;
    position: relative;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0 20px;
    gap: 12px;
    animation: aiBreathe 3s ease-in-out infinite, aiAttention 8s ease-in-out infinite;
    overflow: hidden;
    z-index: 10003;
}

.ai-toggle-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.ai-toggle-btn:hover::before {
    left: 100%;
}

.ai-toggle-btn:hover {
    transform: scale(1.05);
    box-shadow: 
        0 12px 40px rgba(91, 43, 130, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.5);
    background: linear-gradient(135deg, rgba(91, 43, 130, 1), rgba(124, 58, 237, 1));
    animation: none;
}

.ai-logo {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    flex-shrink: 0;
    background: linear-gradient(135deg, #5b2b82, #7c3aed);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(91, 43, 130, 0.3);
}

.ai-logo i {
    color: white;
    font-size: 18px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.ai-text {
    z-index: 2;
    flex-shrink: 0;
    position: relative;
    isolation: isolate;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
}

.ai-label {
    color: white;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 3;
}

.ai-label sup {
    font-size: 10px;
    font-weight: 900;
    vertical-align: super;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ai-pulse {
    position: absolute;
    top: -3px;
    left: -3px;
    right: -3px;
    bottom: -3px;
    border-radius: 25px;
    background: linear-gradient(135deg, #5b2b82, #7c3aed);
    opacity: 0.3;
    animation: aiPulse 2s infinite;
}

@keyframes aiBreathe {
    0%, 100% { 
        transform: scale(1); 
        box-shadow: 
            0 8px 32px rgba(91, 43, 130, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    25% { 
        transform: scale(1.01); 
        box-shadow: 
            0 10px 35px rgba(91, 43, 130, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }
    50% { 
        transform: scale(1.02); 
        box-shadow: 
            0 12px 40px rgba(91, 43, 130, 0.4),
            0 0 0 1px rgba(255, 255, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
    75% { 
        transform: scale(1.01); 
        box-shadow: 
            0 10px 35px rgba(91, 43, 130, 0.35),
            0 0 0 1px rgba(255, 255, 255, 0.25),
            inset 0 1px 0 rgba(255, 255, 255, 0.35);
    }
}

@keyframes aiPulse {
    0% { transform: scale(1); opacity: 0.2; }
    50% { transform: scale(1.05); opacity: 0.1; }
    100% { transform: scale(1); opacity: 0.2; }
}

@keyframes aiAttention {
    0%, 85%, 100% { 
        transform: scale(1); 
        box-shadow: 
            0 8px 32px rgba(91, 43, 130, 0.3),
            0 0 0 1px rgba(255, 255, 255, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.3);
    }
    90% { 
        transform: scale(1.05); 
        box-shadow: 
            0 16px 50px rgba(91, 43, 130, 0.5),
            0 0 0 1px rgba(255, 255, 255, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.5);
    }
    95% { 
        transform: scale(1.03); 
        box-shadow: 
            0 12px 40px rgba(91, 43, 130, 0.4),
            0 0 0 1px rgba(255, 255, 255, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.4);
    }
}

.ai-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    animation: aiBadgePulse 1s infinite;
}

@keyframes aiBadgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

.ai-chat-window {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    max-width: calc(100vw - 40px);
    height: 80vh;
    max-height: 80vh;
    min-height: 400px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    animation: aiSlideUp 0.3s ease-out;
    z-index: 10001;
}

@keyframes aiSlideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.ai-chat-header {
    background: linear-gradient(135deg, #5b2b82 0%, #7c3aed 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 1;
}

.ai-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.ai-avatar i {
    font-size: 20px;
}

.ai-header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 2;
}

.ai-header-text h4 sup {
    font-size: 10px;
    font-weight: 900;
    vertical-align: super;
    margin-left: 2px;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.ai-header-text p {
    margin: 2px 0 0 0;
    font-size: 12px;
    opacity: 0.9;
}

.ai-close-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.ai-welcome-message {
    padding: 16px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e5e7eb;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 0;
}

.ai-welcome-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #5b2b82 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(91, 43, 130, 0.3);
}

.ai-welcome-avatar i {
    color: white;
    font-size: 20px;
}

.ai-welcome-content h5 {
    margin: 0 0 8px 0;
    color: #1f2937;
    font-size: 16px;
    font-weight: 600;
}

.ai-welcome-content p {
    margin: 0 0 8px 0;
    color: #6b7280;
    font-size: 14px;
}

.ai-capabilities {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
}

.ai-capabilities li {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 0;
    color: #374151;
    font-size: 13px;
}

.ai-capabilities i {
    color: #5b2b82;
    font-size: 14px;
}

.ai-prompt {
    background: rgba(91, 43, 130, 0.1);
    color: #5b2b82;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-style: italic;
    margin: 0;
    border: 1px solid rgba(91, 43, 130, 0.2);
}

.ai-chat-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    background: #f9fafb;
    min-height: 0;
}

.ai-message {
    margin-bottom: 16px;
    display: flex;
    gap: 12px;
}

.ai-message.user {
    flex-direction: row-reverse;
}

.ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: 600;
}

.ai-message.user .ai-message-avatar {
    background: #3b82f6;
    color: white;
}

.ai-message.ai .ai-message-avatar {
    background: linear-gradient(135deg, #5b2b82 0%, #7c3aed 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(91, 43, 130, 0.3);
}

.ai-message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.4;
}

.ai-message.user .ai-message-content {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

.ai-message.ai .ai-message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Enhanced Message Formatting Styles */
.ai-message-content h3 {
    margin: 12px 0 8px 0;
    font-size: 16px;
    font-weight: 600;
    color: #5b2b82;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 4px;
}

.ai-message-content h4 {
    margin: 10px 0 6px 0;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.ai-message-content ul {
    margin: 8px 0;
    padding-left: 20px;
}

.ai-message-content li {
    margin: 4px 0;
    line-height: 1.5;
}

.ai-message-content code {
    background: #f3f4f6;
    color: #5b2b82;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    border: 1px solid #e5e7eb;
}

.ai-message-content blockquote {
    margin: 8px 0;
    padding: 8px 12px;
    background: #f8fafc;
    border-left: 4px solid #5b2b82;
    border-radius: 0 4px 4px 0;
    font-style: italic;
    color: #6b7280;
}

.ai-message-content a {
    color: #5b2b82;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s ease;
}

.ai-message-content a:hover {
    color: #7c3aed;
    border-bottom-color: #7c3aed;
}

/* Service Icons and Styling */
.ai-service {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 13px;
    transition: all 0.2s ease;
}

.ai-service.air-freight {
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    color: white;
}

.ai-service.sea-freight {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

.ai-service.road-transport {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.ai-service.rail-transport {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.ai-service.warehousing {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.ai-service.customs {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.ai-service.project-cargo {
    background: linear-gradient(135deg, #84cc16, #65a30d);
    color: white;
}

.ai-service.contract-logistics {
    background: linear-gradient(135deg, #ec4899, #db2777);
    color: white;
}

.ai-service.consulting {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
    color: white;
}

/* Company and Certification Styling */
.ai-company {
    font-weight: 700;
    color: #5b2b82;
    background: linear-gradient(135deg, #5b2b82, #7c3aed);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ai-certification {
    font-weight: 600;
    color: #059669;
    background: #ecfdf5;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
}

/* Contact Information Styling */
.ai-phone {
    font-weight: 600;
    color: #059669;
    background: #ecfdf5;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #a7f3d0;
    text-decoration: none;
    display: inline-block;
}

.ai-phone:hover {
    background: #a7f3d0;
    color: #047857;
}

.ai-email {
    font-weight: 600;
    color: #dc2626;
    background: #fef2f2;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #fecaca;
    text-decoration: none;
    display: inline-block;
}

.ai-email:hover {
    background: #fecaca;
    color: #991b1b;
}

/* Highlight Styling */
.ai-message-highlight {
    font-weight: 700;
    color: #dc2626;
    background: #fef2f2;
    padding: 2px 6px;
    border-radius: 6px;
    border: 1px solid #fecaca;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.ai-message-time {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 4px;
    text-align: right;
}

.ai-message.user .ai-message-time {
    text-align: left;
}

.ai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    background: #f9fafb;
    border-top: 1px solid #e5e7eb;
}

.ai-typing-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #5b2b82 0%, #7c3aed 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(91, 43, 130, 0.3);
}

.ai-typing-avatar i {
    color: white;
    font-size: 16px;
}

.ai-typing-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    background: #9ca3af;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.5;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

.typing-text {
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
}

.ai-chat-input-area {
    padding: 16px 24px 20px 24px;
    background: white;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
    margin-top: auto;
}

.ai-input-container {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.ai-message-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #f9fafb;
}

.ai-message-input:focus {
    border-color: #5b2b82;
    background: white;
    box-shadow: 0 0 0 3px rgba(91, 43, 130, 0.1);
}

.ai-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, #5b2b82 0%, #7c3aed 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
    box-shadow: 0 2px 8px rgba(91, 43, 130, 0.3);
}

.ai-send-btn:hover {
    transform: scale(1.05);
}

.ai-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.ai-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 4px;
}

.ai-suggestion {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.ai-suggestion:hover {
    background: rgba(91, 43, 130, 0.1);
    border-color: #5b2b82;
    color: #5b2b82;
}

/* Tablet Responsiveness */
@media (max-width: 768px) {
    .ai-chat-window {
        width: 90%;
        max-width: 90%;
        height: 75vh;
        max-height: 75vh;
        min-height: 350px;
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-agent-widget {
        bottom: 10px;
        left: 10px;
        right: 10px;
        transform: none;
    }
    
    .ai-chat-window {
        bottom: 70px;
    }
    
    .ai-toggle-btn {
        min-width: 160px;
        height: 45px;
        padding: 0 16px;
        gap: 8px;
    }
    
    .ai-logo {
        width: 28px;
        height: 28px;
    }
    
    .ai-logo i {
        font-size: 16px;
    }
    
    .ai-label {
        font-size: 13px;
    }
    
    .ai-chat-window {
        width: 100%;
        height: 80vh;
        max-height: 80vh;
        min-height: 300px;
        bottom: 80px;
        left: 0;
        right: 0;
        transform: none;
        z-index: 10001;
    }
    
    .ai-chat-input-area {
        padding: 12px 20px 16px 20px;
    }
    
    .ai-welcome-message {
        padding: 12px 16px;
    }
    
    .ai-suggestions {
        justify-content: center;
    }
}

/* Extra Small Screens */
@media (max-width: 320px) {
    .ai-chat-window {
        height: 70vh;
        max-height: 70vh;
        min-height: 250px;
    }
    
    .ai-chat-input-area {
        padding: 12px 16px 20px 16px;
    }
    
    .ai-input-container {
        margin-bottom: 12px;
    }
    
    .ai-welcome-message {
        padding: 10px 12px;
    }
    
    .ai-welcome-avatar {
        width: 32px;
        height: 32px;
        margin-bottom: 8px;
    }
    
    .ai-welcome-avatar i {
        font-size: 16px;
    }
}

/* Scrollbar Styling */
.ai-chat-messages::-webkit-scrollbar {
    width: 4px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}
