/* Enhanced P2P Chat Interface Styles */

/* Fix basic layout spacing issues */
.hero-content h1 {
    margin-bottom: 1rem !important;
    line-height: 1.2 !important;
}

.hero-subtitle {
    margin-bottom: 2rem !important;
    line-height: 1.6 !important;
    display: block !important;
}

.hero-chat-container {
    margin-top: 2rem !important;
    margin-bottom: 2rem !important;
}

/* Connection Status Indicator */
.connection-status {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #e0e0e0;
    border-radius: 8px 8px 0 0;
    font-size: 0.85em;
    font-weight: 500;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    animation: pulse 2s infinite;
}

.status-dot.connected {
    background: #28a745;
    animation: none;
}

.status-dot.disconnected {
    background: #dc3545;
}

.status-dot.reconnecting {
    background: #ffc107;
    animation: blink 1s infinite;
}

.status-dot.error {
    background: #ff6b6b;
    animation: shake 0.5s ease-in-out;
}

.status-dot.connecting {
    background: #007bff;
}

/* Enhanced Chat Container */
#onboarding-chat {
    max-height: 500px;
    overflow-y: auto;
    padding: 20px;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 1px solid #e0e0e0;
    border-radius: 0 0 12px 12px;
    scroll-behavior: smooth;
}

/* Message Styles */
.message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

.message-avatar {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-size: 14px;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.user-message .message-avatar {
    background: linear-gradient(135deg, #007A4D, #00a65a);
    order: 2;
    margin-right: 0;
    margin-left: 12px;
}

.agent-message .message-avatar {
    background: linear-gradient(135deg, #FFB81C, #ff9800);
}

.error-message .message-avatar {
    background: linear-gradient(135deg, #ff6b6b, #e74c3c);
}

/* Message Content */
.message-content {
    flex: 1;
    min-width: 0;
}

.user-message .message-content {
    text-align: right;
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    font-size: 0.85em;
    color: #666;
}

.user-message .message-header {
    flex-direction: row-reverse;
}

.message-status {
    font-size: 0.75em;
    padding: 2px 6px;
    border-radius: 10px;
    text-transform: capitalize;
}

.message-status.sending {
    background: #ffc107;
    color: #856404;
}

.message-status.delivered {
    background: #28a745;
    color: white;
}

.message-status.error {
    background: #dc3545;
    color: white;
}

/* Message Text Bubble */
.message-text {
    background: #ffffff;
    color: #1a1a2e;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
    max-width: 80%;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message .message-text {
    background: linear-gradient(135deg, #007A4D, #00a65a);
    color: white;
    margin-left: auto;
    border: none;
}

.agent-message .message-text {
    background: #ffffff;
    color: #1a1a2e;
    border: 1px solid #e0e0e0;
}

.error-message .message-text {
    background: #fff5f5;
    color: #c53030;
    border: 1px solid #feb2b2;
}

.message-timestamp {
    font-size: 0.75em;
    color: #999;
    margin-top: 4px;
}

.user-message .message-timestamp {
    text-align: right;
}

/* Confidence Score */
.confidence-score {
    display: flex;
    align-items: center;
    font-size: 0.75em;
    color: #666;
    gap: 4px;
}

.confidence-score i {
    color: #007A4D;
}

/* Error Actions */
.error-actions {
    margin-top: 12px;
    display: flex;
    gap: 8px;
}

.error-actions .btn {
    padding: 6px 12px;
    font-size: 0.8em;
    border-radius: 6px;
    border: 1px solid #007A4D;
    background: #007A4D;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.error-actions .btn:hover {
    background: #005a37;
    transform: translateY(-1px);
}

.error-actions .btn-outline {
    background: transparent;
    color: #007A4D;
}

.error-actions .btn-outline:hover {
    background: #007A4D;
    color: white;
}

/* Enhanced Input Area */
.chat-input-container {
    position: relative;
    margin-top: 16px;
}

#onboarding-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #ffffff;
    color: #1a1a2e;
    font-size: 14px;
    line-height: 1.4;
    resize: vertical;
    min-height: 50px;
    max-height: 120px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

#onboarding-input:focus {
    outline: none;
    border-color: #007A4D;
    box-shadow: 0 0 0 3px rgba(0, 122, 77, 0.1);
}

#onboarding-input:disabled {
    background: #f8f9fa;
    color: #6c757d;
    cursor: not-allowed;
}

/* Enhanced Send Button */
#send-onboarding {
    background: linear-gradient(135deg, #007A4D, #00a65a);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    box-shadow: 0 2px 8px rgba(0, 122, 77, 0.3);
}

#send-onboarding:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 122, 77, 0.4);
}

#send-onboarding:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Onboarding Actions */
.onboarding-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.onboarding-actions .btn {
    flex: 1;
}

#extract-insights {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

#extract-insights:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#extract-insights:disabled {
    background: #6c757d;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Character Counter */
.char-counter {
    position: absolute;
    bottom: -20px;
    right: 0;
    font-size: 0.75em;
    color: #666;
}

#char-count {
    color: #007A4D;
    font-weight: 600;
}

/* Error Notification */
.error-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b, #e74c3c);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    font-weight: 500;
}

/* Animations */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.7;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0.3;
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .message {
        margin-bottom: 12px;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
    
    .message-text {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .connection-status {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    
    #onboarding-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .connection-status {
        background: rgba(26, 26, 46, 0.95);
        border-color: #333;
        color: #e0e0e0;
    }
    
    #onboarding-chat {
        background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
        border-color: #333;
    }
    
    .message-text {
        background: #2a2a40;
        color: #e0e0e0;
        border-color: #333;
    }
    
    .agent-message .message-text {
        background: #2a2a40;
        color: #e0e0e0;
    }
    
    #onboarding-input {
        background: #2a2a40;
        color: #e0e0e0;
        border-color: #333;
    }
    
    #onboarding-input:focus {
        border-color: #007A4D;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .message-text {
        border: 2px solid #000;
    }
    
    .user-message .message-text {
        background: #000;
        color: #fff;
        border: 2px solid #fff;
    }
    
    .connection-status {
        border: 2px solid #000;
    }
}/* Onboard
ing Chat Enhancements */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 0;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #007A4D;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Enhanced message styling */
.message.user-message {
    flex-direction: row-reverse;
    margin-left: 20%;
}

