/* Main Content */
.main-page {
  z-index: 1;
  padding: var(--spacing-xs);
  padding-bottom: var(--spacing-md);
  background: var(--background-primary);
  min-height: calc(100vh - 60px); /* Account for navbar height */
  position: relative;
  box-sizing: border-box;
}

.page-description {
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--spacing-sm);
}

/* Base Navigation Styles - Applied to all screen sizes */
.navbar-nav .nav-link {
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-md);
  transition: var(--transition-fast);
  margin-bottom: var(--spacing-xs);
}

.navbar.fixed-left .navbar-nav .nav-item {
  margin-bottom: 0.5rem;
}

.navbar-nav .nav-link:hover {
  background: var(--background-secondary);
  color: var(--accent-color);
  text-decoration: none;
}

.navbar-nav .nav-link.active {
  color: var(--accent-color);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 10px;
}

/* Dropdown Menus - Base Styles */
.dropdown {
  position: relative;
  display: block;
  color: var(--text-primary);
  cursor: pointer;
  transition: var(--transition-fast);
}

.dropdown:hover {
  color: var(--accent-color);
}

.dropdown-content {
  display: none;
  position: absolute;
  right: 1%;
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 1001;
}

.dropdown-content .dropdown-link {
  color: var(--text-primary);
  padding: var(--spacing-sm) var(--spacing-md);
  display: block;
  text-decoration: none;
  transition: var(--transition-fast);
  border-radius: var(--radius-sm);
  margin: var(--spacing-xs);
}

.dropdown-content .dropdown-link:hover,
.dropdown-content .dropdown-link:focus,
.dropdown-content .dropdown-link:active {
  background: var(--background-secondary);
  color: var(--accent-color);
  text-decoration: none;
}

.dropdown:hover .dropdown-content {
  display: block;
}

/* OASF Logo - Shared Styles */
.oasf-logo {
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
}

.oasf-logo img {
  height: auto;
  width: auto;
  display: block;
  max-width: 100%;
  transform: scale(1.2);
}

/* Version Selector - Shared Styles */
.version {
  margin-bottom: var(--spacing-xl);
}

.select-version {
  width: auto;
  margin-left: calc(-1 * var(--spacing-md));
  margin-right: calc(-1 * var(--spacing-md));
  padding: var(--spacing-sm) var(--spacing-md);
  padding-right: 4.3rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--background-secondary);
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 5'%3E%3Cpath fill='%23475569' d='M2 0L0 2h4zm0 5L0 3h4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--spacing-sm) center;
  background-size: 10px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  -moz-appearance: none;
  -webkit-appearance: none;
  appearance: none;
  transition: var(--transition-normal);
  box-sizing: border-box;
}

.select-version:focus {
  outline: none;
  border-color: var(--accent-color);
  box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.1);
}

.select-version option {
  color: var(--text-primary);
  background: var(--surface-color);
}

/* Sidebar Sections - Shared Styles */
.sidebar-section {
  margin-bottom: var(--spacing-lg);
}

/* Sidebar section headers - increased specificity to override Bootstrap navbar styles */
.navbar.fixed-left .sidebar-section-header,
.sidebar-section-header {
  display: block;
  font-size: 1rem;
  font-weight: 500;
  color: var(--primary-color) !important;
  text-decoration: none;
  transition: var(--transition-fast);
}

.navbar.fixed-left .sidebar-section-header:hover,
.navbar.fixed-left .sidebar-section-header:focus,
.navbar.fixed-left .sidebar-section-header:active,
.sidebar-section-header:hover,
.sidebar-section-header:focus,
.sidebar-section-header:active {
  color: var(--accent-color) !important;
  text-decoration: none;
}

/* Sidebar section header icons - ensure icons inherit the correct color */
.navbar.fixed-left .sidebar-section-header i,
.sidebar-section-header i {
  color: var(--primary-color) !important;
  transition: var(--transition-fast);
}

.navbar.fixed-left .sidebar-section-header:hover i,
.navbar.fixed-left .sidebar-section-header:focus i,
.navbar.fixed-left .sidebar-section-header:active i,
.sidebar-section-header:hover i,
.sidebar-section-header:focus i,
.sidebar-section-header:active i {
  color: var(--accent-color) !important;
}

.sidebar-section-content {
  margin-top: var(--spacing-sm);
}

.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav-item {
  margin-bottom: 0.5rem;
}

