body {Add commentMore actions
 font-family: 'Segoe UI', sans-serif;
 background-color: #f0f2f5;

 margin: 0;
 padding: 0;
}


.container {
 max-width: 900px;
 margin: auto;
 padding: 20px;
}


.header {
 margin-bottom: 20px;
}

h1 {
 text-align: center;
 color: #333;
 margin-bottom: 15px;

}


.status-bar {
 display: flex;
 justify-content: space-between;
 align-items: center;
 background: #fff;
 padding: 10px 15px;
 border-radius: 8px;
 box-shadow: 0 1px 5px rgba(0,0,0,0.1);
 margin-bottom: 10px;
}

#status-info {
 display: flex;
 gap: 15px;
 font-size: 14px;
 color: #666;
}

#data-status {
 font-weight: 500;
}

#record-count {
 color: #28a745;
}


.control-buttons {
 display: flex;
 gap: 8px;
}

.control-btn {
 padding: 6px 12px;
 font-size: 12px;
 background-color: #6c757d;
 color: white;
 border: none;
 border-radius: 4px;
 cursor: pointer;
 transition: background-color 0.2s;
}

.control-btn:hover {
 background-color: #5a6268;

}

.control-btn:disabled {
 background-color: #ccc;
 cursor: not-allowed;
}

/* Background Section Styles */
.background-section {
 background: #fff;
 padding: 20px;
 border-radius: 8px;
 box-shadow: 0 2px 10px rgba(0,0,0,0.1);
 margin-bottom: 20px;
 border-left: 4px solid #007bff;












}

.background-header {
 display: flex;
 justify-content: space-between;
 align-items: center;
 margin-bottom: 15px;
}

.background-header h3 {
 margin: 0;
 color: #333;
 font-size: 18px;
}

.background-controls {
 display: flex;
 gap: 8px;
}


.edit-btn, .save-btn, .cancel-btn, .reset-btn {
 padding: 5px 10px;
 font-size: 11px;
 border: none;
 border-radius: 3px;
 cursor: pointer;
 transition: background-color 0.2s;
}

.edit-btn {
 background-color: #17a2b8;
 color: white;
}

.edit-btn:hover {
 background-color: #138496;
}

.save-btn {
 background-color: #28a745;
 color: white;
}

.save-btn:hover {
 background-color: #218838;
}

.cancel-btn {
 background-color: #6c757d;
 color: white;
}

.cancel-btn:hover {
 background-color: #5a6268;
}

.reset-btn {
 background-color: #ffc107;
 color: #212529;
}

.reset-btn:hover {
 background-color: #e0a800;
}


.background-display {
 background: #f8f9fa;
 padding: 15px;
 border-radius: 5px;
 border: 1px solid #dee2e6;
 line-height: 1.6;
 color: #495057;
 white-space: pre-wrap;
 min-height: 100px;
}

.background-editor {
 width: 100%;
 min-height: 120px;
 padding: 15px;
 border: 2px solid #007bff;
 border-radius: 5px;
 font-family: inherit;
 font-size: 14px;
 line-height: 1.6;
 resize: vertical;
 outline: none;
}

.background-editor:focus {
 border-color: #0056b3;
 box-shadow: 0 0 0 0.2rem rgba(0,123,255,.25);
}

.background-info {
 display: flex;
 justify-content: space-between;
 align-items: center;
 margin-top: 10px;
 font-size: 12px;
 color: #6c757d;
}

#background-status {
 font-weight: 500;
}

#character-count {
 color: #28a745;
}

.character-warning {
 color: #ffc107 !important;
}

.character-error {
 color: #dc3545 !important;
}


#chat-box {
 background: #fff;
 padding: 20px;
 border-radius: 8px;
 box-shadow: 0 2px 10px rgba(0,0,0,0.1);
 max-height: 600px;
 overflow-y: auto;
 margin-bottom: 20px;
}


.chat-message {
 margin-bottom: 20px;
 display: flex;












}

.user {
 justify-content: flex-end;
}

.bot {
 justify-content: flex-start;
}


