/**
 * Atom on Joomla 4, 5 and 6.
 *
 * Atom's layout overrides use UIkit (qx-) classes, but some markup still comes
 * from Joomla itself: form fields rendered by the form API, extra login buttons,
 * system messages, icons. That markup carries Bootstrap 5 class names, and Atom
 * does not load Bootstrap, so this file gives those classes the same look as
 * their qx- counterparts (values mirror quix-core.css). Loaded on Joomla 4+ only.
 *
 * Every rule skips Quix content (.quix wraps Quix pages and shortcodes): some
 * Quix elements use the same class names (Dual Button's .btn, Pricing Table's
 * .badge, the Form element's .form-check and .form-text) and must look as before.
 */

/* Screen-reader text: without Bootstrap, visually-hidden would show. */
.tpl_atom .visually-hidden:not(:focus):not(:active):not(.quix *),
.tpl_atom .sr-only:not(:focus):not(:active):not(.quix *) {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tpl_atom .d-none:not(.quix *),
.tpl_atom [hidden]:not(.quix *) { display: none !important; }

/* Fields */
.tpl_atom .form-control:not(.quix *),
.tpl_atom .form-select:not(.quix *) {
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  margin: 0;
  padding: 0 10px;
  border-radius: 0;
  font: inherit;
  background: #fff;
  color: #666;
  border: 1px solid #e5e5e5;
  transition: .2s ease-in-out;
  transition-property: color, background-color, border;
}
.tpl_atom input.form-control:not(.quix *),
.tpl_atom .form-select:not([multiple]):not([size]):not(.quix *) { height: 40px; vertical-align: middle; }
.tpl_atom textarea.form-control:not(.quix *),
.tpl_atom .form-select[multiple]:not(.quix *) { padding: 6px 10px; vertical-align: top; }
.tpl_atom .form-control:focus:not(.quix *),
.tpl_atom .form-select:focus:not(.quix *) { outline: 0; border-color: #1e87f0; }
.tpl_atom .form-control:disabled:not(.quix *),
.tpl_atom .form-select:disabled:not(.quix *) { background-color: #f8f8f8; color: #999; }
.tpl_atom .form-control:not(.quix *)::placeholder { color: #999; }
.tpl_atom .form-select:not([multiple]):not([size]):not(.quix *) {
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 20px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg width='24' height='16' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='%23666' d='M12 1L9 6h6zM12 13L9 8h6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 100% 50%;
}
.tpl_atom .form-control.invalid:not(.quix *),
.tpl_atom .form-control:invalid.form-control-danger:not(.quix *),
.tpl_atom .invalid .form-control:not(.quix *) { color: #f0506e; border-color: #f0506e; }
.tpl_atom .form-control-feedback:not(.quix *),
.tpl_atom .invalid-feedback:not(.quix *),
.tpl_atom label.invalid:not(.quix *) { color: #f0506e; font-size: .875rem; }

.tpl_atom .form-check:not(.quix *) { margin-bottom: 5px; }
.tpl_atom .form-check-input:not(.quix *) { margin: -4px 6px 0 0; vertical-align: middle; }
.tpl_atom .form-check-inline:not(.quix *) { display: inline-block; margin-right: 15px; }
.tpl_atom .form-label:not(.quix *),
.tpl_atom .control-label label:not(.quix *) { color: #333; font-size: .875rem; }
.tpl_atom .control-group:not(.quix *) { margin-bottom: 20px; }
.tpl_atom .form-text:not(.quix *),
.tpl_atom small.form-text:not(.quix *) { display: block; margin-top: 5px; color: #999; font-size: .875rem; }

.tpl_atom .input-group:not(.quix *) { display: flex; align-items: stretch; width: 100%; }
.tpl_atom .input-group > .form-control:not(.quix *),
.tpl_atom .input-group > .form-select:not(.quix *) { flex: 1 1 auto; width: 1%; min-width: 0; }
.tpl_atom .input-group > .btn:not(.quix *),
.tpl_atom .input-group > .input-group-text:not(.quix *) { flex: none; }
.tpl_atom .input-group-text:not(.quix *) {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid #e5e5e5;
  background: #f8f8f8;
  color: #666;
}

/* Buttons */
.tpl_atom .btn:not(.quix *) {
  display: inline-block;
  box-sizing: border-box;
  margin: 0;
  padding: 0 30px;
  border: 1px solid #e5e5e5;
  border-radius: 0;
  background-color: transparent;
  color: #333;
  font: inherit;
  font-size: .875rem;
  line-height: 38px;
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  vertical-align: middle;
  cursor: pointer;
  transition: .1s ease-in-out;
  transition-property: color, background-color, border-color;
}
.tpl_atom .btn:hover:not(.quix *) { border-color: #b2b2b2; text-decoration: none; }
.tpl_atom .btn-primary:not(.quix *),
.tpl_atom .btn-success:not(.quix *) { background-color: #1e87f0; border-color: transparent; color: #fff; }
.tpl_atom .btn-primary:hover:not(.quix *),
.tpl_atom .btn-success:hover:not(.quix *) { background-color: #0f7ae5; color: #fff; }
.tpl_atom .btn-danger:not(.quix *) { background-color: #f0506e; border-color: transparent; color: #fff; }
.tpl_atom .btn-danger:hover:not(.quix *) { background-color: #ee395b; color: #fff; }
.tpl_atom .btn-link:not(.quix *) { border-color: transparent; color: #1e87f0; text-transform: none; padding: 0; }
.tpl_atom .btn-sm:not(.quix *) { padding: 0 15px; line-height: 28px; }
.tpl_atom .btn:disabled:not(.quix *) { background-color: transparent; color: #999; border-color: #e5e5e5; cursor: default; }
.tpl_atom .w-100:not(.quix *) { width: 100%; }

/* Fieldsets */
.tpl_atom fieldset:not(.quix *) { border: none; margin: 0 0 20px; padding: 0; min-width: 0; }
.tpl_atom legend:not(.quix *) { width: 100%; padding: 0; margin-bottom: 15px; font-size: 1.25rem; line-height: 1.4; color: inherit; }

/* Tables and lists core still prints */
.tpl_atom .table:not(.quix *) { border-collapse: collapse; border-spacing: 0; width: 100%; margin-bottom: 20px; }
.tpl_atom .table th:not(.quix *),
.tpl_atom .table td:not(.quix *) { padding: 12px; vertical-align: top; text-align: left; }
.tpl_atom .table > tbody > tr:not(.quix *) { border-top: 1px solid #e5e5e5; }
.tpl_atom .list-unstyled:not(.quix *) { padding-left: 0; list-style: none; }

/* Icons: Joomla's icon-* map onto Font Awesome, which Atom loads on 4+. */
.tpl_atom [class^="icon-"]:not(.quix *),
.tpl_atom [class*=" icon-"]:not(.quix *) { display: inline-block; }

/* Joomla 4+ hides the "Advanced search" panel with Bootstrap's collapse. */
.tpl_atom .collapse:not(.show):not(.quix *) { display: none; }
.tpl_atom .collapsing:not(.quix *) { height: 0; overflow: hidden; transition: height .35s ease; }

/* Utilities core's category-children layouts still print. */
.tpl_atom .float-end:not(.quix *) { float: right; }
.tpl_atom .float-start:not(.quix *) { float: left; }
.tpl_atom .badge:not(.quix *) {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 500px;
  background: #1e87f0;
  color: #fff;
  font-size: 11px;
  vertical-align: middle;
  line-height: 0;
}

/* Atom's frame uses the Quix section grid: a 1200px box with content 30px in,
   so header, body, footer and Quix sections all share one edge. */
.tpl_atom .atom-container {
  box-sizing: border-box;
  max-width: 1200px;
  padding-left: 30px;
  padding-right: 30px;
}

/* Header items sit flush with the container edge, like the body and footer. */
.tpl_atom #header .qx-navbar-toggle { padding-right: 0; }
/* The desktop menu's wrapper stays in the row on phones; its gap would push the toggle in. */
.tpl_atom #header > .qx-navbar > .qx-navbar-right { gap: 0; }

/* Joomla's own pages: the body container already sets the width and side gutters. */
.tpl_atom .atom-content { padding: 40px 0; }
@media (min-width: 960px) {
  .tpl_atom .atom-content { padding: 60px 0; }
}

/* Passkey login button: core prints a bare SVG that would fill the width. */
.tpl_atom [class*="plg_system_webauthn_login_button"] svg:not(.quix *),
.tpl_atom [class*="plg_system_webauthn_login_button"] img:not(.quix *) {
  width: 30px;
  height: auto;
  margin-right: 8px;
  vertical-align: middle;
}
.tpl_atom .input-password-toggle:not(.quix *) { padding: 0 12px; }

/* Sidebars share the content column's top and bottom spacing. */
.tpl_atom .sidebar:not(.quix *) { padding: 40px 0; }
@media (min-width: 960px) {
  .tpl_atom .sidebar:not(.quix *) { padding: 60px 0; }
}
.tpl_atom .sidebar .moduletable:not(.quix *) + .moduletable { margin-top: 40px; }
.tpl_atom .sidebar .moduletable:not(.quix *) > h3:first-child { margin: 0 0 15px; }

/* Read-more buttons carry the article title; let long ones wrap cleanly. */
.tpl_atom .readmore .qx-button:not(.quix *) {
  padding: 8px 20px;
  line-height: 1.5;
  white-space: normal;
  text-align: left;
}
