/* Shared CSS styles for Servanda */

/* ==================== Animations ==================== */

/* Typing indicator animation */
.typing-dots span {
    animation: blink 1.4s infinite both;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink {
    0%, 80%, 100% { opacity: 0; }
    40% { opacity: 1; }
}

/* Streaming loading animation - bouncing dots */
.streaming-loader {
    display: flex;
    align-items: center;
    gap: 4px;
}
.streaming-loader span {
    width: 8px;
    height: 8px;
    background-color: #6366f1;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}
.streaming-loader span:nth-child(1) { animation-delay: -0.32s; }
.streaming-loader span:nth-child(2) { animation-delay: -0.16s; }
.streaming-loader span:nth-child(3) { animation-delay: 0s; }
@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* Shimmer animation for research/loading indicators */
@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: 0% 0; }
}

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

/* Pulse animation */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

/* Message slide-in animation */
@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== Research/Ruling Indicators ==================== */

.research-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: linear-gradient(90deg, #eef2ff 0%, #e0e7ff 50%, #eef2ff 100%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 8px;
    font-size: 13px;
    color: #4338ca;
    margin: 8px 0;
}
.research-indicator svg {
    animation: spin 1.5s linear infinite;
}

/* Ruling mode styling */
.ruling-message {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-left: 4px solid #f59e0b;
}

.ruling-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(90deg, #fef3c7 0%, #fde68a 50%, #fef3c7 100%);
    background-size: 200% 100%;
    animation: shimmer 2s ease-in-out infinite;
    border-radius: 8px;
    border-left: 4px solid #f59e0b;
    font-size: 13px;
    color: #92400e;
    margin: 8px 0;
}

.judgment-indicator svg {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Ruling request banner */
.ruling-request-banner {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border-bottom: 1px solid #f59e0b;
    padding: 12px 16px;
    z-index: 40;
}

/* ==================== Party Colors ==================== */

:root {
    --party-color-0: #8b5cf6;  /* violet */
    --party-color-1: #06b6d4;  /* cyan */
    --party-color-2: #f59e0b;  /* amber */
    --party-color-3: #10b981;  /* emerald */
    --party-color-4: #ec4899;  /* pink */
    --party-color-5: #3b82f6;  /* blue */
    --party-color-6: #ef4444;  /* red */
    --party-color-7: #84cc16;  /* lime */
}

/* Party name colors in lists/headers */
.party-name-0 { color: var(--party-color-0); }
.party-name-1 { color: var(--party-color-1); }
.party-name-2 { color: var(--party-color-2); }
.party-name-3 { color: var(--party-color-3); }
.party-name-4 { color: var(--party-color-4); }
.party-name-5 { color: var(--party-color-5); }
.party-name-6 { color: var(--party-color-6); }
.party-name-7 { color: var(--party-color-7); }

/* ==================== @Mention Styling ==================== */

.mention {
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-weight: 500;
    white-space: nowrap;
}

/* Party-colored mentions */
.mention-party-0 { background: rgba(139, 92, 246, 0.15); color: #7c3aed; }
.mention-party-1 { background: rgba(6, 182, 212, 0.15); color: #0891b2; }
.mention-party-2 { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.mention-party-3 { background: rgba(16, 185, 129, 0.15); color: #059669; }
.mention-party-4 { background: rgba(236, 72, 153, 0.15); color: #db2777; }
.mention-party-5 { background: rgba(59, 130, 246, 0.15); color: #2563eb; }
.mention-party-6 { background: rgba(239, 68, 68, 0.15); color: #dc2626; }
.mention-party-7 { background: rgba(132, 204, 22, 0.15); color: #65a30d; }

/* Mention for "everyone" - uses indigo */
.mention-everyone { background: rgba(99, 102, 241, 0.15); color: #4f46e5; }

/* Highlight when mentioning current user */
.mention-me {
    font-weight: 600;
    box-shadow: 0 0 0 1px currentColor;
}

/* Mentions in own messages (dark blue background) */
.bg-blue-500 .mention {
    background: rgba(255, 255, 255, 0.25);
    color: white;
}
.bg-blue-500 .mention-me {
    background: rgba(255, 255, 255, 0.35);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.6);
}

/* Mention autocomplete dropdown */
.mention-autocomplete {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-bottom: 0.5rem;
    z-index: 50;
}
.mention-autocomplete-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.mention-autocomplete-item:hover,
.mention-autocomplete-item.selected {
    background: #f3f4f6;
}
.mention-autocomplete-item .mention-icon {
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #6b7280;
}
.mention-autocomplete-item .mention-icon.mediator {
    background: #c7d2fe;
    color: #4f46e5;
}

/* ==================== Message Styling ==================== */

.message-item {
    animation: messageSlideIn 0.2s ease-out forwards;
}

/* Skip animation for pre-loaded messages */
.message-item.no-animate {
    animation: none;
}

/* Optimistic message styling (slightly faded until confirmed) */
.message-item.sending .msg-bubble {
    opacity: 0.7;
}

/* ==================== Markdown Styling ==================== */

.markdown-content p { margin-bottom: 0.5rem; }
.markdown-content p:last-child { margin-bottom: 0; }
.markdown-content ul { margin: 0.5rem 0; padding-left: 1.25rem; list-style-type: disc; }
.markdown-content ol { margin: 0.5rem 0; padding-left: 1.25rem; list-style-type: decimal; }
.markdown-content li { margin-bottom: 0.25rem; display: list-item; }
.markdown-content strong { font-weight: 600; }
.markdown-content em { font-style: italic; }
.markdown-content h1, .markdown-content h2, .markdown-content h3 {
    font-weight: 600;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
}
.markdown-content h1:first-child, .markdown-content h2:first-child, .markdown-content h3:first-child {
    margin-top: 0;
}
.markdown-content h1 { font-size: 1.125rem; }
.markdown-content h2 { font-size: 1rem; }
.markdown-content h3 { font-size: 0.9375rem; }
.markdown-content code {
    background: rgba(0,0,0,0.1);
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-size: 0.875em;
}
.markdown-content pre {
    background: rgba(0,0,0,0.1);
    padding: 0.5rem;
    border-radius: 0.375rem;
    overflow-x: auto;
    margin: 0.5rem 0;
}
.markdown-content pre code {
    background: none;
    padding: 0;
}
.markdown-content blockquote {
    border-left: 3px solid currentColor;
    padding-left: 0.75rem;
    margin: 0.5rem 0;
    opacity: 0.8;
}
.markdown-content a {
    text-decoration: underline;
}
.markdown-content hr {
    border: none;
    border-top: 1px solid currentColor;
    opacity: 0.3;
    margin: 0.75rem 0;
}

/* ==================== Scroll Behavior ==================== */

/* Prevent scroll chaining to parent */
.scroll-contain {
    overscroll-behavior: contain;
}

/* ==================== Text Utilities ==================== */

/* Description collapsed state */
.description-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.description-expanded {
    display: block;
}

/* ==================== Subscription Badges ==================== */

.badge-plus {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.badge-pro {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    background: linear-gradient(135deg, #a855f7, #7c3aed);
    color: white;
}
