/* SentiFlow Styles - Premium Edition */

:root {
    /* Colors - Enhanced Gradient Palette */
    --primary-color: #667EEA;
    --primary-light: #7B9FFF;
    --primary-dark: #5568D3;
    --secondary-color: #764BA2;
    --accent-cyan: #00F2FE;
    --accent-blue: #4FACFE;
    
    --secondary-color: #10B981;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    --neutral-color: #6B7280;
    
    /* Sentiment Colors - Enhanced with Glow */
    --sentiment-positive: #10B981;
    --sentiment-neutral: #6B7280;
    --sentiment-negative: #EF4444;
    --sentiment-frustrated: #DC2626;
    --sentiment-urgent: #F59E0B;
    
    /* Backgrounds */
    --bg-primary: #0a0e27;
    --bg-secondary: rgba(255, 255, 255, 0.06);
    --bg-dark: #050812;
    --bg-card: rgba(20, 20, 40, 0.8);
    
    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #c7c9d1;
    --text-light: #9aa0a6;
    
    /* Borders */
    --border-color: rgba(229, 231, 235, 0.1);
    --border-radius: 16px;
    
    /* Shadows - Premium depth */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(102, 126, 234, 0.1);
    --shadow-lg: 0 20px 25px -5px rgba(102, 126, 234, 0.15);
    --shadow-xl: 0 25px 50px -12px rgba(102, 126, 234, 0.25);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #0a0e27 0%, #1a1a3e 25%, #16213e 50%, #0f3460 75%, #0a0e27 100%);
    background-size: 400% 400%;
    animation: gradientShift 20s ease infinite;
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    letter-spacing: 0.3px;
}

@keyframes gradientShift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header - Premium Glassmorphic Design */
.header {
    background: rgba(20, 20, 40, 0.4);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: 0 25px 50px -12px rgba(102, 126, 234, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(102, 126, 234, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.header-content {
    position: relative;
    z-index: 1;
}

.header-content h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.5px;
}

.header-actions {
    display: flex;
    gap: 16px;
    position: relative;
    z-index: 1;
}

/* Buttons - Premium Interactions */
.btn-primary, .btn-secondary, .btn-send {
    padding: 12px 28px;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.95rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.btn-primary::before,
.btn-secondary::before,
.btn-send::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.btn-primary:active::before,
.btn-secondary:active::before,
.btn-send:active::before {
    animation: ripple-effect 0.6s ease-out;
}

@keyframes ripple-effect {
    0% {
        width: 0;
        height: 0;
    }
    100% {
        width: 300px;
        height: 300px;
    }
}

.btn-primary {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border: 1.5px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.btn-send {
    position: relative;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    color: #ffffff;
    padding: 14px 32px;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-send:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.6);
}

.btn-send:active:not(:disabled) {
    transform: translateY(0);
}

.btn-send:disabled {
    background: var(--neutral-color);
    cursor: not-allowed;
    opacity: 0.5;
}

/* Chat Container - Premium Glassmorphic */
.chat-container {
    background: rgba(20, 20, 40, 0.4);
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(102, 126, 234, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Sentiment Indicator - Premium Premium Premium */
.sentiment-indicator {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.12) 0%, rgba(118, 75, 162, 0.12) 100%);
    padding: 20px 28px;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
    overflow: hidden;
}

.sentiment-indicator::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.5), transparent);
}

.sentiment-label {
    font-weight: 700;
    color: var(--text-secondary);
    font-size: 0.95rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.sentiment-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 0.95rem;
    backdrop-filter: blur(10px);
}

.sentiment-badge.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #2ECC71;
    border: 1.5px solid #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sentiment-badge.positive:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sentiment-badge.neutral {
    background: rgba(107, 114, 128, 0.15);
    color: #9CA3AF;
    border: 1.5px solid #6B7280;
    box-shadow: 0 0 20px rgba(107, 114, 128, 0.3);
}

.sentiment-badge.negative,
.sentiment-badge.frustrated {
    background: rgba(239, 68, 68, 0.15);
    color: #FF6B6B;
    border: 1.5px solid #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.sentiment-badge.negative:hover,
.sentiment-badge.frustrated:hover {
    transform: scale(1.05);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.sentiment-badge.urgent {
    background: rgba(245, 158, 11, 0.15);
    color: #FBBF24;
    border: 1.5px solid #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    animation: urgentPulse 1.5s ease-in-out infinite;
}

@keyframes urgentPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.7); }
}

.sentiment-score {
    color: var(--text-light);
    font-size: 0.9rem;
    font-weight: 600;
    margin-left: auto;
}

/* Chat Messages - Smooth animations */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    animation: slideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.message-avatar:hover {
    transform: scale(1.1) rotate(5deg);
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.6) 0%, rgba(118, 75, 162, 0.6) 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    order: 2;
}

.message.user {
    flex-direction: row-reverse;
}

