/* static/css/styles.css */

/* Global Styles */

/* Theme variables */
:root {
    --chart-background: #ffffff;
    --chart-foreground: #000000;
    --text-color: #000000;
}

body.dark-theme {
    background-color: #121212;
    color: #e0e0e0;
    --chart-background: #1e1e1e;
    --chart-foreground: #e0e0e0;
    --text-color: #e0e0e0;
}

body, html {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-x: hidden; /* Prevent horizontal scroll */
    background-color: #f5f5f5; /* Light background for better contrast */
    font-family: Arial, sans-serif; /* Default font */
}

/* Wrapper for the entire page layout */
#wrapper {
    width: 100%;
    height: 100vh; /* Full viewport height */
    display: flex;
    transition: all 0.3s ease; /* Smooth transition */
}

/* Add or update these styles */
#overlayCanvas {
    position: absolute;
    cursor: crosshair;
}


/* Sidebar Styles */
#sidebar-wrapper {
    width: 250px; /* Default width */
    min-width: 250px; /* Lock the sidebar to its default width */
    max-width: 250px; /* Prevent accidental growth */
    height: 100%; /* Full height */
    background-color: #acb7c6; /* Sidebar background color */
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.15); /* Sidebar shadow */
    transition: all 0.3s ease; /* Smooth transition */
    z-index: 1000; /* Ensure sidebar is above other elements */
    display: flex;
    flex-direction: column; /* Stack items vertically */
    flex: 0 0 250px; /* Prevent the sidebar from shrinking */
}


.data-table-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
}

.data-table-container .dataTables_wrapper {
    width: 100%;
}

.data-table-container table {
    width: 100% !important;
    table-layout: auto;
}

.data-table-container table th,
.data-table-container table td {
    white-space: normal;
    word-break: break-word;
    vertical-align: middle;
}

.sidebar-heading {
    padding: 10px 0; /* Padding around the logo */
    background-color: #8fa2b8; /* Slightly darker background for the logo area */
    text-align: center; /* Center align the logo */
    position: relative;
}

.logo-expanded {
    width: 100%;
    max-width: 250px; /* Limit the max width */
    display: block; /* Show the expanded logo */
}

.logo-collapsed {
    width: 40px;
    height: 40px;
    display: none; /* Hide the collapsed logo by default */
}

/* List group for sidebar links */
.list-group {
    flex: 1; /* Take up remaining space */
    overflow-y: auto; /* Scroll if too many items */
    padding: 0; /* Remove padding */
    margin: 0; /* Remove margin */
}

.list-group-item {
    background-color: transparent; /* Transparent background */
    border: none; /* Remove border */
    padding: 15px 20px; /* Padding for links */
    color: #333; /* Text color */
    cursor: pointer; /* Pointer cursor */
}

.list-group-item:hover {
    background-color: #7f93ab; /* Hover background color */
    color: #fff; /* Hover text color */
}

.list-group-item.active {
    background-color: #566b8a; /* Active link background */
    color: #fff; /* Active link text color */
}

.list-group-item i {
    margin-right: 10px; /* Space between icon and text */
}

.sidebar-text {
    display: inline-block; /* Ensure text is aligned properly */
}

/* Adjustments when sidebar is collapsed */
.sidebar-collapsed #sidebar-wrapper {
    width: 80px; /* Reduced width for collapsed sidebar */
    min-width: 80px;
    max-width: 80px;
}

.sidebar-collapsed .list-group-item {
    text-align: center; /* Center icons and text */
    padding: 15px 0; /* Reduced padding */
}

.sidebar-collapsed .sidebar-text {
    display: none; /* Hide text when collapsed */
}

.sidebar-collapsed .logo-expanded {
    display: none; /* Hide expanded logo */
}

.sidebar-collapsed .logo-collapsed {
    display: block; /* Show collapsed logo */
    margin: auto; /* Center logo */
}

.sidebar-toggle-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 6px;
    border-radius: 6px;
    border: none;
}

.sidebar-toggle-btn:focus {
    box-shadow: none;
}

.sidebar-collapsed #sidebar-wrapper .collapse {
    display: none !important;
}

/* Page Content Wrapper */
#page-content-wrapper {
    flex: 1; /* Take up remaining space */
    width: 100%; /* Full width */
    padding: 0; /* Remove padding */
    margin: 0; /* Remove margin */
    display: flex;
    flex-direction: column; /* Ensure column layout */
    transition: all 0.3s ease; /* Smooth transition */
}

/* Navbar */
.navbar {
    width: 100%; /* Full width */
    background-color: #f8f9fa; /* Light background */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Navbar shadow */
    z-index: 999; /* Ensure navbar stays above other content */
    padding: 10px 20px; /* Padding for aesthetics */
    flex-shrink: 0; /* Prevent shrinking */
}

