:root {
    --sidebar-bg: #2c3e50;
    --sidebar-text: #ecf0f1;
    --sidebar-active-bg: #3498db;
    --main-bg: #f0f2f5;
    --container-bg: #ffffff;
    --primary-text: #2c3e50;
    --secondary-text: #5D6C7B;
    --border-color: #dfe4ea;
    --success-bg: #C4F8B9;
    --success-text: #09441F;
    --stopped-bg: #E6EBEF;
    --stopped-text: #445664;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    background-color: var(--main-bg);
    color: var(--primary-text);
}

.main-container {
    display: flex;
    height: 100vh;
}

/* --- SIDEBAR --- */
.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-header {
    padding: 20px;
    font-size: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.menu-item a, .menu-item {
    color: var(--sidebar-text);
    text-decoration: none;
    display: flex;
    align-items: center;
    width: 100%;
    background: none;
    border: none;
    font-size: 16px;
    font-family: inherit;
    text-align: left;
}

.menu-item.active, .menu-item:hover {
    background-color: var(--sidebar-active-bg);
}

.menu-item i {
    margin-right: 15px;
}

.sidebar-footer {
    padding: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

#logout-btn {
  padding: 15px 10px;
}

/* --- CONTEÚDO PRINCIPAL --- */
.main-content {
    flex-grow: 1;
    padding: 30px;
    overflow-y: auto;
}

.main-header h1 {
    color: var(--primary-text);
    margin-top: 0;
    margin-bottom: 20px;
}

.content-area {
    background-color: var(--container-bg);
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* --- ESTILOS ANTIGOS INTEGRADOS --- */
.toolbar {
    margin-bottom: 20px;
}

#add-new-bot-btn {
    background-color: #147B29;
    color: white;
    padding: 10px 15px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
}

#add-new-bot-btn:hover {
    background-color: #116823;
}

.bot-list-header, .bot-item {
    display: grid;
    grid-template-columns: 2fr 2fr 1fr 3fr;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
}

.bot-list-container .bot-item:last-child {
    border-bottom: none;
}

.bot-list-header {
    font-weight: bold;
    color: var(--secondary-text);
}

.bot-item .status {
    padding: 4px 8px;
    border-radius: 12px;
    text-align: center;
    font-size: 12px;
    font-weight: bold;
}

.bot-item .status.running {
    background-color: var(--success-bg);
    color: var(--success-text);
}

.bot-item .status.errored {
    background-color: #FEE4E6;
    color: #7B0210;
}

.bot-item .status.stopped {
    background-color: var(--stopped-bg);
    color: var(--stopped-text);
}

.bot-item .actions button {
    margin-right: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid #ccc;
    cursor: pointer;
    background-color: #f0f2f5;
    transition: background-color 0.2s, border-color 0.2s;
}

.bot-item .actions button:hover {
    background-color: #e4e6eb;
}

.bot-item .actions button.start-btn { color: #147B29; border-color: #147B29; }
.bot-item .actions button.stop-btn { color: #D31130; border-color: #D31130; }
.bot-item .actions button.delete-btn { color: #5D6C7B; }

/* --- ESTILOS DOS MODAIS (FORMULÁRIO E QR CODE) --- */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 20px 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

#bot-form {
    display: flex;
    flex-direction: column;
}

#bot-form label {
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: bold;
    color: #333;
}

#bot-form input,
#bot-form textarea {
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    font-size: 16px;
}

#bot-form input:focus,
#bot-form textarea:focus {
    border-color: #0064E0;
    outline: none;
}

.form-buttons {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
}

.form-buttons button {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    margin-left: 10px;
}

.form-buttons button[type="submit"] {
    background-color: #147B29;
    color: white;
}

.form-buttons button[type="button"] {
    background-color: #E6EBEF;
}

.qr-modal-content {
    text-align: center;
    max-width: 400px;
}
#qr-image {
    width: 100%;
    max-width: 300px;
    height: auto;
    border: 1px solid #ddd;
    margin-top: 10px;
}
#qr-status {
    margin-top: 15px;
    font-style: italic;
    color: var(--secondary-text);
}

/* --- Novos Estilos para o Rodapé da Sidebar --- */
.sidebar-footer {
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.user-info {
    display: flex;
    align-items: center;
}

.user-info i {
    margin-right: 10px;
}

#logout-btn {
    background: none;
    border: none;
    color: var(--sidebar-text);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.2s;
}

#logout-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* --- Estilos para o Painel de Estatísticas --- */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
}

.stat-card {
    background-color: var(--container-bg);
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.stat-icon-wrapper {
    padding: 15px;
    border-radius: 50%;
    margin-right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon-wrapper i {
    width: 28px;
    height: 28px;
    color: #fff;
}

.stat-card.bots-total .stat-icon-wrapper { background-color: #3498db; }
.stat-card.bots-active .stat-icon-wrapper { background-color: #2ecc71; }
.stat-card.bots-stopped .stat-icon-wrapper { background-color: #e74c3c; }

.stat-info p {
    margin: 0;
    color: var(--secondary-text);
    font-size: 14px;
}

.stat-info h2 {
    margin: 5px 0 0 0;
    color: var(--primary-text);
    font-size: 28px;
}

/* Estilo para o novo botão de logs */
.bot-item .actions button.logs-btn {
    color: #3498db; /* Azul */
    border-color: #3498db;
}