:root {
    --primary-color: #6c5ce7;
    --secondary-color: #a29bfe;
    --bg-color: #f8f9fa;
    --sidebar-bg: linear-gradient(180deg, #6c5ce7 0%, #4834d4 100%);
    --text-color: #2d3436;
    --white: #ffffff;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --border-color: #ddd;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100%;
}

.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--white);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-shadow: var(--shadow);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 40px;
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    padding: 5px;
}

.brand-name {
    font-size: 1.5rem;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.nav-item {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 12px 15px;
    text-align: left;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-item:hover, .nav-item.active {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

.main-content {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
    position: relative;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: background 0.3s;
}

.btn-primary:hover {
    background-color: #5a4acf;
}

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card h3 {
    margin-bottom: 15px;
    font-size: 1.1rem;
    color: var(--primary-color);
}

/* OPS Grid */
.ops-grid, .config-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.list-container {
    min-height: 100px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
}

.empty-msg {
    color: #999;
    text-align: center;
    padding: 20px;
}

.diag-buttons {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.btn-diag {
    flex: 1;
    padding: 10px;
    border: 1px solid var(--primary-color);
    background: transparent;
    color: var(--primary-color);
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.btn-diag:hover {
    background: var(--primary-color);
    color: var(--white);
}

.terminal-output {
    background: #2d3436;
    color: #00b894;
    padding: 15px;
    border-radius: 8px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9rem;
    min-height: 150px;
    overflow-y: auto;
}

/* Config Forms */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    outline: none;
}

.prompt-area {
    height: 150px;
    resize: none;
}

.input-with-icon {
    display: flex;
    gap: 10px;
}

.btn-icon-save {
    background: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    border-radius: 8px;
    cursor: pointer;
}

.status-msg {
    display: block;
    margin-top: 5px;
    color: #636e72;
}

/* Chat Window */
.chat-window {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    flex-direction: column;
    padding: 20px;
    z-index: 10;
}

.chat-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.message {
    max-width: 80%;
    padding: 12px 18px;
    border-radius: 15px;
    line-height: 1.5;
}

.message.user {
    align-self: flex-end;
    background-color: var(--primary-color);
    color: var(--white);
    border-bottom-right-radius: 2px;
}

.message.ai {
    align-self: flex-start;
    background-color: #e9ecef;
    color: var(--text-color);
    border-bottom-left-radius: 2px;
    overflow-x: auto;
}

.message.ai h1, .message.ai h2, .message.ai h3 {
    margin: 10px 0;
    font-size: 1.1rem;
}

.message.ai p {
    margin-bottom: 10px;
}

.message.ai code {
    background: #dfe4ea;
    padding: 2px 5px;
    border-radius: 4px;
    font-family: monospace;
}

.message.ai pre {
    background: #2d3436;
    color: #00b894;
    padding: 15px;
    border-radius: 8px;
    margin: 10px 0;
    overflow-x: auto;
}

.message.ai table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.message.ai th, .message.ai td {
    border: 1px solid #ccc;
    padding: 8px;
    text-align: left;
}

.message.ai th {
    background: #f1f2f6;
}

.chat-input-container {
    display: flex;
    gap: 10px;
    padding-top: 20px;
}

textarea {
    flex: 1;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    resize: none;
    height: 50px;
    outline: none;
}

.btn-send {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.hidden {
    display: none !important;
}

/* Indicadores de Processamento */
.thinking-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    background: #f1f2f6;
    border-radius: 10px;
    width: fit-content;
    margin-bottom: 10px;
}

.thinking-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: #57606f;
}

.pulse {
    animation: pulse-animation 1.5s infinite;
}

@keyframes pulse-animation {
    0% { opacity: 0.5; }
    50% { opacity: 1; }
    100% { opacity: 0.5; }
}

/* Responsividade Mobile */
.mobile-only {
    display: none;
}

@media (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        height: 100%;
        z-index: 1000;
        transition: left 0.3s ease;
    }

    .sidebar.open {
        left: 0;
    }

    #mobile-menu-btn {
        position: fixed;
        top: 15px;
        left: 15px;
        z-index: 900;
        background: var(--primary-color);
        color: white;
        padding: 10px;
        border-radius: 8px;
        border: none;
    }

    #close-menu-btn {
        align-self: flex-end;
        margin-bottom: 20px;
        background: transparent;
        color: white;
        border: none;
        font-size: 1.5rem;
    }

    .main-content {
        padding: 60px 15px 20px 15px;
    }

    .ops-grid, .config-grid {
        grid-template-columns: 1fr;
    }

    .message {
        max-width: 90%;
    }

    .chat-window {
        padding: 10px;
    }

    .chat-header {
        padding-top: 40px;
    }

    /* Ajuste para tabelas e código no mobile */
    .message.ai table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .message.ai pre {
        font-size: 0.8rem;
        padding: 10px;
    }

    .btn-diag {
        font-size: 0.8rem;
        padding: 8px 5px;
    }
}