.sidebar-nav-item input[type="checkbox"] {
  margin-right: 0.5rem;
  margin-bottom: 0;
  flex-shrink: 0;
}

.sidebar-nav-item label {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  line-height: 1.1;
  cursor: pointer;
  color: var(--text-primary);
}

/* Sidebar Structure - Shared */
.sidebar-header {
  flex-shrink: 0;
  width: 100%;
  padding: var(--spacing-lg);
  padding-bottom: var(--spacing-xs);
}

.sidebar-content {
  flex: 1;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--spacing-md) var(--spacing-lg);
  padding-top: var(--spacing-xs);
}

/* Sidebar Toggle Button - Base Styles */
.sidebar-toggle {
  position: fixed;
  top: 50%;
  width: 32px;
  height: 32px;
  background: var(--primary-color);
  border: 2px solid var(--surface-color);
  border-radius: 50%;
  color: var(--text-inverse);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: var(--transition-normal);
  z-index: 1000;
  box-shadow: var(--shadow-md);
  transform: translateY(-50%);
  opacity: 0.9;
}

.sidebar-toggle:focus {
  outline: none;
  box-shadow:
    var(--shadow-lg),
    0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
  opacity: 1;
}

/* Footer - Base Styles */
.footer {
  background: var(--surface-color);
  border-top: 1px solid var(--border-color);
  padding: var(--spacing-sm);
  font-size: 0.75rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
  z-index: 2;
  position: relative;
  line-height: 1;
  transition: var(--transition-normal);
}

.footer a {
  color: var(--primary-color);
  text-decoration: none;
  transition: var(--transition-fast);
}

.footer a:hover {
  color: var(--accent-color);
  text-decoration: underline;
}

/* Mobile Navigation Styles */
@media (max-width: 768px) {
  /* Hide navbar text on mobile */
  .navbar-text {
    display: none;
    visibility: hidden;
  }

  /* Body adjustments for mobile */
  body {
    margin-left: 0;
    min-width: auto;
    padding-top: 60px;
    transition: var(--transition-normal);
  }

  body.sidebar-expanded {
    margin-left: 200px;
  }

  /* Mobile navbar brand styling */
  .navbar-brand.d-md-none {
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .navbar-brand.d-md-none img {
    height: 32px;
    width: auto;
    display: block;
    max-width: 100%;
    transform: scale(1.5);
  }

  /* Top navbar styling for mobile */
  .navbar.navbar-light {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--surface-color) !important;
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
  }

  /* Mobile navigation toggle button */
  .navbar-toggler {
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius-md);
    width: 36px;
    height: 36px;
    color: var(--text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: var(--transition-normal);
    box-shadow: var(--shadow-md);
  }

  .navbar-toggler i {
    color: var(--text-inverse) !important;
  }

  .navbar-toggler:hover {
    background: var(--accent-color);
    transform: scale(1.05);
  }

  .navbar-toggler:hover i {
    color: var(--text-inverse) !important;
  }

  .navbar-toggler:focus {
    outline: none;
    box-shadow:
      var(--shadow-lg),
      0 0 0 3px rgba(var(--primary-color-rgb), 0.2);
  }

  /* Mobile navigation menu improvements */
  .navbar-collapse {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-top: var(--spacing-sm);
    padding: var(--spacing-md);
    box-shadow: var(--shadow-lg);
  }

  /* Mobile navbar navigation links */
  .navbar-collapse .navbar-nav .nav-link {
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-xs);
    color: var(--text-primary) !important;
    transition: var(--transition-fast);
    text-decoration: none;
  }

  .navbar-collapse .navbar-nav .nav-link:hover,
  .navbar-collapse .navbar-nav .nav-link:focus,
  .navbar-collapse .navbar-nav .nav-link:active {
    background: var(--background-secondary);
    color: var(--accent-color) !important;
    text-decoration: none;
  }

  /* Mobile dropdown improvements */
  .navbar-collapse .dropdown {
    color: var(--text-primary) !important;
  }

  .navbar-collapse .dropdown-content {
    position: static;
    display: block;
    background: var(--background-secondary);
    border: none;
    border-radius: var(--radius-sm);
    margin-top: var(--spacing-xs);
    box-shadow: none;
  }

  .navbar-collapse .dropdown-content a {
    padding: var(--spacing-xs) var(--spacing-md);
    font-size: 0.875rem;
    margin: 0;
    color: var(--text-primary) !important;
    text-decoration: none;
    transition: var(--transition-fast);
  }

  .navbar-collapse .dropdown-content a:hover,
  .navbar-collapse .dropdown-content a:focus,
  .navbar-collapse .dropdown-content a:active {
    background: var(--surface-elevated);
    color: var(--accent-color) !important;
    text-decoration: none;
  }

  /* Mobile navbar text elements */
  .navbar-collapse .navbar-text {
    color: var(--text-primary) !important;
  }

  .navbar-collapse * {
    color: var(--text-primary);
  }

  .navbar-collapse a {
    color: var(--text-primary) !important;
  }

  .navbar-collapse a:hover,
  .navbar-collapse a:focus,
  .navbar-collapse a:active {
    color: var(--accent-color) !important;
  }

  /* Mobile sidebar - collapsed by default */
  .navbar.fixed-left {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 0;
    flex-flow: column nowrap;
    align-items: flex-start;
    padding: 0;
    z-index: 1000;
    transition: var(--transition-normal);
    overflow: hidden;
    display: flex;
    border-right: none;
    border-radius: 0 !important;
    margin: 0 !important;
  }

  .navbar.fixed-left.expanded {
    width: 200px;
    border-right: 1px solid var(--border-color);
    border-radius: 0 !important;
  }

  /* Mobile sidebar toggle positioning */
  .sidebar-toggle {
    left: -14px;
  }

  body.sidebar-expanded .sidebar-toggle {
    left: 180px;
  }

  .sidebar-toggle:hover {
    transform: translateY(-50%) translateX(-2px);
  }

  body.sidebar-expanded .sidebar-toggle:hover {
    transform: translateY(-50%);
  }

  /* Mobile top navbar positioning */
  .navbar:not(.fixed-left) {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--background-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    transition: var(--transition-normal);
  }

  body.sidebar-expanded .navbar:not(.fixed-left) {
    left: 200px;
  }

  .main-page {
    padding: var(--spacing-xs);
  }
}

