/* Business Strategy Advisor Custom Styles */

/* Enhanced Typography */
* {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Section styling */
#chat-section {
    padding: 8rem 2rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

#chat-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
    pointer-events: none;
}

.s-content__header {
    margin-bottom: 4rem;
}

.s-content__header-title {
    background: linear-gradient(135deg, #ffffff, #f0f9ff);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #ffffff; /* Fallback for browsers that don't support background-clip */
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    font-size: 4.5rem;
    margin-bottom: 2rem;
}

.s-content__header-text {
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.9);
    max-width: 900px;
    margin: 0 auto;
    line-height: 1.7;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Chat Interface Enhancements */
.chat-message {
    animation: fadeInUp 0.3s ease-out;
}

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

/* Typing indicator animation */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.typing-dots {
    display: flex;
    gap: 0.25rem;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #6b7280;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Custom scrollbar for chat messages */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}

#chat-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 3px;
}

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

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

/* Message bubble styles */
.user-message {
    background: linear-gradient(135deg, #3b82f6, #2563eb, #1d4ed8);
    color: white;
    margin-left: auto;
    margin-right: 0;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-message {
    background: linear-gradient(135deg, #ffffff, #fafbfc);
    color: #374151;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.message-bubble {
    max-width: 75%;
    padding: 1rem 1.25rem;
    border-radius: 1.25rem;
    word-wrap: break-word;
    position: relative;
    backdrop-filter: blur(10px);
}

.user-message::before {
    content: '';
    position: absolute;
    top: 50%;
    right: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 8px solid #2563eb;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

.ai-message::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -8px;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-right: 8px solid white;
    border-top: 8px solid transparent;
    border-bottom: 8px solid transparent;
}

/* Enhanced suggestion buttons */
.suggestion-btn {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(0);
    background: rgb(255, 255, 255) !important;
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px) saturate(180%);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
    padding: 2rem !important;
    min-height: 180px;
    font-size: 1.4rem;
}

.suggestion-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.6s ease;
}

.suggestion-btn:hover::before {
    left: 100%;
}

.suggestion-btn:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    border-color: rgba(255, 255, 255, 0.5) !important;
    background: rgba(255, 255, 255, 0.25) !important;
}

.suggestion-btn:active {
    transform: translateY(-2px) scale(1.01);
}

.suggestion-btn .text-blue-600 {
    background: linear-gradient(135deg, #86487c, #379fe4);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #ffffff; /* Fallback */
    font-weight: 700;
    font-size: 1.8rem !important;
    margin-bottom: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.suggestion-btn .text-gray-600 {
    color: rgba(55, 65, 81, 0.9) !important; /* Darker gray for better contrast */
    font-size: 1.6rem !important;
    line-height: 1.6;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.1);
}

/* Enhanced chat input */
#chat-input {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.9) !important;
    backdrop-filter: blur(15px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1) inset;
    padding: 1.5rem 2rem !important;
    font-size: 1.7rem !important;
    font-weight: 500;
    min-height: 140px !important;
    line-height: 1.6;
    color: #1f2937;
}

#chat-input:focus {
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3), 
                0 8px 32px rgba(0, 0, 0, 0.15),
                0 4px 16px rgba(0, 0, 0, 0.1) inset !important;
    background: rgba(255, 255, 255, 0.95) !important;
    transform: translateY(-1px);
    border-color: rgba(102, 126, 234, 0.5) !important;
}

#chat-input::placeholder {
    color: rgba(0, 0, 0, 0.6);
    transition: color 0.3s ease;
    font-size: 1.7rem !important;
    font-weight: 500;
}

#chat-input:focus::placeholder {
    color: rgba(0, 0, 0, 0.3);
}

/* Button loading state */
.button-loading {
    position: relative;
    color: transparent;
}

.button-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Message timestamp */
.message-timestamp {
    font-size: 1.1rem !important;
    color: #9ca3af;
    margin-top: 0.75rem;
    opacity: 0.8;
    font-weight: 500;
    letter-spacing: 0.025em;
}

.user-message .message-timestamp {
    color: rgba(255, 255, 255, 0.8);
}

/* Enhanced chat messages area */
#chat-messages {
    height: 500px !important;
    font-size: 1.8rem !important;
    font-weight: 500;
    line-height: 1.6;
}

/* AI Advisor welcome message and chat content size fixes */
#chat-messages .text-sm {
    font-size: 1.8rem !important;
    font-weight: 500;
    line-height: 1.6;
}

