/* -----------------------------------------------------------------------------------
 * Originally found at https://userstyles.org/styles/139070/osticket-dark-theme
 * Some modifications by Privex Inc.   https://github.com/Privex/osticket-dark
 * -----------------------------------------------------------------------------------
 */
body, html
  {
    background: #2d2d2d;
    color: #bcbcbc;
  }

  .type-icon
  {
    background-color: #1d1d1d;
    /* border: 1px solid #1d1d1d; */;
  }

  .thread-event .type-icon::after
  {
    border: 16px solid #1d1d1d;
  }

  .dialog
  {
    background: #2d2d2d;
    border: 2px solid #e0b400;
  }

  .dialog th
  {
    background: #2d2d2d;
  }

  .thread-body
  {
    color: #bcbcbc;
    background-color: #2d2d2d;
  }

  .thread-entry::before
  {
    border-top: 2px solid #2d2d2d;
  }

  .thread-entry::after
  {
    border-bottom: 2px solid #2d2d2d;
  }

  .thread-entry .faded.title {
    color: #712929;
  }

  .ticket_info
  {
    background: #2d2d2d;
  }

  .tip_content
  {
    background: #2d2d2d;
  }

  .tixTitle h3
  {
    color: #bcbcbc;
  }

  .ticket_info.custom-data thead th
  {
    background-color: #2d2d2d;
  }

  ul.tabs.clean li.active
  {
    background-color: #1d1d1d;
  }

  .sticky.bar.fixed
  {
    background: #2d2d2d;
  }

  select
  {
    background: #bcbcbc;
  }

  .select2-container--default .select2-selection--single
  {
    background-color: #bcbcbc;
  }

  table.list
  {
    background-color: #2d2d2d;
  }

  table.list thead th
  {
    background-color: #2d2d2d;
    color: #bcbcbc;
    border: 1px solid #bbb;
  }

  element.style
  {
    background-color: #849984;
  }

  table.list tbody tr:hover td,
table.list tbody tr.highlight td
  {
    background: #878774;
  }

  table.list tbody tr:nth-child(2n+1):hover td
  {
    background: #878774;
  }

  table.dashboard-stats tbody:nth-child(2) tr:hover
  {
    background-color: #878774;
  }

  table.list thead th a.asc
  {
    background-color: #878774;
  }

  table.list thead th a.desc
  {
    background-color: #878774;
  }

  table tfoot td
  {
    background: #2d2d2d;
  }

  table.list tbody td
  {
    /*background: #5a5a5a; */
    background: #3d3d3d;
  }

  table.list tbody tr:nth-child(2n+1) td
  {
    background-color: #3d3d3d;
  }

  #header
  {
    background-color: #2d2d2d;
    border-top: 1px solid #aaa;
  }

  #container {
    margin: 15px auto 20px auto !important;
  }

  #sub_nav
  {
    background: #2d2d2d;
  }

  #basic_search
  {
    background-color: #2d2d2d;
  }

  #nav .active a
  {
    color: #e0b400;
  }

  #nav .inactive a
  {
    color: #e0b400;
  }

  #nav .active,
#nav .inactive
  {
    color: #e0b400;
  }

  #nav li.inactive > ul
  {
    background: #2d2d2d;
  }

  #nav li.active
  {
    background-color: #2d2d2d;
  }

  table.list thead th a
  {
    color: #bcbcbc;
  }

  #content
  {
    border-bottom: 1px solid #bbb;
    background: #1d1d1d;
  }

  #sub_nav a
  {
    color: #bcbcbc;
  }

  .form_table th,
div.section-break
  {
    background: #1d1d1d;
  }

  #header p
  {
    background: #1d1d1d;
  }

  #nav
  {
    background: #2d2d2d;
  }

  #nav li.active
  {
    background-color: #2d2d2d;
  }

  #nav li.inactive:hover
  {
    background-color: #2d2d2d;
  }

  a
  {
    color: #e0b400;
  }

  .dialog a
  {
    color: #e0b400;
  }

  h2
  {
    color: #e0b400;
  }

  .action-button,
.action-button.muted,
.button
  {
    color: #e0b400;
    box-shadow: 0 0 0 1px #e0b400 inset;
  }

  .dialog h3
  {
    color: #e0b400;
  }

  .green.button:hover
  {
    box-shadow: 0 0 0 2px #16ab39 inset;
    color: #16ab39;
  }

  .button:hover,