.message.user-message .message-content {
    background: #007A4D;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.message.agent-message .message-content {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 18px 18px 18px 4px;
}

.message.agent-message .message-avatar {
    background: linear-gradient(135deg, #007A4D, #00a86b);
    color: white;
}

.message.user-message .message-avatar {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

/* Smooth scrolling for chat */
.chat-messages {
    scroll-behavior: smooth;
}

/* Welcome message special styling */
.message.agent-message:first-child .message-content {
    background: linear-gradient(135deg, #007A4D, #00a86b);
    color: white;
    border: none;
}

.message.agent-message:first-child .message-avatar {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

/* Responsive improvements */
@media (max-width: 768px) {
    .message.user-message {
        margin-left: 10%;
    }
    
    .message-content {
        max-width: 85%;
    }
}/* H
ero Chat Interface Styling */
.hero-chat-container {
    max-width: 600px;
    margin: 2rem auto;
    /* Ensure it's always visible and prominent */
    position: relative;
    z-index: 5;
    padding: 0 1rem;
}

.chat-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 122, 77, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px rgba(0, 122, 77, 0.15);
}

.chat-header {
    background: linear-gradient(135deg, #007A4D, #00a86b);
    color: white;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.chat-info h3 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-status {
    margin: 0.25rem 0 0 0;
    opacity: 0.9;
    font-size: 0.9rem;
}

.hero-chat-container .chat-messages {
    max-height: 300px;
    overflow-y: auto;
    padding: 1.5rem;
    background: #fafafa;
}

.hero-chat-container .message {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.hero-chat-container .message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.hero-chat-container .message-content {
    background: white;
    padding: 1rem 1.25rem;
    border-radius: 18px;
    max-width: 80%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    line-height: 1.5;
}

.hero-chat-container .message-content strong {
    color: #007A4D;
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
}

.hero-chat-container .user-message {
    flex-direction: row-reverse;
}

.hero-chat-container .user-message .message-content {
    background: #007A4D;
    color: white;
    border-radius: 18px 18px 4px 18px;
}

.hero-chat-container .user-message .message-content strong {
    color: rgba(255, 255, 255, 0.9);
}

.hero-chat-container .agent-message .message-content {
    border-radius: 18px 18px 18px 4px;
}

.hero-chat-container .agent-message .message-avatar {
    background: linear-gradient(135deg, #007A4D, #00a86b);
    color: white;
}

.hero-chat-container .user-message .message-avatar {
    background: linear-gradient(135deg, #6c757d, #495057);
    color: white;
}

.chat-input-container {
    padding: 1.5rem;
    background: white;
    border-top: 1px solid #e9ecef;
}

.input-wrapper {
    display: flex;
    gap: 0.75rem;
    align-items: flex-end;
}

.chat-input-container textarea {
    flex: 1;
    border: 2px solid #e9ecef;
    border-radius: 20px;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    resize: none;
    min-height: 44px;
    max-height: 120px;
    transition: all 0.3s ease;
    background: #f8f9fa;
}

.chat-input-container textarea:focus {
    outline: none;
    border-color: #007A4D;
    background: white;
    box-shadow: 0 0 0 3px rgba(0, 122, 77, 0.1);
}

.chat-input-container textarea:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
}

.send-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #007A4D, #00a86b);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 122, 77, 0.3);
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.char-counter {
    font-size: 0.8rem;
    color: #6c757d;
    text-align: right;
    margin-top: 0.5rem;
}

.welcome-message-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

.welcome-message-loading .typing-indicator {
    margin: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hero-chat-container {
        margin: 1rem auto 2rem;
        padding: 0 0.5rem;
        max-width: 95%;
        /* Ensure it's visible at the top on mobile */
        position: relative;
        z-index: 10;
    }
    
    .chat-header {
        padding: 1rem;
    }
    
    .hero-chat-container .chat-messages {
        padding: 1rem;
        max-height: 200px;
        min-height: 150px;
    }
    
    .chat-input-container {
        padding: 1rem;
    }
    
    .hero-chat-container .message-content {
        max-width: 90%;
        font-size: 0.9rem;
        padding: 0.8rem 1rem;
    }
    
    /* Make sure the chat is prominently visible */
    .hero-chat-container .chat-card {
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
        border: 2px solid rgba(255, 255, 255, 0.2);
    }
}

@media (max-width: 480px) {
    .hero-chat-container {
        margin: 0.5rem auto 1.5rem;
        max-width: 98%;
    }
    
    .hero-chat-container .chat-messages {
        max-height: 180px;
        padding: 0.8rem;
    }
    
    .chat-input-container {
        padding: 0.8rem;
    }
    
    .hero-chat-container .message-content {
        font-size: 0.85rem;
        padding: 0.7rem 0.9rem;
    }
}

/* Smooth animations */
.hero-chat-container .message {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}/* Pers
onalized Welcome Message in Header */
#personalized-welcome {
    background: rgba(255, 255, 255, 0.2);
    padding: 0.5rem 0.75rem;
    border-radius: 12px;
    margin: 0.5rem 0 0.25rem 0;
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    animation: welcomeGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

@keyframes welcomeGlow {
    from {
        box-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
    }
}

.chat-subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 0.85rem;
}

/* Make chat info area more spacious for the welcome message */
.chat-info {
    flex: 1;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.chat-info h3 {
    margin: 0 0 0.25rem 0;
}

/* Mobile optimization for the welcome message */
@media (max-width: 768px) {
    #personalized-welcome {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }
    
    .chat-header {
        padding: 1.25rem;
        min-height: 80px;
    }
    
    .chat-info {
        min-height: 50px;
    }
}