/* Americolor Email Archive theme
 * Persistent customization for Piler 1.4.x.
 * Outlook-inspired colors and a simple search-first workflow.
 */

:root {
  --americolor-blue: #0f6cbd;
  --americolor-blue-dark: #005a9e;
  --americolor-blue-light: #e8f3ff;
  --americolor-canvas: #f5f7fa;
  --americolor-border: #d9e0e7;
  --americolor-text: #242424;
  --americolor-muted: #616161;
}

body {
  background: #fff;
  color: var(--americolor-text);
  font-family: "Segoe UI", "Segoe UI Variable", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: #1f1f1f;
  font-weight: 600;
  text-transform: none;
}

small,
.small,
.form-text,
.text-muted,
.muted {
  color: var(--americolor-muted) !important;
}

/* Outlook-style top bar and persistent Americolor brand suite. */
#header,
#menu {
  min-height: 64px;
}

#menu {
  align-items: center;
  background: var(--americolor-blue);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  color: #fff;
  padding: 4px 14px;
  text-transform: none;
  flex-wrap: nowrap;
}

#menu > .col:first-child {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
}

#menu > .col:last-child {
  flex: 0 0 auto;
  width: auto;
}

#menu .d-flex {
  min-height: 56px;
}

#menu .menulink {
  align-items: center;
  border-radius: 4px;
  color: #fff;
  display: inline-flex;
  font-size: 16px;
  font-weight: 500;
  margin-left: 8px;
  padding: 10px 11px;
  text-transform: none;
}

#menu .menulink:hover,
#menu .menulink:focus {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  text-decoration: none;
}

#menu > .col:first-child .d-flex > .menulink:first-child {
  background: #fff;
  cursor: default;
  margin-left: 0;
  padding: 5px 10px;
}

#menu .branding_logo {
  display: block;
  height: auto;
  max-height: 36px;
  max-width: 290px;
  object-fit: contain;
  width: auto;
}

#menu .dropdown-menu {
  border: 1px solid var(--americolor-border);
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 15px;
  font-weight: 400;
  padding: 6px;
  text-transform: none;
}

#menu a.dropdown-item {
  border-radius: 4px;
  font-weight: 400;
  padding: 8px 12px;
}

#menu a.dropdown-item:hover {
  background: var(--americolor-blue-light);
  color: var(--americolor-blue-dark);
}

/* Search is the primary task. */
.searchcontainer {
  background: #fff;
  border-bottom: 1px solid var(--americolor-border);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
  margin: 0;
  padding: 84px 20px 18px;
}

.searchcontainer > .row,
.searchcontainer .container {
  max-width: none;
}

#_search {
  background: #fff;
  border: 1px solid #a9b4bf;
  border-radius: 6px;
  box-shadow: none;
  color: var(--americolor-text);
  font-size: 16px;
  height: 46px;
  padding: 10px 14px;
}

#_search:focus {
  border-color: var(--americolor-blue);
  box-shadow: 0 0 0 2px rgba(15, 108, 189, 0.18);
}

#button_search,
#button_expert,
#button_options {
  border-radius: 5px;
  font-size: 14px;
  font-weight: 600;
  height: 46px;
  margin-left: 8px;
  text-transform: none;
}

#button_search {
  background: var(--americolor-blue);
  border-color: var(--americolor-blue);
  color: #fff;
}

#button_search:hover,
#button_search:focus {
  background: var(--americolor-blue-dark);
  border-color: var(--americolor-blue-dark);
}

#button_expert,
#button_options {
  background: #fff;
  border: 1px solid #a9b4bf;
  color: var(--americolor-blue-dark);
}

#button_expert:hover,
#button_options:hover {
  background: var(--americolor-blue-light);
}

/* Mail-list presentation modeled after an Outlook inbox. */
.container-panes {
  gap: 0;
  height: calc(100vh - 166px);
  margin-top: 14px !important;
  padding: 0 18px 18px;
}

.pane-upper,
#preview {
  background: #fff;
  border: 1px solid var(--americolor-border);
  border-radius: 7px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.pane-upper-content {
  border: 0;
  border-radius: 7px 7px 0 0;
}

#results {
  color: var(--americolor-text);
  font-size: 14px;
  margin-bottom: 0;
}