#chat-messages .bg-white.rounded-lg p {
    font-size: 1.8rem !important;
    font-weight: 500;
    line-height: 1.6;
    color: #1f2937;
}

#chat-messages .bg-white.rounded-lg ul {
    font-size: 1.8rem !important;
    font-weight: 500;
    line-height: 1.6;
}

#chat-messages .bg-white.rounded-lg li {
    font-size: 1.8rem !important;
    font-weight: 500;
    margin: 0.75rem 0;
    color: #374151;
}

#chat-messages .max-w-xs,
#chat-messages .lg\\:max-w-md {
    max-width: 600px !important;
}

/* Welcome message specific enhancements */
#chat-messages .bg-white.rounded-lg.p-3 {
    padding: 2rem !important;
    border-radius: 1rem !important;
}

#chat-messages .space-y-1 > li {
    margin: 0.75rem 0 !important;
}

#chat-messages .mt-2 {
    margin-top: 1rem !important;
}

/* Larger message bubbles */
.message-bubble {
    padding: 1.5rem 2rem !important;
    font-size: 1.8rem !important;
    font-weight: 500;
    line-height: 1.6;
    min-height: 4rem;
}

/* Larger avatars */
.w-8.h-8 {
    width: 3rem !important;
    height: 3rem !important;
}

.w-10.h-10 {
    width: 4rem !important;
    height: 4rem !important;
}

/* Chat container responsive adjustments */
@media (max-width: 768px) {
    #chat-section {
        padding: 4rem 0;
    }
    
    #chat-messages {
        height: 450px !important;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 1rem 1.25rem;
        font-size: 1rem;
    }
    
    .suggestion-btn {
        padding: 1.25rem;
        text-align: center;
        font-size: 1rem;
    }
    
    .s-content__header-title {
        font-size: 3rem;
    }
    
    .s-content__header-text {
        font-size: 1.25rem;
    }
    
    .bg-white.rounded-lg.shadow-lg {
        min-height: 600px;
    }
}

/* Smooth transitions for all interactive elements */
* {
    transition: all 0.2s ease;
}

/* Custom gradient background for header */
.chat-header-gradient {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 50%, #1d4ed8 100%);
    position: relative;
}

.chat-header-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
    pointer-events: none;
}

/* Enhanced button styles */
.bg-blue-600 {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    padding: 1.25rem 2.5rem !important;
    font-size: 1.6rem !important;
    font-weight: 600;
    min-width: 140px;
    letter-spacing: 0.025em;
}

.bg-blue-600::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.bg-blue-600:hover::before {
    left: 100%;
}

.bg-blue-600:hover {
    background: linear-gradient(135deg, #764ba2, #667eea) !important;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 40px rgba(102, 126, 234, 0.5);
}

/* Header gradient enhancement */
.bg-gradient-to-r.from-blue-600.to-blue-700 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%) !important;
    position: relative;
    overflow: hidden;
}

.bg-gradient-to-r.from-blue-600.to-blue-700::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

/* Message content formatting */
.message-content {
    line-height: 1.7;
    font-size: 1.8rem !important;
    font-weight: 500;
    color: #1f2937;
}

.message-content h1,
.message-content h2,
.message-content h3 {
    font-weight: 600;
    margin: 0.75rem 0 0.5rem 0;
    background: linear-gradient(135deg, #1e40af, #3b82f6);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: #1e40af; /* Fallback */
}

.message-content ul,
.message-content ol {
    margin: 0.75rem 0;
    padding-left: 1.5rem;
}

.message-content li {
    margin: 0.375rem 0;
    position: relative;
}

.message-content li::marker {
    color: #3b82f6;
}

.message-content p {
    margin: 0.75rem 0;
}

.message-content code {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.message-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 1rem;
    margin: 1rem 0;
    font-style: italic;
    color: #6b7280;
    background: linear-gradient(135deg, #f8fafc, #f1f5f9);
    padding: 1rem;
    border-radius: 0.5rem;
    position: relative;
}

.message-content blockquote::before {
    content: '"';
    position: absolute;
    top: -0.5rem;
    left: 1rem;
    font-size: 2rem;
    color: #3b82f6;
    font-weight: bold;
}

/* Status indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
    margin-top: 0.5rem;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Error message styling */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

/* Success message styling */
.success-message {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #16a34a;
    padding: 0.75rem;
    border-radius: 0.5rem;
    margin: 0.5rem 0;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Export button animation */
.export-success {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    animation: successPulse 0.6s ease-out;
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}

@keyframes successPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
    }
}

/* Enhanced glass morphism effects */
.bg-white {
    backdrop-filter: blur(25px) saturate(180%);
    background: rgba(255, 255, 255, 0.9) !important;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.15), 
                0 0 0 1px rgba(255, 255, 255, 0.2) inset;
}