.message-content {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 16px 20px;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    word-wrap: break-word;
}

.message-content:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.15);
}

.message.user .message-content {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.35) 0%, rgba(118, 75, 162, 0.35) 100%);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.25);
}

.message-content p {
    margin: 0;
    line-height: 1.7;
}

.message-metadata {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.85rem;
    color: var(--text-light);
}

.context-sources {
    margin-top: 8px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-tag {
    display: inline-block;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.25) 0%, rgba(118, 75, 162, 0.25) 100%);
    color: #B0B0FF;
    padding: 4px 12px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    border: 1px solid rgba(102, 126, 234, 0.3);
    transition: all 0.2s ease;
}

/* Loading Indicator - Premium animations */
.loading-indicator {
    padding: 20px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
    color: var(--text-secondary);
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    background: rgba(102, 126, 234, 0.05);
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Typing indicator */
.typing-dots {
    display: inline-flex;
    gap: 8px;
}

.typing-dots span {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    animation: typing 1.4s infinite ease-in-out;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
}

.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) scale(1); }
    30% { transform: translateY(-12px) scale(1.2); }
}

/* Input Area - Premium design */
.input-area {
    padding: 24px;
    border-top: 1px solid rgba(102, 126, 234, 0.2);
    display: flex;
    gap: 14px;
    background: rgba(20, 20, 40, 0.6);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

#messageInput {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    resize: none;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.04);
    max-height: 120px;
}

#messageInput:hover {
    border-color: rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.06);
}

#messageInput:focus {
    outline: none;
    border-color: #667EEA;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Footer - Elegant */
.footer {
    text-align: center;
    padding: 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05) 0%, rgba(118, 75, 162, 0.05) 100%);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin-top: 24px;
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.footer p {
    margin: 0;
    background: linear-gradient(135deg, var(--text-secondary) 0%, var(--text-light) 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Responsive Design */
@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 20px;
        align-items: flex-start;
        padding: 24px;
    }
    
    .header-content h1 {
        font-size: 1.8rem;
    }
    
    .header-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .header-actions a,
    .header-actions button {
        width: 100%;
        justify-content: center;
    }
    
    .sentiment-indicator {
        flex-wrap: wrap;
        padding: 16px 20px;
    }
    
    .sentiment-score {
        width: 100%;
        margin-left: 0;
        margin-top: 8px;
    }
    
    .input-area {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .btn-send {
        width: 100%;
    }
    
    .chat-messages {
        padding: 16px;
    }
    
    .container {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .header-content h1 {
        font-size: 1.5rem;
    }
    
    .subtitle {
        font-size: 0.85rem;
    }
    
    .sentiment-indicator {
        gap: 12px;
        padding: 14px 16px;
    }
    
    .sentiment-label {
        font-size: 0.85rem;
    }
    
    .sentiment-badge {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
}

/* Scrollbar Styling - Premium */
.chat-messages::-webkit-scrollbar {
    width: 10px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.4);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
    transition: all 0.3s ease;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.7);
    background-clip: content-box;
}

/* Sentiment wave animation */
.sentiment-wave {
    flex: 1;
    max-width: 300px;
    color: #667EEA;
    display: flex;
    align-items: center;
}

.sentiment-wave svg {
    width: 100%;
    height: 40px;
    filter: drop-shadow(0 0 8px rgba(102, 126, 234, 0.4));
}

/* Message Reactions - Premium interactive elements */
.message-reactions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.message-reactions .reaction {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1rem;
    line-height: 1;
}

.message-reactions .reaction:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: scale(1.1) translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.message-reactions .reaction.active {
    background: rgba(102, 126, 234, 0.3);
    border-color: #667EEA;
}

/* Button effects */
.btn-send.ripple {
    animation: rippleEffect 0.6s ease-out;
}

@keyframes rippleEffect {
    0% {
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.6);
    }
    100% {
        box-shadow: 0 0 0 25px rgba(102, 126, 234, 0);
    }
}

.send-success {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    animation: successPopup 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    pointer-events: none;
}

@keyframes successPopup {
    0% {
        transform: translateY(-50%) scale(0) rotate(-180deg);
        opacity: 1;
    }
    100% {
        transform: translateY(-50%) scale(1) rotate(0deg);
        opacity: 0;
    }
}

/* Dashboard glass cards */
.glass {
    background: rgba(20, 20, 40, 0.4) !important;
    -webkit-backdrop-filter: blur(30px);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 25px 50px -12px rgba(102, 126, 234, 0.25);
    border-radius: 20px;
}

.metric .number {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(135deg, #667EEA 0%, #764BA2 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -1px;
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Selection styling */
::selection {
    background: rgba(102, 126, 234, 0.5);
    color: #ffffff;
}

::-moz-selection {
    background: rgba(102, 126, 234, 0.5);
    color: #ffffff;
}
