/* 
  Diagnostic Dashboard Style 
  Professional Polish Design Theme 
  Fully Responsive, Day/Night Mode Support
*/

:root {
  --bg-primary: #f8fafc; /* slate-50 */
  --bg-card: #ffffff;
  --bg-sidebar: #ffffff;
  --border-color: #e2e8f0; /* slate-200 */
  --text-primary: #0f172a; /* slate-900 */
  --text-secondary: #64748b; /* slate-500 */
  --accent-color: #0d9488; /* teal-600 */
  --accent-light: #f0fdfa; /* teal-50 */
  --accent-hover: #0f766e; /* teal-700 */
  --nav-hover: #f1f5f9; /* slate-100 */
  --table-header: #f8fafc;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 15px -3px rgba(13, 148, 136, 0.08), 0 4px 6px -4px rgba(13, 148, 136, 0.08);
  --card-border-radius: 1rem;
}

[data-theme="dark"] {
  --bg-primary: #0b0f19; /* deep dark background */
  --bg-card: #151c2c; /* slate-800 style dark */
  --bg-sidebar: #0e1320; /* slate-900 style deep dark */
  --border-color: #222b40; /* custom slate border */
  --text-primary: #f1f5f9; /* slate-100 */
  --text-secondary: #94a3b8; /* slate-400 */
  --text-muted: rgb(119 123 129 / 75%) !important;
  --accent-color: #2dd4bf; /* teal-400 */
  --accent-light: #0d2c29; /* deep teal background tint */
  --accent-hover: #14b8a6; /* teal-500 */
  --nav-hover: #1c2438;
  --table-header: #0f1524;
  --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px -1px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
}

/* Base resets & styles */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  display: flex;
  justify-content: center;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-color);
}

/* Global Transitions */
.card, .btn, .nav-link, table, tr, td, th, input, .sidebar, .top-navbar {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Sidebar Styling */
.sidebar {
  width: 260px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, width 0.3s ease, background-color 0.3s ease, border-right-color 0.3s ease;
}

.sidebar-brand {
  padding: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  background-color: var(--accent-color);
  color: #ffffff;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
}

.brand-name {
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-primary);
  letter-spacing: -0.025em;
}

.sidebar-menu {
  flex-grow: 1;
  padding: 1.25rem 1rem;
  overflow-y: auto;
}

.sidebar-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-item {
  width: 100%;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1rem;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.2s ease;
}

.sidebar-link i {
  font-size: 1.15rem;
}

.sidebar-link:hover {
  background-color: var(--nav-hover);
  color: var(--accent-color);
  transform: translateX(4px);
}

.sidebar-link.active {
  background-color: var(--accent-light);
  color: var(--accent-color);
  font-weight: 600;
}

.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.user-badge {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  padding: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-badge-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background-color: var(--accent-light);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
}

.user-badge-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-badge-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-badge-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* Layout Main Content Panel */
.main-content {
  margin-left: 260px;
  flex-grow: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* Top Navbar styling */
.top-navbar {
  height: 70px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 999;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  display: block; /* Always visible for collapsible desktop and responsive mobile drawer */
}

.search-wrapper {
  position: relative;
  width: 320px;
}

.search-wrapper i {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary);
}

.search-input {
  width: 100%;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50rem;
  padding: 0.5rem 1rem 0.5rem 2.5rem;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

/* Theme Switcher Toggle styling */
.theme-switch-container {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 50rem;
  padding: 0.25rem;
  display: flex;
  gap: 0.25rem;
}

.theme-switch-btn {
  border: none;
  background: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 50rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.2s ease;
}

.theme-switch-btn.active {
  background-color: var(--bg-card);
  color: var(--accent-color);
  box-shadow: var(--shadow);
}

.navbar-action-btn {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  cursor: pointer;
  position: relative;
}

.navbar-action-btn:hover {
  background-color: var(--nav-hover);
  color: var(--accent-color);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: #ef4444; /* red-500 */
  border: 2px solid var(--bg-card);
  border-radius: 50%;
}

.profile-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
}

.profile-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background-color: var(--accent-light);
  color: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* Page wrapper container */
.page-container {
  padding: 2rem;
  flex-grow: 1;
}

/* Card custom designs */
.card-custom {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--card-border-radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  position: relative;
  overflow: hidden;
}
.custom-column{
  margin-bottom: 1rem;
}
.card-hover-lift {
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: var(--accent-color);
}

/* Diagnostic Stats Icons & colors */
.stat-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

.stat-icon-primary {
  background-color: rgba(13, 148, 136, 0.1);
  color: var(--accent-color);
}