/* Desktop Navigation Styles */
@media (min-width: 769px) {
  /* Body adjustments for desktop */
  body {
    margin-left: 200px;
    padding-top: 60px;
    transition: var(--transition-normal);
  }

  body.sidebar-collapsed {
    margin-left: 0;
  }

  /* Top navbar for desktop */
  .navbar:not(.fixed-left) {
    position: fixed;
    top: 0;
    left: 200px;
    right: 0;
    background: var(--background-secondary);
    border-bottom: 1px solid var(--border-color);
    z-index: 999;
    transition: var(--transition-normal);
  }

  body.sidebar-collapsed .navbar:not(.fixed-left) {
    left: 0;
  }

  .navbar:not(.fixed-left) .navbar-brand,
  .navbar:not(.fixed-left) .navbar-nav .nav-link {
    color: var(--text-primary);
  }

  .navbar:not(.fixed-left) .navbar-nav .nav-link:hover {
    color: var(--accent-color);
  }

  /* Desktop sidebar */
  .navbar.fixed-left {
    background: var(--surface-color);
    border-right: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 200px;
    flex-flow: column nowrap;
    align-items: flex-start;
    padding: 0;
    z-index: 1000;
    transition: var(--transition-normal);
    overflow: hidden;
    display: flex;
  }

  .navbar.fixed-left.collapsed {
    width: 0;
    padding: 0;
    border-right: none;
    overflow: hidden;
  }

  /* Custom scrollbar for sidebar */
  .sidebar-content::-webkit-scrollbar {
    width: 6px;
  }

  .sidebar-content::-webkit-scrollbar-track {
    background: var(--background-secondary);
    border-radius: var(--radius-sm);
  }

  .sidebar-content::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: var(--radius-sm);
    transition: var(--transition-fast);
  }

  .sidebar-content::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
  }

  /* Desktop sidebar toggle positioning */
  .sidebar-toggle {
    left: 180px;
  }

  body.sidebar-collapsed .sidebar-toggle {
    left: -14px;
  }

  body.sidebar-collapsed .sidebar-toggle:hover {
    transform: translateY(-50%) translateX(-2px);
  }

  /* Sidebar navigation structure */
  .navbar.fixed-left .navbar-collapse {
    flex-grow: 0;
    flex-direction: column;
    width: 100%;
  }

  .navbar.fixed-left .navbar-collapse .navbar-nav {
    flex-direction: column;
    width: 100%;
  }

  .navbar.fixed-left .navbar-collapse .navbar-nav .nav-item {
    width: 100%;
  }

  .navbar.fixed-left .navbar-collapse .navbar-nav .nav-item .dropdown-menu {
    top: 0;
    left: 100%;
  }

  .navbar.fixed-left .navbar-nav .nav-item .dropdown-toggle:after {
    border-top: 0.3em transparent;
    border-left: 0.3em solid;
    border-bottom: 0.3em transparent;
    border-right: none;
    vertical-align: baseline;
  }
}