#results thead th {
  background: #f0f2f5;
  border: 0;
  border-bottom: 1px solid var(--americolor-border);
  color: #424242;
  font-weight: 600;
  padding: 10px 9px;
  position: sticky;
  text-transform: none;
  top: 0;
  z-index: 5;
}

#results tbody td {
  border: 0;
  border-bottom: 1px solid #e8ebee;
  padding: 9px;
  vertical-align: middle;
}

#date-header,
#results td[id^="c3_r"] {
  min-width: 155px;
  white-space: nowrap;
}

#results .resultrow {
  background: #fff;
  color: var(--americolor-text);
  font-style: normal;
  transition: background-color 0.12s ease;
}

#results .resultrow:nth-child(even) {
  background: #fafbfc;
}

#results .resultrow:hover {
  background: var(--americolor-blue-light);
}

#results .resultrow.highlighted,
#results .resultrow.highlighted td {
  background: #cfe8ff !important;
}

#results td[id^="c6_r"] a {
  color: #185abd;
  font-weight: 600;
}

#messagelistfooter {
  background: #f8f9fb;
  border-top: 1px solid var(--americolor-border);
  color: var(--americolor-muted);
  min-height: 42px;
  padding: 4px 8px;
}

.resizer {
  background: transparent;
  height: 10px;
}

#preview {
  color: var(--americolor-text);
  min-height: 250px;
  padding: 16px;
}

#preview h2 {
  border-bottom: 1px solid var(--americolor-border);
  color: var(--americolor-text);
  font-size: 20px;
  font-weight: 600;
  margin: -2px 0 12px;
  padding-bottom: 10px;
  text-transform: none;
}

.messageheader {
  background: #f7f9fc;
  border-bottom: 1px solid var(--americolor-border);
  border-radius: 5px 5px 0 0;
  color: var(--americolor-text);
}

.messagecontents {
  background: #fff;
  color: var(--americolor-text);
}

/* Login page: simple company portal rather than a product splash page. */
body#loginpage {
  background: linear-gradient(135deg, #eef5fb 0%, #f8fafc 55%, #e8f3ff 100%);
  padding-top: 48px;
}

#logincontainer {
  text-transform: none;
}

#logo-lg {
  background: #fff;
  border-radius: 9px;
  box-shadow: 0 4px 18px rgba(15, 44, 74, 0.1);
  margin: 0 auto 28px;
  max-width: 650px;
  padding: 14px 20px;
  width: calc(100vw - 40px);
}

#logo-lg img {
  display: block;
  height: auto;
  margin: 0 auto;
  max-width: 100%;
}

.form-signin {
  border: 1px solid var(--americolor-border);
  border-radius: 9px;
  border-top: 5px solid var(--americolor-blue);
  box-shadow: 0 12px 32px rgba(15, 44, 74, 0.14);
  max-width: 420px;
  padding: 26px 30px 30px;
}

.form-signin h2 {
  color: var(--americolor-text);
  text-transform: none;
}

.form-signin .form-floating > .form-control::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

.form-signin .btn-primary {
  background: var(--americolor-blue);
  border-color: var(--americolor-blue);
  border-radius: 5px;
  font-weight: 600;
}

.compatibility {
  background: transparent !important;
  color: var(--americolor-muted) !important;
  max-width: 420px;
  text-align: center;
}

/* Complete black/charcoal mode shared by Search, Monitor, Administration,
 * Settings, forms, dialogs, tables, and message previews. */
html[data-theme="dark"] {
  background: #0b0d10;
  color-scheme: dark;
  --bs-body-bg: #0b0d10;
  --bs-body-color: #f5f7fa;
  --bs-border-color: #3b424b;
}

html[data-theme="dark"] body,
html[data-theme="dark"] body#loginpage {
  background: #0b0d10 !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] body#loginpage {
  background-image: radial-gradient(circle at top, #172433 0%, #0b0d10 58%) !important;
}

html[data-theme="dark"] #header,
html[data-theme="dark"] #main,
html[data-theme="dark"] #footer,
html[data-theme="dark"] .searchcontainer,
html[data-theme="dark"] .container-panes,
html[data-theme="dark"] .pane,
html[data-theme="dark"] .pane-upper,
html[data-theme="dark"] .pane-upper-content,
html[data-theme="dark"] #preview {
  background-color: #0b0d10 !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] #menu {
  background: #0f6cbd;
}

