/* Custom styles for OSDx Documentation */

/* Widen main content area */
.wy-nav-content {
  max-width: 60%;
}

/* Search Results Styling */

/* Cap notice message */
.search-cap-notice {
  background-color: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 4px;
  padding: 12px 15px;
  margin: 15px 0;
  color: #856404;
  font-size: 0.95em;
  line-height: 1.5;
}

.search-cap-notice strong {
  color: #664d03;
  font-weight: 600;
}

/* Search results container — hidden until enhancement pass completes,
   then faded in via the .search-ready class added by searchscore.js */
ul.search {
  padding-left: 0;
  list-style: none;
  opacity: 0;
  transition: opacity 0.15s ease-in;
}

ul.search.search-ready {
  opacity: 1;
}

ul.search li {
  margin: 15px 0;
  padding: 12px;
  border-left: 3px solid transparent;
  background-color: #f8f9fa;
  border-radius: 2px;
  transition: all 0.2s ease;
}

ul.search li:hover {
  border-left-color: #0066cc;
  background-color: #e7f3ff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Search result link */
ul.search li a {
  display: block;
  font-size: 1.05em;
  font-weight: 600;
  color: #0066cc;
  text-decoration: none;
  margin-bottom: 8px;
  word-wrap: break-word;
}

ul.search li a:hover {
  text-decoration: underline;
  color: #0052a3;
}

/* Search result description (Sphinx default snippet text).
   Exclude highlight spans so they stay inline within the text flow. */
ul.search li > span:not(.highlighted) {
  display: block;
  color: #666;
  font-size: 0.9em;
  font-style: italic;
  word-wrap: break-word;
  line-height: 1.4;
}

/* Score badge (if visible) */
ul.search li a[data-score] {
  position: relative;
}

/* Search summary */
.search-summary {
  padding: 10px 0;
  color: #666;
  font-size: 0.95em;
  margin-bottom: 20px;
}

/* Content-type badges — specificity must beat ul.search li span (0,1,2) */
ul.search li span.search-badge {
  display: block;
  font-size: 0.7em;
  font-weight: 600;
  font-style: normal;
  padding: 4px 12px;
  border-radius: 0;
  margin: -12px -12px 8px -12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
ul.search li span.search-badge-article { background: #d4edda; color: #155724; }
ul.search li span.search-badge-guide   { background: #ffccbc; color: #bf360c; }
ul.search li span.search-badge-command  { background: #c5cae9; color: #1a237e; }
ul.search li span.search-badge-example  { background: #ffe69c; color: #664d03; }

/* Breadcrumb path — specificity must beat ul.search li span (0,1,2) */
ul.search li span.search-breadcrumb {
  display: block;
  font-size: 0.8em;
  font-style: normal;
  color: #000;
  margin-top: 2px;
  margin-bottom: 4px;
}

/* "Did you mean …?" suggestion banner */
.search-did-you-mean {
  background: linear-gradient(135deg, #e3f2fd 0%, #f3e5f5 100%);
  border: none;
  border-left: 4px solid #42a5f5;
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  margin: 20px 0;
  font-size: 1em;
  line-height: 1.7;
  color: #37474f;
  box-shadow: 0 2px 8px rgba(66, 165, 245, 0.15);
  position: relative;
  overflow: hidden;
}

.search-did-you-mean::before {
  content: "\f002";
  font-family: FontAwesome;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 2.5em;
  color: rgba(66, 165, 245, 0.12);
}

.search-did-you-mean a {
  font-weight: 700;
  color: #1565c0;
  text-decoration: none;
  background: rgba(255, 255, 255, 0.6);
  padding: 2px 10px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.search-did-you-mean a:hover {
  color: #0d47a1;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.search-did-you-mean small {
  color: #78909c;
  display: block;
  margin-top: 2px;
}

/* Phrase search tip — shown for multi-word queries without quotes */
.search-phrase-tip {
  background: #f0f4f8;
  border: 1px solid #d0d7de;
  border-left: 4px solid #57606a;
  border-radius: 0 6px 6px 0;
  padding: 10px 16px;
  margin: 12px 0;
  font-size: 0.9em;
  line-height: 1.6;
  color: #424a53;
}

.search-phrase-tip strong {
  color: #1a7f37;
}

.search-phrase-tip small {
  color: #78909c;
  display: block;
  margin-top: 2px;
}

/* ========================================================================
   Autocomplete dropdown
   ======================================================================== */

.search-autocomplete {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 9999;
  background: #fff;
  border: 1px solid #ccc;
  border-top: none;
  border-radius: 0 0 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  max-height: 400px;
  overflow-y: auto;
}

/* Group headers */
.ac-group-header {
  padding: 6px 12px;
  font-size: 0.7em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #888;
  background: #f5f5f5;
  border-top: 1px solid #eee;
}

.ac-group-header:first-child {
  border-top: none;
}

/* Individual suggestion items */
.ac-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  align-items: baseline;
  transition: background-color 0.1s ease;
}

.ac-item:hover,
.ac-item-active {
  background-color: #e7f3ff;
}

.ac-item-text {
  font-size: 0.9em;
  font-weight: 600;
  color: #333;
}

.ac-item-hint {
  font-size: 0.8em;
  color: #888;
  margin-left: 6px;
  font-style: italic;
}

/* Recent search items — clock icon before text */
.ac-item-recent .ac-item-text::before {
  content: "\f017";
  font-family: FontAwesome;
  margin-right: 8px;
  font-size: 0.85em;
  color: #aaa;
  font-weight: 400;
}

/* Remove button (×) on recent search items */
.ac-item-remove {
  margin-left: auto;
  padding: 0 4px;
  font-size: 1.1em;
  color: #bbb;
  cursor: pointer;
  line-height: 1;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.ac-item-remove:hover {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

/* Sidebar-specific adjustments — the RTD sidebar search is narrower */
.wy-side-nav-search .search-autocomplete {
  border-color: rgba(255, 255, 255, 0.3);
  background: #2b2b2b;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.wy-side-nav-search .ac-group-header {
  background: #333;
  color: #aaa;
  border-color: #444;
}

.wy-side-nav-search .ac-item:hover,
.wy-side-nav-search .ac-item-active {
  background-color: #3a3a3a;
}

.wy-side-nav-search .ac-item-text {
  color: #eee;
}

.wy-side-nav-search .ac-item-hint {
  color: #999;
}

.wy-side-nav-search .ac-item-recent .ac-item-text::before {
  color: #777;
}

.wy-side-nav-search .ac-item-remove {
  color: #777;
}

.wy-side-nav-search .ac-item-remove:hover {
  color: #ef5350;
  background: rgba(239, 83, 80, 0.15);
}

/* Make code/pre elements inside highlights transparent so the yellow
   highlight background shows through their default frame/background. */
span.highlighted code,
span.highlighted .pre,
span.highlighted .docutils,
span.highlighted .literal,
span.highlighted .notranslate {
  background-color: transparent !important;
  border-color: transparent !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  ul.search li {
    padding: 10px;
  }

  ul.search li a {
    font-size: 1em;
  }

  .search-cap-notice {
    font-size: 0.9em;
    padding: 10px 12px;
  }

  .search-autocomplete {
    max-height: 250px;
  }
}

/* ========================================================================
   Device & info badges (command reference pages)
   ======================================================================== */

/* Base badge */
.badge {
  color: white;
  padding: 2px 5px;
  text-align: center;
  border-radius: 8px;
}

.rst-content .badge .highlighted {
  padding: 0px;
  border-radius: 16px;
  font-size: 110%;
}

/* Devices badge */
.devices-badge {
  background-color: #5b7dab;
  font-size: 0.85em;
  cursor: help;
}

/* License badge */
.license-badge {
  background-color: #e8a317;
  font-size: 0.85em;
  cursor: help;
}

/* ========================================================================
   Field list styling (Values, Instances, Required)
   Sphinx 7+ renders field lists as <dl> instead of <table>,
   so RTD theme table.field-list styles no longer apply.
   ======================================================================== */

.rst-content dl.field-list {
  display: grid !important;
  grid-template-columns: auto 1fr;
  border: 1px solid #e1e4e5;
  border-radius: 3px;
  margin-bottom: 12px !important;
}

.rst-content dl.field-list > dt {
  padding: 8px 12px;
  font-weight: bold;
  border-bottom: 1px solid #e1e4e5;
  margin: 0 !important;
  margin-bottom: 0 !important;
}

.rst-content dl.field-list > dd {
  padding: 8px 12px;
  margin: 0 !important;
  border-bottom: 1px solid #e1e4e5;
}

.rst-content dl.field-list > dt.field-odd,
.rst-content dl.field-list > dd.field-odd {
  background-color: #f3f6f6;
}

.rst-content dl.field-list > dt.field-even,
.rst-content dl.field-list > dd.field-even {
  background-color: white;
}

/* Required field: values in black */
.rst-content dl.field-list dd code.docutils.literal {
  color: black;
}

/* ========================================================================
   Config syntax highlighting (osdx-config lexer)
   ======================================================================== */

/* Override Pygments sphinx theme background */
.highlight-osdx-config .highlight {
  background: #f8f9fa !important;
}

/* set lines — green bold text (Generic.Inserted → .gi) */
.highlight-osdx-config .gi {
  color: #1e7e34 !important;
  font-weight: 600 !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* delete lines — red bold text (Generic.Deleted → .gd) */
.highlight-osdx-config .gd {
  color: #dc3545 !important;
  font-weight: 600 !important;
  background: none !important;
  background-color: transparent !important;
  border: none !important;
  display: inline !important;
  margin: 0 !important;
  padding: 0 !important;
}

/* comment lines — gray (Comment.Single → .c1) */
.highlight-osdx-config .c1 {
  color: #6c757d;
  font-style: normal;
}

/* ========================================================================
   Regex match output highlighting
   ======================================================================== */

/* Output wrapper */
pre.highlight-output {
  background: #f8f8f8;
  border: 1px solid #e1e4e8;
  border-radius: 4px;
  padding: 12px;
  font-size: 0.85em;
  line-height: 1.5;
  overflow-x: auto;
  white-space: pre;
}

/* Highlighted matching lines */
pre.highlight-output .match-line {
  color: #1e7e34;
  font-weight: 600;
}