.button:active,
.action-button:hover,
.action-button:active,
input[type=button]:hover,
input[type=button]:active,
input[type=reset]:hover,
input[type=reset]:active
  {
    color: #e0b400;
    box-shadow: 0 0 0 2px #e0b400 inset;
  }

  .quicknote a.action,
.floating-options a.action
  {
    color: #e0b400 !important;
  }

  .link.truncate
  {
    color: #e0b400;
  }

  input[type=text],
input[type=password],
textarea,
input
  {
    background: #bcbcbc;
  }

  .form_table th em
  {
    color: #bcbcbc;
  }

  .link,
a
  {
    color: #e0b400;
  }

  table
  {
    border-collapse: collapse;
  }

  ul.tabs
  {
    background: #1d1d1d;
  }

  #response_options > form
  {
    background: #1d1d1d;
  }

  ul.tabs li.active
  {
    color: #bcbcbc;
    background-color: #1d1d1d;
  }

  ul.tabs li.active a
  {
    color: #bcbcbc;
  }

  .redactor-editor,
.redactor-box
  {
    background: #3d3d3d;
  }

  .faded
  {
    color: #bcbcbc;
  }

  .faded b
  {
    color: #bcbcbc;
  }

  .faded strong
  {
    color: #16ab39;
  }

  .faded-more
  {
    color: #bcbcbc;
  }

  button[type=submit]:hover,
input[type=submit]:hover,
input[type=submit]:active
  {
    color: #16ab39;
    box-shadow: 0 0 0 2px #16ab39 inset;
  }

  .thread-body .attachments
  {
    background-color: #2d2d2d;
  }

  .priority.low
  {
    color: #b3ffa3;
    /* background-color: #93c3e2!important; */
    background-color: #3d3d3d!important;
  }

  .priority.normal
  {
    color: #aaf5ff;
    background-color: #3d3d3d!important;
  }

  .priority.high
  {
    color: #ffa3a3;
    /* background-color: #e8877d!important; */
    background-color: #3d3d3d!important;
  }

  .priority.emergency
  {
    color: #ee5f5b;
    background-color: #3d3d3d!important;
  }

  #msg_warning,
.warning-banner
  {
    background-color: #2d2d2d;
  }

  table.dashboard-stats tbody:nth-child(2) tr:nth-child(odd)
  {
    background-color: #2d2d2d;
  }

  /* The word "posted" in the message thread header */
  div.thread-entry.message .header, div.thread-entry.response .header {
    color: #555;
  }
  
  /* Customer/Staff name in message thread */
  div.thread-entry.message .header > b, div.thread-entry.response .header > b {
    color: #000;
  }

  /* Signature preview box under response editor */
  #resp_sec div.selected-signature {
    background: #000;
    color: #fff;
  }


/* --- Client Portal Overrides --- */

/* Knowledgebase Categories */
#kb > li {
    background: #2d2d2d !important;
    border-bottom: 1px solid #444 !important;
    color: #bcbcbc;
}

#kb > li h4 a {
    color: #e0b400 !important; /* Gold/Yellow accent for links */
}

#kb > li .faded {
    color: #888 !important;
}

/* Featured Categories (Front Page) */
.featured-category {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
    color: #bcbcbc;
}

.featured-category .category-name {
    color: #e0b400 !important;
}

.featured-category .article-headline .article-title a {
    color: #bcbcbc !important;
}

.featured-category .article-headline .article-teaser {
    color: #888 !important;
}

/* Search Bar */
.search-form {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
}

.search-form input[type="text"] {
    background: #1d1d1d !important;
    color: #bcbcbc !important;
    border: 1px solid #444 !important;
}

/* Sidebar */
.sidebar .content {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
}

/* General Content Areas */
#content {
    background: #2d2d2d !important;
}

.main-content {
    background: #2d2d2d !important;
}

/* Buttons */
.button, .button:hover {
    color: #fff !important;
}


/* --- User Customizations --- */

/* Invert Logo to White */
#logo img {
    filter: brightness(0) invert(1);
}

/* Submenu Text Color (Staff Panel) */
#sub_nav a {
    color: #e0b400 !important;
}

/* Client Portal Navigation (if that's what was meant) */
#nav li a {
    color: #e0b400 !important;
}

/* Ensure active state is distinct or readable */
#nav li.active a {
    color: #fff !important; /* Keep active white or different */
}

/* --- Profile Page Fixes --- */

/* Fix white background in tab content */
.tab_content {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    color: #bcbcbc !important;
}

/* Fix tables inside tabs */
.tab_content table {
    background-color: #2d2d2d !important;
}