.bg-gray-50 {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.4), rgba(241, 245, 249, 0.4)) !important;
    backdrop-filter: blur(15px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Chat container enhancements */
.bg-white.rounded-lg.shadow-lg {
    background: rgba(255, 255, 255, 0.15) !important;
    backdrop-filter: blur(40px) saturate(200%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 
        0 32px 64px -12px rgba(0, 0, 0, 0.25),
        0 0 0 1px rgba(255, 255, 255, 0.3) inset,
        0 2px 4px rgba(0, 0, 0, 0.1) inset;
    transform: translateZ(0);
    max-width: 1200px;
    margin: 0 auto;
    min-height: 700px;
}

/* Floating animation for avatars */
.w-8.h-8.bg-blue-600 {
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-2px);
    }
}

/* Enhanced shadows and depth */
.shadow-lg {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 
                0 10px 10px -5px rgba(0, 0, 0, 0.04),
                0 0 0 1px rgba(255, 255, 255, 0.5) inset !important;
}

.shadow-sm {
    box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06),
                0 1px 2px 0 rgba(0, 0, 0, 0.04),
                0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
}

/* Accessibility improvements */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
button:focus,
textarea:focus,
input:focus {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-message {
        border: 2px solid #000;
    }
    
    .user-message {
        background: #000;
        color: #fff;
    }
}

/* This was moved to the main section styling above */

/* Header buttons enhancement */
.px-3.py-1 {
    padding: 1rem 2rem !important;
    font-size: 1.5rem !important;
    font-weight: 600;
    letter-spacing: 0.025em;
}

/* Chat header text sizes */
.bg-gradient-to-r h3.font-semibold {
    font-size: 1.9rem !important;
    font-weight: 700;
    letter-spacing: 0.025em;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.bg-gradient-to-r .text-sm.text-blue-100 {
    font-size: 1.6rem !important;
    font-weight: 500;
    opacity: 0.95;
}

/* Popular Questions section enhancement */
.mt-6 {
    margin-top: 4rem !important;
}

.mt-6 h3 {
    position: relative;
    display: inline-block;
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 700;
    font-size: 2.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
}

.mt-6 h3::after {
    content: '';
    position: absolute;
    bottom: -0.25rem;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    border-radius: 2px;
    transform: scaleX(0);
    transform-origin: left;
    animation: expandLine 0.8s ease-out 0.5s forwards;
    box-shadow: 0 2px 8px rgba(240, 147, 251, 0.4);
}

@keyframes expandLine {
    to {
        transform: scaleX(1);
    }
}

/* Grid enhancements */
.grid {
    position: relative;
    gap: 1.5rem !important;
}

.grid.grid-cols-1.md\\:grid-cols-2.lg\\:grid-cols-3 {
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)) !important;
}

.grid::before {
    content: '';
    position: absolute;
    top: -1rem;
    left: -1rem;
    right: -1rem;
    bottom: -1rem;
    background: linear-gradient(45deg, transparent 49%, rgba(59, 130, 246, 0.1) 50%, transparent 51%);
    background-size: 20px 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    border-radius: 1rem;
}

.grid:hover::before {
    opacity: 1;
}

/* Improved focus states for accessibility */
button:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
    border-radius: 0.375rem;
}

/* Modern scrollbar for chat */
#chat-messages {
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 #f8fafc;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .chat-message,
    .typing-dot,
    .suggestion-btn,
    .loading-spinner,
    .w-8.h-8.bg-blue-600 {
        animation: none;
    }
    
    * {
        transition: none;
    }
    
    .mt-6 h3::after {
        transform: scaleX(1);
        animation: none;
    }
}

/* Custom hero background for business-advisor page */
.business-advisor-page .s-intro__bg {
    background-image: url(../images/advisory-bg.jpg) !important;
    background-position: center center !important;
}

/* Optional: Adjust overlay opacity for better text readability */
.business-advisor-page .s-intro__bg::before {
    opacity: 0.4;
}

.business-advisor-page .s-intro__bg::after {
    opacity: 0.3;
}