.stat-icon-success {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.stat-icon-warning {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.stat-icon-info {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.875rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-change {
  font-size: 0.75rem;
  font-weight: 600;
  margin-top: 0.5rem;
}

.stat-change.positive {
  color: #10b981;
}

.stat-change.negative {
  color: #ef4444;
}

/* Custom Table Design */
.table-custom {
  margin: 0;
}

.table-custom th {
  background-color: var(--table-header);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
}

.table-custom td {
  padding: 1rem 1.25rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 0.875rem;
}

.table-custom tr:hover td {
  background-color: var(--nav-hover);
}

/* Badge Status Styles */
.badge-custom {
  padding: 0.35em 0.75em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50rem;
  text-transform: uppercase;
  letter-spacing: 0.025em;
}

.badge-ready {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

.badge-processing {
  background-color: rgba(245, 158, 11, 0.1);
  color: #f59e0b;
}

.badge-pending {
  background-color: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
}

.badge-cancelled {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Activity Timeline */
.timeline {
  position: relative;
  padding-left: 1.5rem;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 0;
  left: 4.5px;
  height: 100%;
  width: 2px;
  background-color: var(--border-color);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-marker {
  position: absolute;
  left: -1.5rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background-color: var(--accent-color);
  border: 2px solid var(--bg-card);
  top: 5px;
}

.timeline-marker.success {
  background-color: #10b981;
}

.timeline-marker.warning {
  background-color: #f59e0b;
}

.timeline-marker.info {
  background-color: #3b82f6;
}

.timeline-content {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
}

.timeline-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-weight: 500;
  margin-bottom: 0.25rem;
}

.timeline-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.125rem;
}

.timeline-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0;
}

/* Modals & Dropdown menu card custom bg */
.dropdown-menu-custom {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-hover);
  border-radius: 0.75rem;
}

.dropdown-item-custom {
  color: var(--text-primary);
  font-size: 0.875rem;
  padding: 0.6rem 1.25rem;
}

.dropdown-item-custom:hover {
  background-color: var(--nav-hover);
  color: var(--accent-color);
}

.dropdown-divider-custom {
  border-top: 1px solid var(--border-color);
  margin: 0.5rem 0;
}

/* Forms styling */
.form-label-custom {
  font-weight: 500;
  font-size: 0.875rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.form-control-custom {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
}

.form-control-custom:focus {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  outline: none;
}

.form-select-custom {
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 0.5rem;
  padding: 0.6rem 2.25rem 0.6rem 1rem;
  font-size: 0.875rem;
}

.form-select-custom:focus {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.15);
  outline: none;
}

/* Custom buttons */
.btn-accent {
  background-color: var(--accent-color);
  color: #ffffff;
  border: none;
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
}

.btn-accent:hover {
  background-color: var(--accent-hover);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(13, 148, 136, 0.25);
}

.btn-accent-light {
  background-color: var(--accent-light);
  color: var(--accent-color);
  border: none;
  font-weight: 600;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
}

.btn-accent-light:hover {
  background-color: var(--accent-color);
  color: #ffffff;
}

.btn-outline-custom {
  border: 1px solid var(--border-color);
  background: transparent;
  color: var(--text-primary);
  font-weight: 500;
  padding: 0.6rem 1.25rem;
  border-radius: 0.5rem;
}

.btn-outline-custom:hover {
  background-color: var(--nav-hover);
  color: var(--accent-color);
  border-color: var(--accent-color);
}

/* Responsiveness and Sidebar Toggle Collapse behavior */
body.sidebar-collapsed .sidebar {
  width: 70px;
}

body.sidebar-collapsed .brand-name {
  display: none;
}

body.sidebar-collapsed .sidebar-brand {
  justify-content: center;
  padding: 1.5rem 0.5rem;
}

body.sidebar-collapsed .sidebar-link span {
  display: none;
}

body.sidebar-collapsed .sidebar-link {
  justify-content: center;
  padding: 0.75rem 0;
  gap: 0;
}

body.sidebar-collapsed .user-badge-info {
  display: none;
}

body.sidebar-collapsed .user-badge {
  justify-content: center;
  padding: 0.5rem;
}

body.sidebar-collapsed .main-content {
  margin-left: 70px;
}

/* Tooltips in collapsed state */
body.sidebar-collapsed .sidebar-link {
  position: relative;
}

body.sidebar-collapsed .sidebar-link::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 80px;
  background-color: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
  box-shadow: var(--shadow-hover);
  z-index: 1050;
}

body.sidebar-collapsed .sidebar-link:hover::after {
  opacity: 1;
  transform: translateX(0);
}

@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 260px !important;
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0 !important;
  }
  
  .sidebar-toggle-btn {
    display: block;
  }
  
  /* Reset collapsing on mobile drawer */
  body.sidebar-collapsed .sidebar-brand {
    justify-content: flex-start !important;
    padding: 1.5rem !important;
  }
  body.sidebar-collapsed .brand-name {
    display: block !important;
  }
  body.sidebar-collapsed .sidebar-link span {
    display: inline-block !important;
  }
  body.sidebar-collapsed .sidebar-link {
    justify-content: flex-start !important;
    padding: 0.75rem 1rem !important;
    gap: 0.875rem !important;
  }
  body.sidebar-collapsed .user-badge-info {
    display: flex !important;
  }
  body.sidebar-collapsed .user-badge {
    justify-content: flex-start !important;
    padding: 0.75rem !important;
  }
  body.sidebar-collapsed .sidebar-link::after {
    display: none !important;
  }
}

/* Equipment state indicators */
.equipment-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px dashed var(--border-color);
}

.equipment-status-row:last-child {
  border-bottom: none;
}

.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.bg-dot-success {
  background-color: #10b981;
}

.bg-dot-danger {
  background-color: #ef4444;
}

.bg-dot-warning {
  background-color: #f59e0b;
}

/* Day/Night visual transitions */
.transition-smooth {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.text-muted{
  color: var(--text-muted) !important;
}
