/* AVEVA Connect Monitoring - Custom Styles */

/* Ensure fast loading */
* {
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.6;
}

/* Page loading optimization */
.container {
    max-width: 1200px;
}

/* Card improvements */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

/* Status indicators */
.status-online {
    color: #28a745;
}

.status-offline {
    color: #dc3545;
}

.status-warning {
    color: #ffc107;
}

/* Animation for icons */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.rotating {
    animation: spin 1s linear infinite;
}

/* Responsive improvements */
@media (max-width: 768px) {
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.875rem;
    }
}

/* Performance optimization */
.feather {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Dark theme modals fix - Critical UI issue */
.modal-content {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
    border: 1px solid var(--bs-gray-700) !important;
}

.modal-header {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
    border-bottom: 1px solid var(--bs-gray-700) !important;
}

.modal-body {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
}

.modal-footer {
    background-color: var(--bs-dark) !important;
    color: var(--bs-light) !important;
    border-top: 1px solid var(--bs-gray-700) !important;
}

/* Form controls in modals */
.modal .form-control,
.modal .form-select {
    background-color: var(--bs-gray-900) !important;
    border: 1px solid var(--bs-gray-600) !important;
    color: var(--bs-light) !important;
}

.modal .form-control:focus,
.modal .form-select:focus {
    background-color: var(--bs-gray-800) !important;
    border-color: var(--bs-primary) !important;
    color: var(--bs-light) !important;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25) !important;
}

/* Labels and text in modals */
.modal .form-label,
.modal .form-text,
.modal .text-muted {
    color: var(--bs-gray-300) !important;
}

/* Pre/code blocks in modals */
.modal pre,
.modal code {
    background-color: var(--bs-gray-800) !important;
    color: var(--bs-light) !important;
}

/* AI Chat Interface Fixes */
.message.user .message-content {
    color: #212529 !important; /* Dark text for user messages */
    background-color: #f8f9fa !important; /* Light background for user messages */
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 3px solid var(--bs-primary);
}

.message.assistant .message-content {
    color: var(--bs-light) !important; /* Light text for AI messages */
    background-color: var(--bs-dark) !important; /* Dark background for AI messages */
    padding: 0.75rem;
    border-radius: 0.375rem;
    border-left: 3px solid var(--bs-success);
}

/* Chat message container styling */
.chat-messages {
    max-height: 600px;
    overflow-y: auto;
    padding: 1rem;
    background-color: var(--bs-gray-100);
    border-radius: 0.375rem;
}

/* User message styling improvements */
.message.user {
    margin-bottom: 1rem;
    background-color: transparent !important;
}

.message.assistant {
    margin-bottom: 1rem;
    background-color: transparent !important;
}

/* Ensure text visibility */
.message .message-content p {
    margin-bottom: 0.5rem;
    color: inherit !important;
}

/* Force user text visibility in chat interface */
/* Fix user message visibility in AI chat - more specific selectors */
.chat-message-user,
.chat-message-user *,
.chat-message.user-message,
.chat-message.user-message *,
#chatMessages .chat-message.user-message,
#chatMessages .chat-message.user-message *,
.user-message .message-content,
.user-message .message-content *,
.chat-message[data-role="user"],
.chat-message[data-role="user"] * {
    color: #ffffff !important;
    background-color: rgba(255, 255, 255, 0.1) !important;
}

.chat-message-ai,
.chat-message-ai * {
    color: #333 !important;
}

.message .message-content ol,
.message .message-content ul {
    color: inherit !important;
    padding-left: 1.5rem;
}

.message .message-content li {
    color: inherit !important;
    margin-bottom: 0.25rem;
}
    border: 1px solid var(--bs-gray-600) !important;
}

/* Instance action buttons - ensure proper sizing */
.btn-group-sm .btn {
    padding: 0.375rem 0.5rem;
    font-size: 0.875rem;
    line-height: 1.5;
    border-radius: 0.25rem;
}

.btn-group-sm .btn i[data-feather] {
    width: 16px !important;
    height: 16px !important;
    stroke-width: 2;
}

/* Force icon sizes in action buttons */
.btn .feather,
.btn i[data-feather] {
    width: 16px !important;
    height: 16px !important;
}

/* Removed z-index overrides that were causing modal blocking issues */

/* Force context panel to auto-size content */
#contextPanel {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

/* Compact sidebar styling */
.col-lg-3 {
    height: auto !important;
    max-height: none !important;
}

/* System Context card auto-sizing */
.col-lg-3 .card {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

.col-lg-3 .card .card-body {
    height: auto !important;
    min-height: auto !important;
    max-height: none !important;
}

/* Package card styles for Rules Management */
.package-card.clickable:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transform: translateY(-2px);
    transition: all 0.2s ease;
}

