/* MizuBot Widget Styles - Django Implementation */
/* Import CSS variables from base.css for consistent theming */
@import url("./base.35d241f69227.css");

/* Container */
.mizubot-container {
    position: fixed;
    bottom: 0;
    right: 0;
    z-index: 10000;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Hidden utility class */
.hidden {
    display: none !important;
}

/* Auto-greeting popup */
.mizubot-greeting {
    position: fixed;
    bottom: 120px;
    right: 24px;
    background: #f8f9fa; /* Light gray background */
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    padding: 20px; /* Increased padding for better spacing */
    max-width: 340px; /* Slightly wider for better readability */
    z-index: 10001;
    transition: all 0.3s ease;
}

.mizubot-greeting-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mizubot-greeting-icon {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--teal, #588B8B) 0%, var(--purple, #735D78) 100%); /* Teal to purple gradient */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.mizubot-greeting-text {
    flex: 1;
}

.mizubot-greeting-title {
    margin: 0 0 4px 0;
    font-weight: 600;
    font-size: 14px;
    color: #111827;
}

.mizubot-greeting-subtitle {
    margin: 0;
    font-size: 12px;
    color: #6b7280;
}

.mizubot-greeting-arrow {
    position: absolute;
    bottom: -8px;
    right: 32px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #f8f9fa; /* Match greeting background */
}

/* Bounce animation */
@keyframes bounce {
    0%, 20%, 53%, 80%, 100% {
        transform: translate3d(0, 0, 0);
    }
    40%, 43% {
        transform: translate3d(0, -8px, 0);
    }
    70% {
        transform: translate3d(0, -4px, 0);
    }
    90% {
        transform: translate3d(0, -2px, 0);
    }
}

.animate-bounce {
    animation: bounce 1s infinite;
}

/* Chat Button */
.mizubot-chat-button {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, var(--teal, #588B8B) 0%, var(--purple, #735D78) 100%); /* Teal to purple gradient */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(88, 139, 139, 0.3); /* Teal-based shadow */
    transition: all 0.3s ease;
    z-index: 10000;
}

.mizubot-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(88, 139, 139, 0.4); /* Teal-based shadow */
}

/* Remove rotation and use icon switching instead */
.mizubot-chat-button.chat-open {
    /* Removed transform: rotate(180deg); */
}

.mizubot-chat-button.chat-open:hover {
    transform: scale(1.1); /* Only scale, no rotation */
}

.mizubot-button-content {
    color: white;
    transition: transform 0.3s ease;
    position: relative;
}

/* Icon transition styles */
.mizubot-button-icon,
.mizubot-button-close-icon {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.mizubot-button-icon.hidden,
.mizubot-button-close-icon.hidden {
    opacity: 0;
    transform: scale(0.8);
}

/* Notification badge - Hidden by default */
.mizubot-notification-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--purple, #735D78); /* Purple for notification */
    color: white;
    font-size: 12px;
    font-weight: bold;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: none !important; /* Completely hidden by default */
    align-items: center;
    justify-content: center;
    animation: pulse 2s infinite;
}

/* Visible state for notification badge - only show when explicitly made visible */
.mizubot-notification-badge.visible {
    display: flex !important;
}

/* Ensure hidden state overrides everything */
.mizubot-notification-badge.hidden {
    display: none !important;
}

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

/* Chat Window */
.mizubot-chat-window {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 420px; /* Increased width for better readability */
    height: 650px; /* Significantly increased height for more message space */
    background: #f5f5f5; /* Light gray background */
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    border: 1px solid #d1d5db;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 10000;
    transition: all 0.3s ease;
}

.mizubot-chat-window.hidden {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
}

/* Header - Compact design for more message space */
.mizubot-header {
    background: linear-gradient(135deg, var(--teal, #588B8B) 0%, var(--purple, #735D78) 100%); /* Teal to purple gradient */
    color: white;
    padding: 12px 16px; /* Reduced padding for more compact header */
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px; /* Fixed height to ensure consistency */
}

.mizubot-header-content {
    display: flex;
    align-items: center;
    gap: 10px; /* Reduced gap for more compact layout */
}

.mizubot-avatar {
    width: 28px; /* Smaller avatar for compact header */
    height: 28px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0; /* Prevent avatar from shrinking */
}

.mizubot-header-text {
    flex: 1;
}

.mizubot-title {
    margin: 0;
    font-size: 15px; /* Slightly smaller font for compact header */
    font-weight: 600;
    color: white;
    line-height: 1.3; /* Tighter line height */
}

.mizubot-status {
    margin: 1px 0 0 0; /* Reduced margin */
    font-size: 11px; /* Smaller status text */
    color: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    gap: 5px; /* Reduced gap */
}

.mizubot-status-dot {
    width: 6px;
    height: 6px;
    background: #10b981; /* Green for online status */
    border-radius: 50%;
}

.mizubot-close-button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px; /* Reduced padding for compact header */
    border-radius: 6px;
    transition: background 0.2s ease;
    font-size: 14px; /* Smaller close button */
}

.mizubot-close-button:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Messages Area - More space for responses */
.mizubot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px; /* Increased padding for more breathing room */
    background: #e5e7eb; /* Medium gray background for messages area */
}

.mizubot-message {
    margin-bottom: 24px; /* Increased margin for better spacing between messages */
    display: flex;
    align-items: flex-start;
}

.mizubot-message.user {
    justify-content: flex-end;
}

.mizubot-message.assistant {
    justify-content: flex-start;
}

.mizubot-message-wrapper {
    display: flex;
    align-items: flex-start;
    gap: 10px; /* Increased gap for better spacing */
    max-width: 85%; /* Increased max-width for more content space */
}

.mizubot-message.user .mizubot-message-wrapper {
    flex-direction: row-reverse;
}

.mizubot-message-avatar {
    flex-shrink: 0;
    width: 28px; /* Slightly larger avatar */
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #9ca3af;
    color: white;
}

.mizubot-message.user .mizubot-message-avatar {
    background: var(--teal, #588B8B); /* Teal for user avatar */
    color: white;
}

.mizubot-message.assistant .mizubot-message-avatar {
    background: var(--purple, #735D78); /* Purple for assistant avatar */
    color: white;
}

.mizubot-message-bubble {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 18px;
    padding: 18px 22px; /* Increased padding for more spacious feel */
    max-width: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); /* Added subtle shadow */
}

.mizubot-message.user .mizubot-message-bubble {
    background: linear-gradient(135deg, var(--teal, #588B8B) 0%, var(--purple, #735D78) 100%); /* Teal to purple gradient */
    color: white;
    border-bottom-right-radius: 6px;
    border: none;
}

.mizubot-message.assistant .mizubot-message-bubble {
    background: white; /* Clean white background for assistant messages */
    color: var(--dark, #011627); /* Dark text matching website theme */
    border-bottom-left-radius: 6px;
    border: 1px solid #d1d5db;
}

.mizubot-message-bubble.error {
    background: #fee2e2;
    color: #dc2626;
    border: 1px solid #fecaca;
}

.mizubot-message-content {
    line-height: 1.6; /* Improved line height for better readability */
    font-size: 14px; /* Consistent font size */
}

.mizubot-message-content p {
    margin: 0 0 12px 0; /* Increased margin for better paragraph spacing */
}

.mizubot-message-content p:last-child {
    margin-bottom: 0;
}

.mizubot-message-content strong,
.mizubot-message-content b {
    font-weight: 600;
    color: var(--teal, #588B8B); /* Highlight important text with teal theme color */
}

/* Better formatting for lists */
.mizubot-message-content ul,
.mizubot-message-content ol {
    margin: 12px 0; /* Increased margin for better list spacing */
    padding-left: 24px; /* More indentation for better hierarchy */
}

.mizubot-message-content li {
    margin: 6px 0; /* Increased margin for better list item spacing */
    line-height: 1.5; /* Better line height for list items */
}

/* Better formatting for code blocks */
.mizubot-message-content code {
    background: rgba(88, 139, 139, 0.1); /* Teal-colored code background */
    color: var(--teal, #588B8B);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
}

.mizubot-message-content pre {
    background: rgba(88, 139, 139, 0.05);
    border: 1px solid rgba(88, 139, 139, 0.2);
    border-radius: 8px;
    padding: 12px;
    margin: 12px 0;
    overflow-x: auto;
}

.mizubot-message-content pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}

/* Better formatting for blockquotes */
.mizubot-message-content blockquote {
    border-left: 4px solid var(--teal, #588B8B);
    padding-left: 16px;
    margin: 12px 0;
    font-style: italic;
    color: #6b7280;
    background: rgba(88, 139, 139, 0.03); /* Light teal background */
    padding: 12px 16px;
    border-radius: 4px;
}

/* Message metadata */
.mizubot-message-meta {
    font-size: 11px;
    color: #9ca3af;
    margin-top: 8px; /* Increased margin for better spacing */
    display: flex;
    align-items: center;
    gap: 8px;
}

.mizubot-message.user .mizubot-message-meta {
    justify-content: flex-end;
    color: rgba(255, 255, 255, 0.8); /* Better contrast for user messages */
}

.mizubot-message.assistant .mizubot-message-meta {
    justify-content: flex-start;
}

.mizubot-processing-time {
    color: var(--teal, #588B8B); /* Theme color for processing time */
    font-weight: 500;
}

.mizubot-loading {
    padding: 20px; /* Increased padding for better spacing */
    border-top: 1px solid #d1d5db;
    background: #f5f5f5; /* Light gray background */
}

.mizubot-loading-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mizubot-loading-avatar {
    flex-shrink: 0;
    width: 28px; /* Consistent with message avatars */
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--purple, #735D78); /* Purple for loading avatar */
    color: white;
}

.mizubot-loading-message {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #d1d5db; /* Medium gray background */
    padding: 16px 20px; /* Increased padding to match message bubbles */
    border-radius: 18px;
    border-bottom-left-radius: 6px;
}

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

.mizubot-dot {
    width: 6px;
    height: 6px;
    background: var(--teal, #588B8B); /* Teal for loading dots */
    border-radius: 50%;
    animation: bounce-dot 1.4s infinite ease-in-out both;
}

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

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

@keyframes bounce-dot {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.mizubot-thinking-text {
    font-size: 14px;
    color: var(--teal, #588B8B); /* Teal for thinking text */
}

.mizubot-error {
    margin: 12px 20px; /* Increased margin for better spacing */
    padding: 16px; /* Increased padding */
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 12px; /* More rounded corners */
    color: #dc2626;
}

.mizubot-error-content {
    display: flex;
    align-items: flex-start;
    gap: 12px; /* Increased gap */
}

.mizubot-error-icon {
    flex-shrink: 0;
    margin-top: 2px;
}

.mizubot-error-text {
    flex: 1;
    margin: 0;
    font-size: 14px;
    line-height: 1.5; /* Better line height */
}

.mizubot-error-close {
    background: none;
    border: none;
    color: #dc2626;
    cursor: pointer;
    padding: 4px; /* Increased padding */
    border-radius: 4px;
    transition: background 0.2s ease;
}

.mizubot-error-close:hover {
    background: rgba(220, 38, 38, 0.1);
}

/* Input Area - Compact for more message space */
.mizubot-input-area {
    border-top: 1px solid #d1d5db;
    padding: 14px; /* Reduced padding for more compact input area */
    background: #f5f5f5; /* Light gray background */
}

.mizubot-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px; /* Reduced gap for more compact layout */
}

.mizubot-input {
    flex: 1;
    border: 2px solid #d1d5db; /* Thicker border for better definition */
    border-radius: 16px; /* More rounded corners */
    padding: 12px 16px; /* Reduced padding for more compact input */
    font-size: 14px;
    line-height: 1.4; /* Slightly tighter line height */
    resize: none;
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    background: white; /* White background for input */
    color: var(--dark, #011627); /* Force dark text matching theme */
    min-height: 42px; /* Reduced minimum height for more compact input */
    font-family: inherit;
}

.mizubot-input:focus {
    border-color: var(--teal, #588B8B); /* Teal for focus state */
    box-shadow: 0 0 0 3px rgba(88, 139, 139, 0.1); /* Teal-colored focus ring */
}

.mizubot-input:disabled {
    background: #f9fafb;
    color: #9ca3af;
    cursor: not-allowed;
}

.mizubot-input::placeholder {
    color: #9ca3af;
}

.mizubot-send-button {
    background: linear-gradient(135deg, var(--teal, #588B8B) 0%, var(--purple, #735D78) 100%); /* Teal to purple gradient */
    color: white;
    border: none;
    border-radius: 12px; /* More rounded corners */
    padding: 10px; /* Reduced padding for more compact design */
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 42px; /* Smaller sizing to match input */
    min-height: 42px;
}

.mizubot-send-button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(88, 139, 139, 0.3); /* Teal-colored shadow */
}

.mizubot-send-button:disabled {
    background: #d1d5db;
    color: #9ca3af;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mizubot-send-button.loading {
    pointer-events: none;
}

.mizubot-loading-icon {
    animation: spin 1s linear infinite;
}

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

.mizubot-input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px; /* Reduced margin for more compact footer */
    font-size: 11px; /* Smaller font for more compact design */
    color: #9ca3af;
}

.mizubot-input-hint {
    flex: 1;
}

.mizubot-char-count {
    color: #6b7280;
}

/* Scrollbar styling */
.mizubot-messages::-webkit-scrollbar {
    width: 6px;
}

.mizubot-messages::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.mizubot-messages::-webkit-scrollbar-thumb {
    background: var(--teal, #588B8B); /* Teal for scrollbar */
    border-radius: 3px;
}

.mizubot-messages::-webkit-scrollbar-thumb:hover {
    background: var(--purple, #735D78); /* Purple for hover state */
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .mizubot-chat-window {
        width: calc(100vw - 24px);
        height: calc(100vh - 120px);
        right: 12px;
        bottom: 80px;
    }

    .mizubot-greeting {
        width: calc(100vw - 48px);
        right: 12px;
    }

    .mizubot-chat-button {
        right: 12px;
        bottom: 12px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mizubot-chat-button {
        border: 2px solid white;
    }

    .mizubot-message-bubble {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .mizubot-chat-button,
    .mizubot-chat-window,
    .mizubot-greeting,
    .mizubot-button-content,
    .mizubot-button-icon,
    .mizubot-button-close-icon,
    .mizubot-send-button {
        transition: none;
    }

    .animate-bounce,
    .mizubot-notification-badge {
        animation: none;
    }
}

/* Additional text formatting styles for enhanced message readability */
.mizubot-message-content h1,
.mizubot-message-content h2,
.mizubot-message-content h3,
.mizubot-message-content h4,
.mizubot-message-content h5,
.mizubot-message-content h6 {
    font-family: 'Andada Pro', serif;
    font-weight: 600;
    color: var(--teal, #588B8B); /* Changed to teal for headings */
    margin: 16px 0 12px 0;
    line-height: 1.3;
}

.mizubot-message-content h1 { font-size: 20px; }
.mizubot-message-content h2 { font-size: 18px; }
.mizubot-message-content h3 { font-size: 16px; }
.mizubot-message-content h4 { font-size: 15px; }
.mizubot-message-content h5 { font-size: 14px; }
.mizubot-message-content h6 { font-size: 13px; }

/* Enhanced emphasis styles */
.mizubot-message-content em {
    font-style: italic;
    color: var(--purple, #735D78);
}

.mizubot-message-content del {
    text-decoration: line-through;
    color: #9ca3af;
}

/* Better link styling */
.mizubot-message-content a {
    color: var(--teal, #588B8B);
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.mizubot-message-content a:hover {
    color: var(--purple, #735D78);
    text-decoration: none;
}

/* Enhanced table styling for better data presentation */
.mizubot-message-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 12px 0;
    font-size: 13px;
}

.mizubot-message-content th,
.mizubot-message-content td {
    padding: 8px 12px;
    text-align: left;
    border-bottom: 1px solid #d1d5db;
}

.mizubot-message-content th {
    background-color: rgba(88, 139, 139, 0.1); /* Teal-based background */
    font-weight: 600;
    color: var(--teal, #588B8B);
}

.mizubot-message-content tr:nth-child(even) {
    background-color: rgba(88, 139, 139, 0.02); /* Teal-based background */
}

/* Better spacing for nested elements */
.mizubot-message-content li p {
    margin: 4px 0;
}

.mizubot-message-content li ul,
.mizubot-message-content li ol {
    margin: 8px 0 8px 16px;
}

/* Horizontal rule styling */
.mizubot-message-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, var(--teal, #588B8B), var(--purple, #735D78)); /* Teal to purple gradient */
    margin: 20px 0;
    border-radius: 1px;
} 