/* Collapse classes for smaller screens */
@media (max-width: 1280px) {
  #skills_id {
    display: none;
  }

  #domains_id {
    display: none;
  }

  #modules_id {
    display: none;
  }
}

@media (min-width: 1280px) {
  #classes_id {
    display: none;
  }
}

/* Schema action buttons styling */
.btn-group[aria-label="Schema actions"] {
  display: flex;
  gap: 4px;
}

.profile-badges {
  gap: var(--spacing-xs);
}

.profile-badge {
  font-size: 0.7rem;
  padding: 2px 6px;
}

.profile-badge i {
  font-size: 0.6rem;
}

/* Content Layout Improvements */
.description-content {
  line-height: 1.7;
  font-size: 0.875rem;
  max-width: none; /* Remove any width restrictions */
}

/* Horizontal Controls Bar */
.row.align-items-center.mb-3 {
  padding-top: var(--spacing-sm);
  margin-bottom: var(--spacing-lg) !important;
  justify-content: space-between;
}

.row.align-items-center.mb-3 .col-auto:first-child {
  margin-right: auto;
}

.row.align-items-center.mb-3 .col-auto:not(:first-child) {
  margin-left: var(--spacing-md);
}

.row.align-items-center.mb-3 .col-auto:last-child {
  margin-left: var(--spacing-md);
}

/* Button group styling in horizontal layout */
.row .btn-group .btn {
  font-size: 0.875rem;
  padding: var(--spacing-xs) var(--spacing-sm);
}

/* Form controls in horizontal layout */
.row .form-control {
  min-width: 200px;
}

.row .selectpicker {
  min-width: 180px;
}

/* Show deprecated container in horizontal layout */
.row .show-deprecated-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  white-space: nowrap;
}

/* Mobile Responsive Layout */
@media (max-width: 768px) {
  .row.align-items-center.mb-3 {
    flex-direction: column;
    align-items: stretch !important;
    gap: var(--spacing-sm);
  }

  .row.align-items-center.mb-3 .col-auto {
    margin-right: 0;
    margin-bottom: var(--spacing-sm);
  }

  .row.align-items-center.mb-3 .col-auto:last-child {
    margin-bottom: 0;
  }

  .row .btn-group {
    display: flex;
    justify-content: center;
  }

  .row .form-control,
  .row .selectpicker {
    min-width: auto;
    width: 100%;
  }

  .row .show-deprecated-container {
    justify-content: center;
  }
}

/* Large Desktop Layout */
@media (min-width: 1200px) {
  .description-content {
    font-size: 1rem;
    line-height: 1.8;
  }
}

/* Graph defaults */
#network {
  width: 100%;
  height: 100vh;
}

/* Bootstrap Selectpicker Dropdown Positioning Fix */
.bootstrap-select .dropdown-menu {
  max-width: 300px;
  overflow-x: auto;
}

/* Force dropdown to open to the left when near right edge */
.fixed-right .bootstrap-select .dropdown-menu {
  right: 0;
  left: auto;
  transform: translateX(0);
}

/* Ensure dropdown doesn't extend beyond viewport */
.bootstrap-select.dropup .dropdown-menu,
.bootstrap-select .dropdown-menu {
  max-height: 350px;
  overflow-y: auto;
}

/* Fix for selectpicker when positioned on the right side */
.col-md-auto.fixed-right .bootstrap-select .dropdown-menu {
  right: 0 !important;
  left: auto !important;
  min-width: 250px;
  max-width: 300px;
}

/* Fix for selectpicker in horizontal controls bar (object/class pages) */
.row.align-items-center .col-auto:last-child .bootstrap-select .dropdown-menu {
  right: 0 !important;
  left: auto !important;
  min-width: 250px;
  max-width: 300px;
}

/* General fix for any selectpicker near the right edge */
.bootstrap-select:last-child .dropdown-menu,
.col-auto:last-child .bootstrap-select .dropdown-menu {
  right: 0 !important;
  left: auto !important;
}