.bubble {
 padding: 10px 15px;
 border-radius: 16px;
 max-width: 70%;
 line-height: 1.4;
 white-space: pre-wrap;
}

.user .bubble {
 background-color: #007bff;
 color: white;
 border-bottom-right-radius: 0;
}

.bot .bubble {
 background-color: #e9ecef;
 color: black;
 border-bottom-left-radius: 0;
}


.system-message {
 background-color: #d4edda;
 color: #155724;
 border: 1px solid #c3e6cb;
 padding: 10px;
 border-radius: 5px;
 margin: 10px 0;
 font-size: 14px;

}

.error-message {
 background-color: #f8d7da;
 color: #721c24;
 border: 1px solid #f5c6cb;
 padding: 10px;
 border-radius: 5px;
 margin: 10px 0;
 font-size: 14px;
}


#prompt-form {
 display: flex;
 gap: 10px;

}

#prompt-input {
 flex-grow: 1;
 padding: 12px;
 border-radius: 5px;
 border: 1px solid #ccc;
 resize: none;
 font-family: inherit;
 font-size: 14px;

}







#send-btn {
 padding: 12px 20px;
 background-color: #28a745;
 color: white;
 border: none;
 border-radius: 5px;
 cursor: pointer;
 font-weight: 500;


}

#send-btn:hover:not(:disabled) {
 background-color: #218838;

}

#send-btn:disabled {
 background-color: #ccc;
 cursor: not-allowed;
}


.loading-dots::after {
 content: '';
 animation: dots 1s steps(5, end) infinite;
}

@keyframes dots {
 0%, 20% { content: ''; }
 40% { content: '.'; }
 60% { content: '..'; }
 80%, 100% { content: '...'; }
}


.bubble h1, .bubble h2, .bubble h3 {
 margin-top: 10px;
 margin-bottom: 5px;
}





.bubble ul, .bubble ol {
 padding-left: 20px;
 margin: 10px 0;




}

.bubble pre {
 background: #f4f4f4;
 padding: 10px;
 overflow-x: auto;
 border-radius: 5px;

}

.bubble code {
 background: #f4f4f4;
 padding: 2px 4px;
 border-radius: 3px;
 font-family: monospace;

}

.bubble a {
 color: #007bff;
 text-decoration: none;
}

.bubble a:hover {
 text-decoration: underline;
}









#stop-button {
 display: none;
 margin-top: 10px;
 background-color: #dc3545;
 padding: 10px 20px;
 border: none;
 border-radius: 5px;
 color: white;
 cursor: pointer;

}

#stop-button:hover {
 background-color: #c82333;
}

/* Modal Styles */
.modal {
 display: none;
 position: fixed;
 z-index: 1000;
 left: 0;
 top: 0;
 width: 100%;
 height: 100%;
 background-color: rgba(0,0,0,0.5);
}

.modal-content {
 background-color: #fff;
 margin: 10% auto;
 padding: 20px;
 border-radius: 8px;
 width: 80%;
 max-width: 600px;
 position: relative;
}

.close {
 color: #aaa;
 float: right;
 font-size: 28px;
 font-weight: bold;
 cursor: pointer;
 position: absolute;
 right: 15px;
 top: 10px;
}

.close:hover {
 color: #000;

}

/* Responsive Design */
@media (max-width: 768px) {
 .container {
  padding: 10px;
 }
 
 .status-bar {
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
 }
 
 .control-buttons {
  justify-content: center;
 }
 
 .background-header {
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
 }
 
 .background-controls {
  justify-content: center;
 }
 
 .bubble {
  max-width: 85%;
 }
 
 #prompt-form {
  flex-direction: column;
 }
 
 #send-btn {
  align-self: flex-end;
  width: 100px;
 }
}

/* Loading States */
.loading {
 opacity: 0.6;
 pointer-events: none;
}

.spinner {
 display: inline-block;
 width: 12px;
 height: 12px;
 border: 2px solid #f3f3f3;
 border-top: 2px solid #007bff;
 border-radius: 50%;
 animation: spin 1s linear infinite;
 margin-right: 5px;
}

@keyframes spin {
 0% { transform: rotate(0deg); }
 100% { transform: rotate(360deg); }