/* Theme toggle button styling */
#theme-toggle {
    margin-left: 0;
}

/* Container for main content */
#page-content-wrapper .container-fluid {
    flex: 1; /* Take up remaining space */
    width: 100%; /* Full width */
    padding: 20px; /* Padding for content */
    overflow-y: auto; /* Scroll if content overflows */
}

/* Dashboard Card Styles */
.card {
    border: none; /* Remove default border */
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* Card shadow */
    border-radius: 5px; /* Rounded corners */
    margin-bottom: 20px; /* Space between cards */
}

.card-header {
    background-color: #8fa2b8; /* Card header background */
    color: #fff; /* Card header text color */
    padding: 10px 15px; /* Padding inside card header */
    font-size: 16px; /* Font size */
}

.chat-history {
    max-height: 500px;
    overflow-y: auto;
    background-color: #f8f9fa;
    border-radius: 6px;
    padding: 1rem;
}

.ai-chat-page {
    min-height: calc(100vh - 140px);
}

.ai-chat-card {
    min-height: calc(100vh - 190px);
    display: flex;
    flex-direction: column;
}

.ai-chat-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ai-chat-tabs {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.ai-chat-pane,
.ai-scout-pane {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-history {
    flex: 1;
    max-height: none;
}

.ai-scout-results {
    flex: 1;
    min-height: 0;
}

.ai-scout-card {
    overflow: hidden;
}

.ai-scout-thumb {
    width: 100%;
    height: 160px;
    object-fit: cover;
    cursor: zoom-in;
}

.chat-entry:last-child {
    margin-bottom: 0;
}

.chat-bubble {
    border-radius: 6px;
    padding: 0.75rem;
    background-color: #ffffff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.chat-bubble.user {
    border-left: 4px solid #566b8a;
}

.chat-bubble.assistant {
    border-left: 4px solid #28a745;
    background-color: #f4fdf6;
}

.chat-text {
    white-space: pre-line;
}

.chat-image {
    max-width: 100%;
    border-radius: 4px;
}

.chat-image-preview-wrapper {
    display: none;
    border-radius: 6px;
    background-color: #f0f4f8;
    padding: 0.75rem;
}

.chat-image-preview {
    max-width: 100%;
    max-height: 260px;
    border-radius: 6px;
    display: block;
}

.thinking-indicator {
    display: none;
    align-items: center;
    gap: 0.4rem;
    color: #566b8a;
    font-weight: 600;
}

.thinking-dots span {
    display: inline-block;
    animation: thinking-dots 1.1s infinite;
    opacity: 0.2;
}

.thinking-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.thinking-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes thinking-dots {
    0%, 80%, 100% {
        opacity: 0.2;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-2px);
    }
}

body.dark-theme .chat-image-preview-wrapper {
    background-color: #2a2f36;
}

body.dark-theme .thinking-indicator {
    color: #cfd6e0;
}

.card-body {
    padding: 15px; /* Padding inside card body */
}

.badge-success {
    background-color: #28a745; /* Green background for success badge */
    color: #fff; /* White text */
}

/* Optional styles for scrollbars */
::-webkit-scrollbar {
    width: 8px; /* Scrollbar width */
}

::-webkit-scrollbar-track {
    background: #f1f1f1; /* Track color */
}

::-webkit-scrollbar-thumb {
    background: #888; /* Thumb color */
}

::-webkit-scrollbar-thumb:hover {
    background: #555; /* Thumb hover color */
}

/* Collapsed sidebar adjustments */
.toggled #sidebar-wrapper {
    width: 80px; /* Sidebar width when toggled */
    min-width: 80px;
    max-width: 80px;
}

.toggled #page-content-wrapper {
    margin-left: 80px; /* Adjust content margin */
}

/* Adjustments for smaller screens */
@media (max-width: 768px) {
    #sidebar-wrapper {
        width: 80px; /* Narrow sidebar */
        min-width: 80px;
        max-width: 80px;
    }
    #page-content-wrapper {
        margin-left: 80px; /* Align content */
    }
}
/* styles.css */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border: 1px solid transparent;
    border-radius: 4px;
}

.alert-danger {
    color: #a94442;
    background-color: #f2dede;
    border-color: #ebccd1;
}

/* Add more styles for other alert categories if needed */

/* Sidebar heading styles */
.sidebar-heading {
    padding: 10px 0; /* Add padding if needed */
    background-color: #acb7c6; /* Replace with your desired color */
    text-align: center; /* Center align the logo */
    color: #ffffff; /* Optional: Set text color */
}

.button-space {
    margin-left: 10px; /* Adjust the spacing as needed */
}

