html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus,
.btn:active:focus,
.btn-link.nav-link:focus,
.form-control:focus,
.form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

/* Component Configuration Styles */
.config-tabs .nav-link {
  border-radius: 0.375rem 0.375rem 0 0;
  margin-right: 0.25rem;
  border: 1px solid #dee2e6;
  border-bottom: none;
}

.config-tabs .nav-link.active {
  background-color: #fff;
  border-color: #dee2e6 #dee2e6 #fff;
}

.form-control-color {
  width: 100%;
  height: 38px;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.color-preview {
  display: inline-block;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  border: 1px solid #ccc;
  margin-right: 8px;
  vertical-align: middle;
}

.tab-pane {
  min-height: 400px;
}

.component-config-section {
  background-color: #f8f9fa;
  border-radius: 0.375rem;
  padding: 1rem;
  margin-bottom: 1rem;
}

.component-config-section h6 {
  color: #495057;
  margin-bottom: 0.75rem;
}

.form-floating>.form-control-plaintext::placeholder,
.form-floating>.form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating>.form-control-plaintext:focus::placeholder,
.form-floating>.form-control:focus::placeholder {
  text-align: start;
}

/* User Administration Styles */
.user-admin-tabs .nav-link {
  font-weight: 500;
}

.user-admin-tabs .nav-link.active {
  background-color: #0d6efd;
  border-color: #0d6efd;
  color: white;
}

.user-table th {
  background-color: #f8f9fa;
  border-top: 2px solid #dee2e6;
}

.user-status-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.user-actions .btn {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.user-roles .badge {
  margin-right: 0.25rem;
  margin-bottom: 0.25rem;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section h6 {
  color: #495057;
  margin-bottom: 0.75rem;
  font-weight: 600;
}

.checkbox-group {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 0.75rem;
  background-color: #f8f9fa;
}

.checkbox-group .form-check {
  margin-bottom: 0.5rem;
}

.alert-custom {
  border-radius: 0.5rem;
  border: none;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.tab-content {
  padding-top: 1rem;
}

.modal-header {
  background-color: #f8f9fa;
  border-bottom: 2px solid #dee2e6;
}

.modal-footer {
  background-color: #f8f9fa;
  border-top: 2px solid #dee2e6;
}

.table-responsive {
  border-radius: 0.375rem;
  border: 1px solid #dee2e6;
}

.json-display {
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 0.375rem;
  padding: 1rem;
  font-family: 'Courier New', monospace;
  font-size: 0.875rem;
  max-height: 300px;
  overflow-y: auto;
}

.troubleshoot-section {
  border: 1px solid #dee2e6;
  border-radius: 0.5rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  background-color: #fff;
}

.troubleshoot-section h5 {
  color: #495057;
  margin-bottom: 1rem;
}

.btn-outline-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease-in-out;
}

.btn-outline-danger:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.25rem 0.5rem rgba(220, 53, 69, 0.2);
  transition: all 0.2s ease-in-out;
}

.btn-outline-warning:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.25rem 0.5rem rgba(255, 193, 7, 0.2);
  transition: all 0.2s ease-in-out;
}

/* Sidebar Navigation Styles */
body {
  margin: 0;
  padding-top: 56px; /* Height of fixed navbar */
}

.navbar {
  z-index: 1030;
}

.sidebar {
  position: fixed;
  top: 56px; /* Height of navbar */
  left: 0;
  width: 240px;
  height: calc(100vh - 56px);
  background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
  border-right: 1px solid #dee2e6;
  z-index: 1020;
  transition: transform 0.3s ease-in-out;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #495057 transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: #495057;
  border-radius: 3px;
}

.sidebar-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #495057;
  background-color: rgba(0, 0, 0, 0.1);
}

.sidebar-content {
  padding: 0.25rem 0;
}

.sidebar .nav-link {
  color: #ecf0f1;
  padding: 0.5rem 1rem;
  margin: 0.0625rem 0.5rem;
  border-radius: 0.25rem;
  transition: all 0.2s ease-in-out;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 500;
  font-size: 0.9rem;
  line-height: 1.2;
}

.sidebar .nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar .nav-link.active {
  background-color: #3498db;
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(52, 152, 219, 0.3);
}

.sidebar .nav-group {
  margin: 0.125rem 0;
}

.sidebar .nav-group-toggle {
  cursor: pointer;
  position: relative;
}