/* Fix input fields background */
input[type="text"], input[type="password"], input[type="tel"], input[type="email"], textarea, select {
    background-color: #1d1d1d !important;
    color: #bcbcbc !important;
    border: 1px solid #444 !important;
}

/* Fix Avatar container if needed */
.avatar {
    background-color: transparent !important;
}

/* Fix Authentication and Status sections */
form.save table {
    background-color: #2d2d2d !important;
}

/* Fix any white backgrounds on table cells */
td {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
}

/* Fix the white background in the 'Authentication' and 'Status' sections which might be using specific classes */
.tab_content .table {
    background: #2d2d2d !important;
}


/* --- Redactor / Rich Text Editor Fixes --- */

/* The main editor box */
.redactor-box {
    border: 1px solid #444 !important;
    background-color: #2d2d2d !important;
}

/* The toolbar */
.redactor-toolbar {
    background-color: #1d1d1d !important;
    border-bottom: 1px solid #444 !important;
}

.redactor-toolbar li a {
    color: #bcbcbc !important;
}

.redactor-toolbar li a:hover {
    background-color: #333 !important;
    color: #fff !important;
}

/* The content editable area */
.redactor-editor {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
}

/* If it's just a textarea (fallback) */
textarea.richtext {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
    border: 1px solid #444 !important;
}

/* Specific targeting for the signature tab */
#signature textarea, 
#signature .redactor-editor {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
}

/* Ensure text inside is readable */
.redactor-editor p, .redactor-editor div {
    color: #bcbcbc !important;
}

/* --- Redactor 3 Specific Fixes --- */

/* Main container */
.redactor-box {
    border: 1px solid #444 !important;
    background-color: #2d2d2d !important;
}

/* Content area (Redactor 3 uses .redactor-in) */
.redactor-in {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
    min-height: 150px; /* Ensure it has height */
}

/* Ensure all text inside is visible */
.redactor-in * {
    color: #bcbcbc !important;
}

/* Toolbar wrapper */
.redactor-toolbar-wrapper {
    background-color: #1d1d1d !important;
}

/* Toolbar itself */
.redactor-toolbar {
    background-color: #1d1d1d !important;
    border-bottom: 1px solid #444 !important;
    box-shadow: none !important;
}

/* Toolbar buttons */
.redactor-toolbar a {
    color: #bcbcbc !important;
}

.redactor-toolbar a:hover,
.redactor-toolbar a.redactor-act,
.redactor-toolbar a.redactor-button-active {
    background-color: #333 !important;
    color: #fff !important;
}

/* Dropdowns (e.g. formatting) */
.redactor-dropdown {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5) !important;
}

.redactor-dropdown a {
    color: #bcbcbc !important;
}

.redactor-dropdown a:hover {
    background-color: #444 !important;
    color: #fff !important;
}

/* Source view */
.redactor-source-view {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
}

/* --- Dropdown Menus (Action, NoClick, Custom Queue) --- */

/* General Dropdown Containers */
.action-dropdown ul, 
.noclick-dropdown ul,
.search-dropdown ul,
.jb-overflowmenu-menu-primary div.customQ-dropdown {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    box-shadow: 0 5px 10px rgba(0, 0, 0, 0.5) !important;
}

/* List Items & Links */
.action-dropdown ul li > a, 
.noclick-dropdown ul li > a,
.customQ-dropdown ul li, 
.customQ-dropdown ul li > a,
.customQ-dropdown ul li > span {
    color: #bcbcbc !important;
}

/* Hover States */
.action-dropdown ul li > a:hover,
.noclick-dropdown ul li > a:hover,
.customQ-dropdown ul li:not(.personalQ):hover,
.customQ-dropdown ul li:hover > a,
.customQ-dropdown ul li:hover > span {
    background-color: #333 !important;
    color: #fff !important;
}

/* Custom Queue Headers */
.customQ-dropdown li h4,
.customQ-dropdown li.top-level {
    background-color: #333 !important;
    color: #bcbcbc !important;
    border-bottom: 1px solid #444 !important;
}

/* Custom Queue Separator (Personal Queue) */
.customQ-dropdown li.personalQ {
    background-color: #2d2d2d !important;
    border-bottom: 1px dashed #444 !important;
}

/* Add Personal Queue Button */
.customQ-dropdown .add-queue a {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
    border-top: 1px solid #444 !important;
}

.customQ-dropdown .add-queue a:hover {
    background-color: #333 !important;
    color: #fff !important;
}