/*
   A simple top bar that stays at the top, full width.
   Adjust as you like.
*/
.notification-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 40px;
  background-color: #333;
  color: #fff;
  display: flex;              /* use Flexbox */
  align-items: center;        /* vertically center icons/text in the 40px bar */
  justify-content: center;    /* horizontally center all content */
  z-index: 9999;              /* on top of everything */
  font-size: 14px;
  /* If you still want some spacing on left/right: */
  padding: 0 10px;
}

.notification-bar.system-alarm-active {
  background-color: #8b0000;
}

.status-item {
  /* Currently you have: margin: 0 15px; display: inline-flex; align-items: center; */
  display: inline-flex;
  flex-direction: column;       /* stack items vertically */
  align-items: center;          /* center horizontally */
  margin: 0 15px;
}

.status-item i {
  margin-bottom: 4px;  /* space below the icon */
}

.icon-label {
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 2px;  /* small space before the .status-text */
}

.status-text {
  font-weight: bold;
  /* This is where "OK" or "Alarm Active" goes, so style as needed */
}

/* Flashing background for "Alarm Active" */
.flash-bg {
  animation: flashBg 1s infinite;
}

@keyframes flashBg {
  0%, 100% { background-color: red; color: #fff; }
  50%      { background-color: transparent; color: #fff; }
}

/* For "OK" status => green background */
.status-ok {
  background-color: #28a745;
  color: #fff;
}

/* For example, give yourself ~50px top offset
   so content begins *below* the 40px notification bar. */
body {
  margin: 0;
  padding: 50px 0 0 0; /* 50px on top */
  /* ... your other body styles ... */
}

/* Icon spacing for analytics status table */
.status-cell i {
  margin-right: 4px;
}

/* Keep analytics control buttons on one line */
.controls-cell {
  white-space: nowrap;
}

.analytics-controls {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
}

/* Icon spacing in the AVIDS Options column */
.avids-icons i {
  margin-right: 6px;
}

/* Close up detection buffer layout */
.close-up-buffer-grid {
  display: grid;
  grid-template-columns: 1fr 140px 1fr;
  grid-template-rows: auto 140px auto;
  gap: 10px;
  align-items: center;
  justify-items: center;
  max-width: 520px;
  margin-top: 8px;
}

.close-up-buffer-grid .buffer-center {
  grid-column: 2;
  grid-row: 2;
  width: 140px;
  height: 140px;
  border: 2px dashed #6c757d;
  border-radius: 6px;
  background: #f8f9fa;
  color: #6c757d;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.close-up-buffer-grid .buffer-field {
  width: 100%;
  max-width: 110px;
}

.close-up-buffer-grid .buffer-field input {
  text-align: center;
}

.close-up-buffer-grid .buffer-top {
  grid-column: 2;
  grid-row: 1;
}

.close-up-buffer-grid .buffer-left {
  grid-column: 1;
  grid-row: 2;
}

.close-up-buffer-grid .buffer-right {
  grid-column: 3;
  grid-row: 2;
}

.close-up-buffer-grid .buffer-bottom {
  grid-column: 2;
  grid-row: 3;
}

/* Gauge canvas sizing */
.gauge {
  width: 145px !important;
  height: 145px !important;
  max-width: 145px;
  max-height: 145px;
}

/* Dark theme overrides */
body.dark-theme #sidebar-wrapper {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.dark-theme .sidebar-heading {
    background-color: #2b2b2b;
}

body.dark-theme .list-group-item {
    color: #e0e0e0;
}

body.dark-theme .list-group-item:hover {
    background-color: #333;
    color: #fff;
}

body.dark-theme .list-group-item.active {
    background-color: #555;
    color: #fff;
}

body.dark-theme .navbar {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.dark-theme .navbar .dropdown-menu {
    background-color: #2b2b2b;
}

body.dark-theme .dropdown-menu .dropdown-item {
    color: #e0e0e0;
}

body.dark-theme .dropdown-menu .dropdown-item:hover {
    background-color: #333;
}

body.dark-theme .card {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

body.dark-theme .card-header {
    background-color: #333;
}

body.dark-theme .table {
    color: #e0e0e0;
}

body.dark-theme .notification-bar {
    background-color: #000;
}

body.dark-theme .notification-bar.system-alarm-active {
    background-color: #8b0000;
}

/* Loading Spinner */
.spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 9999;
    display: none; /* Hidden by default */
    align-items: center;
    justify-content: center;
}

.spinner-border {
    display: inline-block;
    width: 3rem;
    height: 3rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    -webkit-animation: spinner-border .75s linear infinite;
    animation: spinner-border .75s linear infinite;
    color: #566b8a; /* Primary color */
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

body.dark-theme .spinner-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}