.sidebar .nav-group-toggle:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.sidebar .nav-group-toggle[aria-expanded="true"] {
  background-color: rgba(255, 255, 255, 0.15);
}

.sidebar .nav-group-toggle[aria-expanded="true"] .group-arrow {
  transform: rotate(180deg);
}

.sidebar .group-arrow {
  transition: transform 0.2s ease-in-out;
  font-size: 0.75rem;
  color: #bdc3c7;
  min-width: 12px;
  text-align: center;
}

.sidebar .nav-group-content {
  margin-left: 0.5rem;
  border-left: 2px solid rgba(255, 255, 255, 0.1);
}

.sidebar .sub-nav {
  padding: 0.375rem 0.75rem 0.375rem 1.5rem;
  font-size: 0.85rem;
  font-weight: 400;
  color: #bdc3c7;
  margin: 0.0625rem 0.25rem;
}

.sidebar .sub-nav:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar .sub-nav.active {
  background-color: #2980b9;
  color: #ffffff;
}

.main-content {
  margin-left: 240px;
  padding: 1.5rem;
  min-height: calc(100vh - 56px);
  transition: margin-left 0.3s ease-in-out;
}

.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1015;
  display: none;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: 240px; /* Ensure same width on mobile */
  }
  
  .sidebar.show {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
  }
  
  .sidebar-overlay.show {
    display: block;
  }
}

/* Tablet Responsive */
@media (max-width: 1199.98px) and (min-width: 992px) {
  .sidebar {
    width: 220px;
  }
  
  .main-content {
    margin-left: 220px;
  }
}

/* Debug: Show current screen size 
body::before {
  content: "Screen: Desktop (≥992px)";
  position: fixed;
  top: 60px;
  right: 10px;
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 4px 8px;
  font-size: 12px;
  z-index: 9999;
  border-radius: 4px;
}

@media (max-width: 1199.98px) and (min-width: 992px) {
  body::before {
    content: "Screen: Tablet (992px-1199px)";
  }
}

@media (max-width: 991.98px) {
  body::before {
    content: "Screen: Mobile (<992px) - Sidebar Hidden";
  }
}
 */

/* Large Screen Optimizations */
@media (min-width: 1400px) {
  .sidebar {
    width: 260px;
  }
  
  .main-content {
    margin-left: 260px;
  }
  
  .sidebar .nav-link {
    padding: 0.6rem 1.25rem;
    font-size: 0.95rem;
  }
  
  .sidebar .sub-nav {
    padding: 0.4rem 0.875rem 0.4rem 1.75rem;
    font-size: 0.9rem;
  }
}

/* Print Styles */
@media print {
  .sidebar,
  .navbar {
    display: none !important;
  }

  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
}

/* Model Capability Badges */
.bg-purple {
  background-color: #6f42c1 !important;
  color: #fff;
}

.bg-teal {
  background-color: #20c997 !important;
  color: #fff;
}

.model-capabilities-display .badge {
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35em 0.5em;
}

.model-capabilities-display {
  border-top: 1px solid #e9ecef;
  padding-top: 0.5rem;
}

/* Custom Model Dropdown with Icon Badges */
.custom-model-dropdown-wrapper {
  position: relative;
}

.custom-model-dropdown-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  background-color: #fff;
  cursor: pointer;
}

.custom-model-dropdown-btn::after {
  display: none; /* Hide default Bootstrap caret, form-select has its own */
}

.custom-model-dropdown-btn .dropdown-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 0.5rem;
}

.custom-model-dropdown-btn .capability-badges {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.custom-model-dropdown-btn .capability-badges .badge {
  font-size: 0.65rem;
  padding: 0.2em 0.35em;
}

.custom-model-dropdown-menu {
  min-width: 100%;
  max-height: 350px;
  overflow-y: auto;
}

.custom-model-dropdown-menu .dropdown-item {
  padding: 0.5rem 1rem;
  white-space: nowrap;
}

.custom-model-dropdown-menu .dropdown-item:hover {
  background-color: #f8f9fa;
}

.custom-model-dropdown-menu .dropdown-item.active {
  background-color: #e9ecef;
  color: inherit;
}

.custom-model-dropdown-menu .capability-badges {
  display: flex;
  gap: 0.2rem;
  flex-shrink: 0;
}

.custom-model-dropdown-menu .capability-badges .badge {
  font-size: 0.7rem;
  padding: 0.25em 0.4em;
}

.custom-model-dropdown-menu .capability-badges .badge i {
  font-size: 0.65rem;
}