/* Arrows for Action/NoClick Dropdowns */
.action-dropdown:after, 
.noclick-dropdown:after {
    border-bottom-color: #2d2d2d !important;
}

.action-dropdown:before, 
.noclick-dropdown:before {
    border-bottom-color: #444 !important;
}

/* Icons in dropdowns */
.customQ-dropdown ul li.subQ > a i {
    color: #bcbcbc !important;
}

/* --- Text Input & Textarea Text Color Fix --- */

/* Force white text on all inputs and textareas */
input[type="text"],
input[type="password"],
input[type="search"],
input[type="email"],
input[type="tel"],
input[type="url"],
input[type="number"],
textarea,
select {
    color: #fff !important;
}

/* Redactor Editor Text Color (White) */
.redactor-in,
.redactor-in *,
.redactor-editor,
.redactor-editor * {
    color: #fff !important;
}

/* Redactor Status Bar (Draft Saved message) */
.redactor-statusbar {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
    border-top: 1px solid #444 !important;
}

.redactor-statusbar li,
.redactor-statusbar span,
.redactor-statusbar a {
    color: #bcbcbc !important;
}

/* Fix for the specific white bar in the screenshot */
.redactor-box .redactor-statusbar {
    background-color: #2d2d2d !important;
    color: #fff !important;
}

/* --- Select2 Dark Mode Fixes --- */

/* Main Container */
.select2-container--default .select2-selection--single,
.select2-container--default .select2-selection--multiple {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    color: #fff !important;
}

/* Text Color in Selection */
.select2-container--default .select2-selection--single .select2-selection__rendered,
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    color: #fff !important;
}

/* Multiple Selection Choice Chips */
.select2-container--default .select2-selection--multiple .select2-selection__choice {
    background-color: #444 !important;
    border: 1px solid #555 !important;
}

/* Dropdown Container */
.select2-dropdown {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    color: #bcbcbc !important;
}

/* Search Box inside Dropdown */
.select2-search__field {
    background-color: #1d1d1d !important;
    color: #fff !important;
    border: 1px solid #444 !important;
}

/* Results List */
.select2-results__option {
    color: #bcbcbc !important;
}

/* Highlighted/Hovered Option */
.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #08C !important; /* Keep the blue highlight or use #333 */
    color: #fff !important;
}

/* Selected Option */
.select2-container--default .select2-results__option[aria-selected="true"] {
    background-color: #333 !important;
    color: #fff !important;
}

/* Placeholder */
.select2-container--default .select2-selection--single .select2-selection__placeholder {
    color: #999 !important;
}

/* Fix for the specific Help Topics dropdown which might be using a different theme or structure */
#help-topic-selection + .select2-container .select2-selection,
#help-topic-selection + .select2-container .select2-dropdown {
    background-color: #2d2d2d !important;
    border-color: #444 !important;
}

/* --- Dashboard & Ticket Activity Fixes --- */

/* Ticket Activity Chart Container */
#line-chart-here {
    background: #2d2d2d !important;
    border: 1px solid #444 !important;
}

/* Chart Text (SVG tspans) */
#line-chart-here tspan {
    fill: #bcbcbc !important;
}

/* Dashboard Statistics Table */
.dashboard-stats {
    background-color: #2d2d2d !important;
    color: #bcbcbc !important;
}

.dashboard-stats th {
    background-color: #333 !important;
    color: #fff !important;
    border-bottom: 1px solid #444 !important;
}

.dashboard-stats td {
    border-bottom: 1px solid #444 !important;
    color: #bcbcbc !important;
}

/* Dashboard Tabs */
.tabs.clean li a {
    background-color: #2d2d2d !important;
    border: 1px solid #444 !important;
    color: #bcbcbc !important;
}

.tabs.clean li.active a {
    background-color: #333 !important;
    color: #fff !important;
    border-bottom: 1px solid #333 !important;
}

/* Legend Text */
#line-chart-legend {
    color: #bcbcbc !important;
}

/* --- Submenu Navigation Hover Fix --- */

/* Top-level menu items in the sub-nav (like Open, My Tickets, Closed) */
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover {
    background-color: #333 !important;
    border-color: #444 !important;
    color: #fff !important;
}

/* The link text inside the hovered item */
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover > a {
    color: #fff !important;
}

/* Ensure the dropdown arrow/icon is also visible */
#customQ_nav .jb-overflowmenu-menu-primary li.item:hover a > i {
    color: #fff !important;
}

/* Fix for standard sub_nav items if they have similar issues */
#sub_nav > li > a:hover {
    color: #fff !important;
}