html[data-theme="dark"] h1,
html[data-theme="dark"] h2,
html[data-theme="dark"] h3,
html[data-theme="dark"] h4,
html[data-theme="dark"] h5,
html[data-theme="dark"] h6,
html[data-theme="dark"] p,
html[data-theme="dark"] label,
html[data-theme="dark"] legend,
html[data-theme="dark"] strong,
html[data-theme="dark"] .form-label,
html[data-theme="dark"] .col-form-label {
  color: #f5f7fa !important;
}

html[data-theme="dark"] small,
html[data-theme="dark"] .small,
html[data-theme="dark"] .form-text,
html[data-theme="dark"] .text-muted,
html[data-theme="dark"] .muted,
html[data-theme="dark"] .text-body-secondary {
  color: #b8c0ca !important;
}

html[data-theme="dark"] a {
  color: #72b7f2;
}

html[data-theme="dark"] a:hover,
html[data-theme="dark"] a:focus {
  color: #a8d5fa;
}

html[data-theme="dark"] .searchcontainer,
html[data-theme="dark"] .pane-upper,
html[data-theme="dark"] #preview {
  border-color: #3b4652;
}

html[data-theme="dark"] .card,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-body,
html[data-theme="dark"] .card-footer,
html[data-theme="dark"] .list-group-item,
html[data-theme="dark"] .accordion-item,
html[data-theme="dark"] .accordion-button,
html[data-theme="dark"] .offcanvas,
html[data-theme="dark"] .popover,
html[data-theme="dark"] .modal-content,
html[data-theme="dark"] .toast {
  background-color: #15181d !important;
  border-color: #3b424b !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] .modal-header,
html[data-theme="dark"] .modal-footer,
html[data-theme="dark"] .card-header,
html[data-theme="dark"] .card-footer {
  border-color: #3b424b !important;
}

html[data-theme="dark"] .dropdown-menu {
  background: #15181d !important;
  border-color: #3b424b !important;
}

html[data-theme="dark"] .dropdown-item {
  color: #f5f7fa !important;
}

html[data-theme="dark"] .dropdown-item:hover,
html[data-theme="dark"] .dropdown-item:focus {
  background: #203d58 !important;
  color: #fff !important;
}

html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] input[type="text"],
html[data-theme="dark"] input[type="email"],
html[data-theme="dark"] input[type="password"],
html[data-theme="dark"] input[type="number"],
html[data-theme="dark"] input[type="search"],
html[data-theme="dark"] textarea,
html[data-theme="dark"] select,
html[data-theme="dark"] .tagtext {
  background: #171a1f !important;
  border-color: #505965 !important;
  color: #fff !important;
}

html[data-theme="dark"] .form-control::placeholder,
html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #9da6b1 !important;
  opacity: 1;
}

/* Bootstrap floating labels must hide the placeholder until the field is active. */
html[data-theme="dark"] .form-floating > .form-control::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

html[data-theme="dark"] .form-floating > .form-control:focus::placeholder {
  color: transparent !important;
  opacity: 0 !important;
}

html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] input:focus,
html[data-theme="dark"] textarea:focus,
html[data-theme="dark"] select:focus {
  background: #1c2026 !important;
  border-color: #66b5f5 !important;
  box-shadow: 0 0 0 2px rgba(102, 181, 245, 0.22) !important;
  color: #fff !important;
}

html[data-theme="dark"] .btn-secondary {
  background: #3a424c;
  border-color: #59636f;
  color: #fff;
}

html[data-theme="dark"] .btn-secondary:hover,
html[data-theme="dark"] .btn-secondary:focus {
  background: #4a5561;
  border-color: #6a7683;
}

html[data-theme="dark"] .btn-light {
  background: #eef2f6;
  border-color: #eef2f6;
  color: #111;
}

html[data-theme="dark"] .btn-close {
  filter: invert(1) grayscale(100%) brightness(180%);
}

