/* SuperrrAI Animations - Theatre & Visual Effects */

/* Smooth progress bar transitions */
.progress-bar {
    transition: width 0.3s ease-out;
}

/* Pulse effect while streaming */
@keyframes pulse-border {
    0%, 100% {
        border-color: rgba(59, 130, 246, 0.2);
    }
    50% {
        border-color: rgba(59, 130, 246, 0.5);
    }
}

.streaming-active {
    animation: pulse-border 2s ease-in-out infinite;
}

/* Glow when model completes */
.model-complete {
    box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
    transition: box-shadow 0.5s ease;
}

/* Highlight flash-in effect */
@keyframes highlight-flash {
    0% {
        background-color: transparent;
    }
    50% {
        opacity: 0.3;
    }
    100% {
        opacity: 1;
    }
}

.highlight-new {
    animation: highlight-flash 0.6s ease;
}

/* Text cursor effect while streaming */
@keyframes blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0;
    }
}

.streaming-cursor::after {
    content: '▋';
    animation: blink 1s step-end infinite;
    color: #135bec;
}

/* Status text fade transitions */
.status-text {
    transition: opacity 0.2s ease;
}

/* Progress bar fade out */
.progress-fade {
    opacity: 0;
    transition: opacity 1s ease;
}

/* Typing indicator */
.typing-indicator {
    display: inline-flex;
    gap: 4px;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background: #135bec;
    border-radius: 50%;
    animation: typing-bounce 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-bounce {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Smooth scroll */
.smooth-scroll {
    scroll-behavior: smooth;
}

/* Fade in animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

/* Tooltip styling for mode selector and web access button */
.mode-button-wrapper,
.web-access-wrapper {
    position: relative;
}

.mode-button-wrapper .tooltip,
.web-access-wrapper .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 12px;
    background-color: rgba(17, 23, 34, 0.95);
    color: white;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
    border-radius: 6px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tooltip arrow */
.mode-button-wrapper .tooltip::after,
.web-access-wrapper .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: rgba(17, 23, 34, 0.95);
}

/* Show on hover */
.mode-button-wrapper:hover .tooltip,
.web-access-wrapper:hover .tooltip {
    opacity: 1;
    transform: translateX(-50%) translateY(-4px);
}

/* Light mode tooltip */
.light .mode-button-wrapper .tooltip,
.light .web-access-wrapper .tooltip {
    background-color: rgba(31, 41, 55, 0.95);
}

.light .mode-button-wrapper .tooltip::after,
.light .web-access-wrapper .tooltip::after {
    border-top-color: rgba(31, 41, 55, 0.95);
}

/* Markdown content styling */
.markdown-content p {
    margin-bottom: 0.75em;
}

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

.markdown-content strong {
    font-weight: 700;
    color: inherit;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content a {
    color: #135bec;
    text-decoration: underline;
    transition: opacity 0.2s;
}

.markdown-content a:hover {
    opacity: 0.8;
}

.dark .markdown-content a {
    color: #5b9bff;
}

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

.markdown-content li {
    margin: 0.25em 0;
}

.markdown-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.dark .markdown-content code {
    background-color: rgba(255, 255, 255, 0.1);
}

.markdown-content pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 1em;
    border-radius: 6px;
    overflow-x: auto;
    margin: 0.75em 0;
}

.dark .markdown-content pre {
    background-color: rgba(255, 255, 255, 0.05);
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 3px solid #e5e7eb;
    padding-left: 1em;
    margin: 0.75em 0;
    color: #6b7280;
}

.dark .markdown-content blockquote {
    border-left-color: #374151;
    color: #9ca3af;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-weight: 700;
    margin-top: 1em;
    margin-bottom: 0.5em;
    line-height: 1.3;
}

.markdown-content h1 { font-size: 1.5em; }
.markdown-content h2 { font-size: 1.3em; }
.markdown-content h3 { font-size: 1.15em; }
.markdown-content h4 { font-size: 1em; }
.markdown-content h5 { font-size: 0.9em; }
.markdown-content h6 { font-size: 0.85em; }

/* Sidebar base styles - prevent shrinking when visible */
#left-sidebar,
#right-sidebar {
    flex-shrink: 0;
}

/* Status indicator lights for AI Sources */
.status-light {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(107, 114, 128, 0.4);
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.status-light.initiating {
    background: #8b5cf6;
    animation: pulse-light 0.6s ease-in-out infinite;
}

.status-light.streaming {
    background: #135bec;
    animation: pulse-light 0.3s ease-in-out infinite;
}

.status-light.complete {
    background: #22c55e;
    animation: none;
}

.status-light.error {
    background: #ef4444;
    animation: none;
}

@keyframes pulse-light {
    0%, 100% {
        opacity: 0.4;
        transform: scale(0.9);
    }
    50% {
        opacity: 1;
        transform: scale(1.1);
    }
}

/* Position badges for finish order */
.position-badge {
    font-size: 14px;
    line-height: 1;
    min-width: 18px;
    text-align: center;
    opacity: 0;
    transform: scale(0);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.position-badge.visible {
    opacity: 1;
    transform: scale(1);
}

@keyframes badge-pop {
    0% { transform: scale(0); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.position-badge.pop {
    animation: badge-pop 0.4s ease-out;
}

/* Model select dropdowns in RHS cards */
select.model-select {
    width: fit-content;
    min-width: 140px;
    appearance: none;
    -webkit-appearance: none;
    background-color: rgba(0, 0, 0, 0.05);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding: 6px 28px 6px 10px;
    border-radius: 6px;
    height: 32px;
    line-height: 20px;
    font-weight: 600;
    font-size: 13px;
    color: #374151 !important;
    margin-bottom: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    text-overflow: ellipsis;
    overflow: visible;
}

.dark select.model-select {
    background-color: rgba(255, 255, 255, 0.08);
    color: #f3f4f6 !important;
    border-color: rgba(255, 255, 255, 0.15);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

select.model-select option {
    background-color: #1f2937;
    color: #f3f4f6;
}

/* Sidebar Collapsible Functionality */
#right-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    opacity: 0;
}

/* Desktop left sidebar collapse */
#left-sidebar.collapsed {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden;
    opacity: 0;
}

#left-sidebar.collapsed-mobile {
    transform: translateX(-100%);
}

/* Floating Action Button for Left Sidebar (Mobile) */
#show-left-sidebar {
    position: fixed;
    bottom: 24px;
    left: 16px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#show-left-sidebar:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

#show-left-sidebar:active {
    transform: scale(0.95);
}

/* Sidebar overlay for mobile */
#sidebar-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.show {
    opacity: 1;
    pointer-events: all;
}
