:root {
    --bg-color: #0d0f14;
    --sidebar-bg: rgba(20, 24, 33, 0.8);
    --card-bg: rgba(30, 35, 45, 0.6);
    --accent-color: #00d2ff;
    --accent-gradient: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    --text-primary: #ffffff;
    --text-secondary: #a0aec0;
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.8);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.hidden {
    display: none !important;
}

body {
    font-family: 'Outfit', 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    overflow: hidden;
    height: 100vh;
    display: flex;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

/* Background Animation */
.bg-blobs {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
    filter: blur(80px);
}

.blob {
    position: absolute;
    width: 40vw;
    height: 40vw;
    border-radius: 50%;
    background: var(--accent-gradient);
    opacity: 0.15;
    animation: move 20s infinite alternate;
}

.blob-1 { top: -10%; left: -10%; background: #00d2ff; }
.blob-2 { bottom: -10%; right: -10%; background: #3a7bd5; animation-delay: -5s; }

@keyframes move {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(10%, 10%) scale(1.1); }
}

/* Sidebar */
aside {
    width: 280px;
    height: 100vh;
    background: var(--sidebar-bg);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
    transition: var(--transition);
}

.logo-container {
    padding: 2rem;
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    background: var(--accent-gradient);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

nav {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    padding-left: 1rem;
    opacity: 0.6;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 4px;
    transition: var(--transition);
    border: 1px solid transparent;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--glass-border);
}

.nav-item.active {
    background: rgba(0, 210, 255, 0.1);
    border-color: rgba(0, 210, 255, 0.3);
}

.nav-item.active .item-icon {
    color: var(--accent-color);
}

.item-icon {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

.item-name {
    font-size: 0.95rem;
    font-weight: 500;
}

/* Main Content */
main {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
}

header {
    height: 70px;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
}

.header-title h2 {
    font-size: 1.2rem;
    font-weight: 600;
}

.header-stats {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 10px #4ade80;
}

/* Viewport Container */
.viewport-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Critical for scroll in flex containers */
    position: relative;
}

.iframe-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: relative;
}

iframe {
    width: 100%;
    height: calc(100% + 56px); /* Compensate for the top margin shift */
    margin-top: -56px; /* Hides the Taskade top navbar/branding */
    border: none;
    background: transparent;
}

/* Loading Overlay */
.loading-overlay {
    position: absolute;
    top: 70px; /* Header height */
    left: 0;
    width: 100%;
    height: calc(100% - 70px);
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 0.5s ease;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    margin-top: 1rem;
    color: var(--text-secondary);
    letter-spacing: 2px;
    font-size: 0.8rem;
    text-transform: uppercase;
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    overflow-y: auto;
    background: var(--bg-color);
}

.welcome-content {
    max-width: 800px;
    text-align: center;
}

.welcome-content h1 {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    line-height: 1.1;
}

.welcome-content p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
}

.btn-start {
    padding: 1rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 210, 255, 0.3);
    transition: var(--transition);
}

.btn-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(0, 210, 255, 0.4);
}

.grid-specialists {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-top: 4rem;
}

.spec-card {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    transition: var(--transition);
    cursor: pointer;
    text-align: left;
}

.spec-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--accent-color);
    transform: translateY(-5px);
}

.spec-card i {
    font-size: 2rem;
    color: var(--accent-color);
    margin-bottom: 1rem;
    display: block;
}

.spec-card h3 {
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.spec-card p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Hide Utility */
.hidden {
    opacity: 0;
    pointer-events: none;
}

/* --- RESPONSIVE DESIGN (MOBILE) --- */
@media (max-width: 768px) {
    html, body {
        height: 100vh;
        height: 100dvh;
        overflow: hidden;
    }

    body {
        flex-direction: row;
    }

    aside {
        position: fixed;
        left: -280px;
        top: 0;
        bottom: 0;
        width: 280px;
        height: 100%;
        z-index: 2000;
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    aside.mobile-active {
        transform: translateX(280px);
    }

    #mobile-toggle {
        display: block !important;
    }

    main {
        height: 100%;
        width: 100%;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    header {
        position: relative;
        z-index: 1500;
        background: var(--sidebar-bg);
        padding: 0 1rem;
        height: 60px;
        flex-shrink: 0;
    }

    .header-stats {
        display: none; 
    }

    .welcome-screen {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 2rem 1rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
    }

    .welcome-content h1 {
        font-size: 2.2rem;
    }

    .welcome-content p {
        font-size: 1rem;
        margin-bottom: 2rem;
    }

    .grid-specialists {
        grid-template-columns: repeat(auto-fill, minmax(100%, 1fr));
        gap: 12px;
        margin-top: 2rem;
        width: 100%;
        padding-bottom: 2rem;
    }

    .viewport-container#chat-workspace {
        flex: 1;
        height: 100% !important;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        position: relative;
        top: 0 !important;
        left: 0;
        width: 100%;
        z-index: 10;
    }

    #chat-messages {
        flex: 1;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch;
        padding: 1rem;
    }

    .chat-bubble {
        max-width: 88% !important;
        padding: 12px 16px;
        font-size: 0.9rem;
    }

    #chat-workspace > div:last-child {
        padding: 12px !important;
    }
}