html[data-theme="dark"] .table {
  --bs-table-bg: #121519;
  --bs-table-color: #f5f7fa;
  --bs-table-border-color: #3b424b;
  --bs-table-striped-bg: #1a1e23;
  --bs-table-striped-color: #f5f7fa;
  --bs-table-hover-bg: #203d58;
  --bs-table-hover-color: #fff;
  background: #121519 !important;
  border-color: #3b424b !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] .table > :not(caption) > * > *,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td {
  background-color: inherit;
  border-color: #3b424b !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] .table-dark,
html[data-theme="dark"] .table-secondary,
html[data-theme="dark"] .table thead th {
  --bs-table-bg: #252a30;
  --bs-table-color: #fff;
  background: #252a30 !important;
  color: #fff !important;
}

html[data-theme="dark"] #results thead th {
  background: #252a30;
  border-bottom-color: #3b4652;
  color: #f3f3f3;
}

html[data-theme="dark"] #results .resultrow {
  background: #1f2429;
  color: #f3f3f3;
}

html[data-theme="dark"] #results .resultrow:nth-child(even) {
  background: #242a30;
}

html[data-theme="dark"] #results .resultrow:hover {
  background: #123b5d;
}

html[data-theme="dark"] #results .resultrow.highlighted,
html[data-theme="dark"] #results .resultrow.highlighted td {
  background: #174f78 !important;
  color: #fff !important;
}

html[data-theme="dark"] #results td[id^="c6_r"] a {
  color: #7dc4ff;
}

html[data-theme="dark"] #messagelistfooter,
html[data-theme="dark"] .messageheader {
  background: #252a30;
  border-color: #3b4652;
  color: #f5f7fa;
}

html[data-theme="dark"] .messagecontents {
  background: #101317 !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] #results tbody td {
  border-bottom-color: #343c44;
}

html[data-theme="dark"] .alert {
  background: #1b2731 !important;
  border-color: #496579 !important;
  color: #eef8ff !important;
}

html[data-theme="dark"] .alert-danger {
  background: #3a171b !important;
  border-color: #873a43 !important;
  color: #ffd9dd !important;
}

html[data-theme="dark"] .alert-success {
  background: #102d20 !important;
  border-color: #2e7655 !important;
  color: #c8f7df !important;
}

html[data-theme="dark"] #main .col[style*="background: #d9edf7"] {
  background: #163b52 !important;
  color: #a6dcff !important;
}

html[data-theme="dark"] .progress {
  background: #2b3138 !important;
}

html[data-theme="dark"] hr,
html[data-theme="dark"] .border,
html[data-theme="dark"] .border-top,
html[data-theme="dark"] .border-bottom {
  border-color: #3b424b !important;
}

html[data-theme="dark"] pre,
html[data-theme="dark"] code {
  background: #111419;
  color: #b9e2ff;
}

html[data-theme="dark"] .text-success {
  color: #69d69f !important;
}

html[data-theme="dark"] .text-danger,
html[data-theme="dark"] .text-error {
  color: #ff858f !important;
}

html[data-theme="dark"] .text-warning {
  color: #ffd166 !important;
}

html[data-theme="dark"] .text-bg-light,
html[data-theme="dark"] .bg-light {
  background: #1a1e23 !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] .form-signin {
  background: #15181d !important;
  border-color: #3b424b !important;
}

html[data-theme="dark"] .compatibility {
  color: #b8c0ca !important;
}

html[data-theme="dark"] #button_expert,
html[data-theme="dark"] #button_options {
  background: #252a30 !important;
  border-color: #505965 !important;
  color: #f5f7fa !important;
}

html[data-theme="dark"] #button_expert:hover,
html[data-theme="dark"] #button_expert:focus,
html[data-theme="dark"] #button_options:hover,
html[data-theme="dark"] #button_options:focus {
  background: #203d58 !important;
  border-color: #6ea8d9 !important;
  color: #ffffff !important;
}

/* Chart.js paints labels inside a canvas, so CSS text colors cannot reach them. */
html[data-theme="dark"] canvas {
  filter: brightness(1.35) contrast(1.04);
}

@media (max-width: 1000px) {
  #menu .branding_logo {
    max-height: 32px;
    max-width: 250px;
  }

  #menu .menulink {
    font-size: 14px;
    margin-left: 4px;
    padding: 8px 7px;
  }
}

@media (max-width: 760px) {
  #menu .branding_logo {
    max-width: 190px;
  }

  .searchcontainer {
    padding-left: 10px;
    padding-right: 10px;
  }

  #button_search,
  #button_expert,
  #button_options {
    font-size: 12px;
    margin-left: 3px;
  }

  .container-panes {
    padding-left: 8px;
    padding-right: 8px;
  }
}
