/* MUH-GPT Professional Theme - Default */
/* This theme provides a clean, modern, and professional appearance */

:root {
    /* Primary Brand Colors */
    --primary-red: #DC2626;
    --primary-red-hover: #B91C1C;
    --primary-red-light: #EF4444;

    /* Background Colors */
    --dark-bg: #0A0A0A;
    --darker-bg: #050505;
    --surface-dark: #1A1A1A;
    --surface-lighter: #2A2A2A;

    /* Text Colors */
    --text-primary: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-muted: #6B7280;

    /* Border & Accent */
    --border-dark: #2D2D2D;
    --success: #10B981;
    --warning: #F59E0B;
    --info: #3B82F6;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 12px 32px rgba(0, 0, 0, 0.25);

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* Professional Enhancements */
body {
    font-feature-settings: 'liga' 1, 'calt' 1;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Enhanced Scrollbar */
::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

::-webkit-scrollbar-track {
    background: var(--surface-dark);
    border-radius: 6px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-dark);
    border-radius: 6px;
    border: 2px solid var(--surface-dark);
    transition: background var(--transition-normal);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-red);
}

/* Selection Colors */
::selection {
    background-color: var(--primary-red);
    color: white;
}

::-moz-selection {
    background-color: var(--primary-red);
    color: white;
}

/* Focus Styles */
*:focus-visible {
    outline: 2px solid var(--primary-red);
    outline-offset: 2px;
}

/* Professional Button Styles */
button {
    font-family: inherit;
    cursor: pointer;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Link Styles */
a {
    color: var(--primary-red);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-red-hover);
}

/* Professional Card/Container Styles */
.card {
    background: var(--surface-dark);
    border: 1px solid var(--border-dark);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow-md);
}

/* Animation Utilities */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Professional Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

p {
    line-height: 1.7;
    margin: 0;
}

/* Code Block Professional Styling */
code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
}

pre {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace;
    line-height: 1.6;
}

/* ============================================
   🚀 STREAMING STYLES - Resposta em tempo real
   ============================================ */

/* Mensagem durante streaming */
.message.streaming .message-bubble {
    position: relative;
}

.message.streaming .streaming-text::after {
    content: '▋';
    display: inline;
    animation: blink-cursor 0.8s steps(1) infinite;
    color: var(--primary-red);
    font-weight: bold;
    margin-left: 2px;
}

@keyframes blink-cursor {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0;
    }
}

/* Efeito de brilho sutil durante streaming */
.message.streaming .message-bubble {
    animation: streaming-glow 2s ease-in-out infinite;
}

@keyframes streaming-glow {

    0%,
    100% {
        box-shadow: 0 0 5px rgba(220, 38, 38, 0.1);
    }

    50% {
        box-shadow: 0 0 15px rgba(220, 38, 38, 0.2);
    }
}

/* Indicador de streaming no avatar */
.message.streaming .avatar.bot {
    position: relative;
}

.message.streaming .avatar.bot::after {
    content: '';
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
    border: 2px solid var(--surface-dark);
}

/* Transição suave quando streaming termina */
.message .message-bubble {
    transition: box-shadow 0.3s ease;
}

/* Melhorias no código durante streaming */
.message.streaming pre,
.message.streaming code {
    opacity: 0.95;
}

/* ============================================
   🛑 STOP BUTTON STYLING
   ============================================ */

/* Botão Stop (quando está em streaming) */
button.stop-btn {
    background: linear-gradient(135deg, #DC2626 0%, #B91C1C 100%) !important;
    animation: pulse-stop 1.5s ease-in-out infinite;
}

button.stop-btn:hover {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%) !important;
    transform: scale(1.05);
}

@keyframes pulse-stop {

    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }

    50% {
        box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
    }
}

/* Indicador de resposta interrompida */
.stream-stopped {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 6px 12px;
    background: rgba(220, 38, 38, 0.15);
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 6px;
    color: #EF4444;
    font-size: 0.8rem;
    font-style: italic;
}

.stream-stopped i {
    font-size: 0.9rem;
}


/* ============================================
   💻 CODE BLOCK BUTTONS STYLING - PREMIUM
   ============================================ */

/* Footer do bloco de código (Sleek Toolbar) */
.code-block-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #111;
    /* Dark solid foundation */
    border-radius: 8px 8px 0 0;
    /* Top rounded */
    padding: 8px 12px;
    margin-bottom: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    /* Subtle separator */
    flex-wrap: nowrap;
    /* Prevent wrapping generally */
    gap: 12px;
    position: relative;
    overflow: hidden;
}

/* Label da linguagem */
.code-lang-label {
    color: #888;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    display: flex;
    align-items: center;
    gap: 6px;
    background: transparent;
    padding: 0;
    border: none;
    opacity: 0.8;
}