.package-card.disabled {
    background-color: #f8f9fa;
}

.package-card {
    transition: all 0.2s ease;
}

/* Fix white text on white background issue in AI Assistant card */
.card-header-bg-light,
.card-header.bg-light,
div[class*="card-header"][class*="bg-light"] {
    background-color: #f8f9fa !important;
    color: #333 !important;
    border-bottom: 1px solid #dee2e6 !important;
}

/* Professional UX Design - AI Assistant Section */
#providerSelection {
    background: linear-gradient(145deg, #f8f9fb 0%, #f1f3f7 100%) !important;
    color: #2d3748 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
}

#providerSelection * {
    color: #2d3748 !important;
}

#providerSelection .text-muted {
    color: #64748b !important;
}

/* Professional AI Assistant content styling */
#providerSelection .mb-4,
.card.ai-assistant .mb-4,
.provider-selection .mb-4 {
    background-color: transparent !important;
    color: #2d3748 !important;
}

#providerSelection .mb-4 *,
.card.ai-assistant .mb-4 *,
.provider-selection .mb-4 * {
    color: #2d3748 !important;
}

#providerSelection .mb-4 h6,
.card.ai-assistant .mb-4 h6,
.provider-selection .mb-4 h6 {
    color: #1a202c !important;
    font-weight: 600 !important;
}

#providerSelection .mb-4 p,
.card.ai-assistant .mb-4 p,
.provider-selection .mb-4 p {
    color: #64748b !important;
}

/* AI Assistant icon - professional blue */
#providerSelection .mb-4 i[data-feather],
.card.ai-assistant .mb-4 i[data-feather],
.provider-selection .mb-4 i[data-feather] {
    color: #4f46e5 !important;
    stroke: #4f46e5 !important;
}

/* Form Preview professional styling */
.form-preview-container {
    background: linear-gradient(145deg, #fafbfc 0%, #f4f6f8 100%) !important;
    border-radius: 8px !important;
    padding: 24px !important;
    min-height: 300px !important;
}

.form-preview-wrapper {
    background: #1a1a1a !important;
    border-radius: 8px !important;
    padding: 20px !important;
    box-shadow: 0 1px 3px rgba(255,255,255,0.1) !important;
    border: 1px solid #333333 !important;
}

/* Fix Form Preview widget colors - force readable light text on dark background */
.form-preview-wrapper,
.form-preview-wrapper * {
    color: #f1f1f1 !important;
}

/* Ensure form controls are visible on dark background */
.form-preview-wrapper .form-control,
.form-preview-wrapper .form-select {
    background-color: #2d2d2d !important;
    color: #f1f1f1 !important;
    border-color: #555555 !important;
}

.form-preview-wrapper .btn {
    background-color: #0d6efd !important;
    color: white !important;
    border-color: #0d6efd !important;
}

.form-preview-wrapper .form-label {
    color: #2d3748 !important;
    font-weight: 600 !important;
}

.form-preview-wrapper .form-control,
.form-preview-wrapper .form-select {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #1a202c !important;
}

.form-preview-wrapper .form-control:focus,
.form-preview-wrapper .form-select:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
    background-color: #ffffff !important;
    color: #1a202c !important;
}

.form-preview-wrapper .form-control::placeholder {
    color: #9ca3af !important;
}

.form-preview-wrapper .form-text {
    color: #64748b !important;
}

.form-preview-wrapper input[type="radio"],
.form-preview-wrapper input[type="checkbox"] {
    accent-color: #4f46e5 !important;
}

.form-preview-wrapper .btn {
    background-color: #4f46e5 !important;
    border-color: #4f46e5 !important;
    color: #ffffff !important;
}

/* Professional select styling */
#initialProviderSelect {
    background: #ffffff !important;
    border: 2px solid #e2e8f0 !important;
    border-radius: 8px !important;
    color: #2d3748 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    transition: all 0.2s ease !important;
}

#initialProviderSelect:focus {
    border-color: #4f46e5 !important;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1) !important;
}

/* Professional quick examples styling */
.bg-light {
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%) !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
}

.bg-light small.text-muted {
    color: #64748b !important;
}

/* Card header professional styling override */
.card-header-bg-light,
.card-header.bg-light,
div[class*="card-header"][class*="bg-light"] {
    background: linear-gradient(145deg, #f8fafc 0%, #f1f5f9 100%) !important;
    color: #1e293b !important;
    border-bottom: 1px solid #e2e8f0 !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
}