/* Sidebar Overlay for Mobile */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
}

.sidebar-overlay.active {
    display: block;
}

/* ==========================================================================
   PREMIUM CHAT BUBBLE SYSTEM (LUB-TEK UX)
   ========================================================================== */

/* Custom scrollbar for chat messages area */
#chat-messages::-webkit-scrollbar {
    width: 6px;
}
#chat-messages::-webkit-scrollbar-track {
    background: transparent;
}
#chat-messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
#chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chat-bubble-container {
    display: flex;
    flex-direction: column;
    margin-bottom: 0.8rem;
    width: 100%;
    animation: slideUpFade 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-bubble {
    padding: 14px 20px;
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 75%;
    word-wrap: break-word;
    white-space: pre-wrap;
    position: relative;
    backdrop-filter: blur(10px);
}

/* User Message Bubble */
.chat-bubble-container.user {
    align-items: flex-end;
}
.chat-bubble-container.user .chat-bubble {
    align-self: flex-end;
    background: rgba(0, 210, 255, 0.12);
    border: 1px solid rgba(0, 210, 255, 0.25);
    border-radius: 18px 18px 4px 18px;
    color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 210, 255, 0.05);
}

/* AI Message Bubble */
.chat-bubble-container.ai {
    align-items: flex-start;
}
.chat-bubble-container.ai .chat-bubble {
    align-self: flex-start;
    background: rgba(30, 35, 45, 0.7);
    border: 1px solid var(--glass-border);
    border-radius: 18px 18px 18px 4px;
    color: var(--text-primary);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Premium Document Attachment Card (Matches user reference image) */
.file-attachment-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 18, 25, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 16px;
    margin-bottom: 8px;
    width: fit-content;
    min-width: 200px;
    max-width: 320px;
    cursor: pointer;
    transition: var(--transition);
}

.file-attachment-card:hover {
    background: rgba(20, 25, 35, 0.95);
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 210, 255, 0.15);
}

.file-card-icon {
    font-size: 1.8rem;
    color: var(--accent-color);
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-card-info {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-card-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-card-meta {
    font-size: 0.7rem;
    color: var(--text-secondary);
    opacity: 0.7;
    margin-top: 2px;
}

/* Selected File Preview Pill (above input bar) */
.file-preview-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(30, 35, 45, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    padding: 6px 12px;
    font-size: 0.8rem;
    color: #ffffff;
    backdrop-filter: blur(10px);
    animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
    from { transform: scale(0.9); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.file-preview-pill i:first-child {
    font-size: 1rem;
    color: var(--accent-color);
}

.file-preview-remove {
    cursor: pointer;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    transition: 0.2s;
    border-radius: 50%;
    padding: 2px;
}

.file-preview-remove:hover {
    color: #ff5555;
    background: rgba(255, 85, 85, 0.1);
}

/* Typing Indicator Dots */
.typing-loader {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 10px;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background: var(--accent-color);
    border-radius: 50%;
    animation: typingPulse 1.2s infinite ease-in-out;
    opacity: 0.4;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingPulse {
    0%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    50% {
        transform: translateY(-5px);
        opacity: 1;
    }
}

/* ==========================================================================
   PREMIUM REPORT GENERATOR STYLES
   ========================================================================== */

/* Premium AI Report Container inside chat bubbles */
.report-container {
    background: rgba(15, 23, 42, 0.6);
    border: 1px dashed rgba(0, 210, 255, 0.25);
    border-left: 4px solid var(--accent-color);
    border-radius: 12px;
    padding: 16px 20px;
    margin: 12px 0;
    width: 100%;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.report-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.report-header i {
    font-size: 1.3rem;
}

/* Premium Download Report Button */
.download-report-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--accent-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 210, 255, 0.2);
}

.download-report-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 210, 255, 0.35);
}

.download-report-btn:active {
    transform: translateY(0);
}

/* Nova Conversa Button in Header */
.new-chat-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: rgba(255, 85, 85, 0.12);
    border: 1px solid rgba(255, 85, 85, 0.3);
    border-radius: 8px;
    color: #ff6b6b;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.new-chat-btn:hover {
    background: rgba(255, 85, 85, 0.25);
    border-color: rgba(255, 85, 85, 0.5);
    transform: translateY(-1px);
}

.new-chat-btn:active {
    transform: translateY(0);
}

/* Permitir seleção de texto onde faz sentido */
.chat-bubble,
.report-container,
.sap-container,
input,
textarea,
pre,
code,
td,
th {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}

/* Botão premium de cópia rápida no canto superior direito das bolhas do chat */
.copy-msg-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.2s, color 0.2s;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.chat-bubble:hover .copy-msg-btn,
.copy-msg-btn:focus-within {
    opacity: 1;
}

.copy-msg-btn:hover {
    color: var(--accent-color);
    background: rgba(255, 255, 255, 0.05);
}

@media (max-width: 768px) {
    .copy-msg-btn {
        opacity: 0.7; /* Sempre visível ou facilmente acessível no mobile */
    }
}