.code-lang-label i {
    color: #6d6d6d;
    /* Neutral icon color */
    font-size: 0.8rem;
}

/* Container dos botões de ação */
.code-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

/* Estilo base dos botões (Minimalist) */
.code-btn {
    background: transparent;
    border: 1px solid transparent;
    /* Hidden border by default */
    color: #777;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.7rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    height: 28px;
    white-space: nowrap;
}

.code-btn i {
    font-size: 0.85rem;
}

/* Hover Effects */
.code-btn:hover {
    background: rgba(255, 255, 255, 0.04);
    color: #eee;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Specific Button Colors on Hover */
.code-btn.download-btn:hover {
    color: #4ade80;
    /* Brighter Green */
    background: rgba(74, 222, 128, 0.08);
    border-color: rgba(74, 222, 128, 0.2);
    box-shadow: none;
    /* No heavy shadow */
}

.code-btn.copy-btn:hover {
    color: #60a5fa;
    /* Brighter Blue */
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.2);
    box-shadow: none;
}

.code-btn.edit-ai-btn:hover {
    color: #c084fc;
    /* Brighter Purple */
    background: rgba(192, 132, 252, 0.08);
    border-color: rgba(192, 132, 252, 0.2);
    box-shadow: none;
}

/* Active/Success State for Copy */
.code-btn.copy-btn.success {
    color: #4ade80 !important;
    border-color: #4ade80 !important;
}

/* Code block container */
pre.code-block {
    border-radius: 8px !important;
    /* Rounded container */
    margin-bottom: 1.5rem !important;
    position: relative;
    background: #0d0d0d !important;
    border: 1px solid rgba(255, 255, 255, 0.05);
    overflow: hidden;
}

pre.code-block code {
    border-radius: 0 0 8px 8px !important;
    /* Bottom rounded */
    padding: 16px !important;
    font-family: 'Fira Code', 'Consolas', monospace;
    font-size: 0.9rem;
    display: block;
}

/* Responsivo para mobile */
/* Responsivo para mobile */
@media (max-width: 550px) {
    .code-block-header {
        padding: 8px 10px;
        flex-direction: row;
        /* Keep horizontal */
        justify-content: space-between;
    }

    /* Hide text on small screens, show only icons to save space */
    .code-btn span,
    .code-btn:not(:hover)::after {
        /* Assuming text might be in span or direct text node, but usually buttons have text inside. JavaScript adds text directly. */
        display: none;
    }

    /* Force text hidden if it's a text node mixed with icon by setting font-size 0 for button but restoring for icon */
    .code-btn {
        padding: 6px;
        width: 32px;
        justify-content: center;
        font-size: 0;
        /* Hide text */
    }

    .code-btn i {
        font-size: 1rem;
        margin: 0;
    }
}

/* ============================================
   🎨 EDIT WITH AI MODAL STYLING
   ============================================ */

.edit-ai-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.edit-ai-modal {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    width: 90%;
    max-width: 600px;
    max-height: 80vh;
    overflow: auto;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(168, 85, 247, 0.3);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.edit-ai-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(168, 85, 247, 0.1);
}

.edit-ai-header h3 {
    margin: 0;
    color: #fff;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-ai-header h3 i {
    color: #a855f7;
}

.edit-ai-header .close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px;
    transition: color 0.2s;
}

.edit-ai-header .close-btn:hover {
    color: #fff;
}

.edit-ai-body {
    padding: 20px;
}

.edit-ai-body textarea {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #fff;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.edit-ai-body textarea:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.edit-ai-body textarea::placeholder {
    color: #666;
}

.edit-ai-preview {
    margin-top: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    padding: 12px;
    max-height: 200px;
    overflow: auto;
}

.edit-ai-preview strong {
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.edit-ai-preview pre {
    margin: 10px 0 0 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 6px;
    font-size: 0.8rem;
    overflow-x: auto;
}

.edit-ai-preview code {
    color: #e0e0e0;
}

.edit-ai-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.2);
}

.edit-ai-footer .cancel-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #888;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.edit-ai-footer .cancel-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

.edit-ai-footer .submit-btn {
    background: linear-gradient(135deg, #a855f7 0%, #8b5cf6 100%);
    border: none;
    color: #fff;
    padding: 10px 24px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.edit-ai-footer .submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 20px rgba(168, 85, 247, 0.4);
}

/* Light mode adjustments */
body.light .code-block-header {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

body.light .code-lang-label {
    color: #6b7280;
}

body.light .code-btn {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.1);
    color: #4b5563;
}

body.light .code-btn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #1f2937;
}