/**
 * @file
 * Google CSE results styling — plain CSS (no build required).
 *
 * Override Google Programmable Search default styles to match
 * the existing Search API results design.
 */

/* -----------------------------------------------
   Global container
   ----------------------------------------------- */
.gsc-control-cse {
  padding: 0 !important;
  border: none !important;
  background-color: transparent !important;
  font-family: "Open Sans", sans-serif !important;
}

/* -----------------------------------------------
   Google search box – styled to match old exposed form
   ----------------------------------------------- */
.gsc-search-box {
  margin-bottom: 1.5rem !important;
  width: 100% !important;
  max-width: 100% !important;
  padding: 0 !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.gsc-search-box-tools {
  width: 100% !important;
}

/* Force table to full width */
.gsc-search-box table {
  width: 100% !important;
  border: none !important;
  border-collapse: collapse !important;
}

.gsc-search-box td {
  border: none !important;
  padding: 0 !important;
}

/* Input cell takes all remaining space */
.gsc-search-box td.gsc-input {
  width: 100% !important;
  padding-right: 0 !important;
  vertical-align: middle !important;
}

/* Button cell shrinks to fit */
.gsc-search-box td.gsc-search-button {
  width: 3rem !important;
  min-width: 3rem !important;
}

/* Hide the clear (X) button cell */
.gsc-search-box td.gsc-clear-button {
  display: none !important;
}

.gsc-input-box {
  border: 1px solid #9ca3af !important;
  border-right: 0 !important;
  border-radius: 0.25rem 0 0 0.25rem !important;
  height: 2.5rem !important;
  box-shadow: none !important;
  background: #fff !important;
  margin: 0 !important;
  padding: 0 !important;
  outline: none !important;
}

.gsc-input-box:focus-within {
  outline: none !important;
  box-shadow: none !important;
}

.gsc-input-box input.gsc-input,
table.gsc-search-box td.gsc-input .gsc-input-box input.gsc-input,
input.gsc-input {
  font-family: "Open Sans", sans-serif !important;
  font-size: 1rem !important;
  color: #223654 !important;
  padding: 0.375rem 0.75rem !important;
  background: none !important;
  background-color: transparent !important;
  background-image: none !important;
  outline: none !important;
  height: 100% !important;
  text-indent: 0 !important;
}

.gsc-input-box input.gsc-input:focus,
table.gsc-search-box td.gsc-input .gsc-input-box input.gsc-input:focus,
input.gsc-input:focus {
  outline: none !important;
  box-shadow: none !important;
}

/* Hide the X clear button inside Google input */
.gsib_b {
  display: none !important;
}

/* Remove Google watermark/loupe from input wrapper */
.gsib_a {
  padding: 0 !important;
}

.gsib_a,
.gsc-input-box,
.gsc-input-box table,
.gsc-input-box td {
  background-image: none !important;
  background: #fff !important;
}

/* Search button cell must be visible */
td.gsc-search-button,
.gsc-search-box td.gsc-search-button {
  display: table-cell !important;
  vertical-align: middle !important;
  width: 3rem !important;
  padding: 0 !important;
}

/* Search button – styled as loupe icon */
button.gsc-search-button-v2,
.gsc-search-button button.gsc-search-button-v2,
.gsc-search-button .gsc-search-button-v2,
td.gsc-search-button button {
  display: inline-block !important;
  border: 1px solid #9ca3af !important;
  border-left: 0 !important;
  border-radius: 0 0.25rem 0.25rem 0 !important;
  background-color: #fff !important;
  background-image: url('../../patterns/01-atoms/svg/svg/images/loupe-piv-fonce.svg') !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 20px 20px !important;
  width: 3rem !important;
  height: 2.5rem !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
  min-width: 3rem !important;
  box-sizing: border-box !important;
}

/* Hide Google's default search icon SVG */
button.gsc-search-button-v2 svg,
.gsc-search-button .gsc-search-button-v2 svg,
td.gsc-search-button button svg {
  display: none !important;
}

/* Hide Drupal's search form (we use Google's) */
form.search-form,
form#search-form {
  display: none !important;
}

/* -----------------------------------------------
   Hide duplicate "Search results" h2 from controller
   and Drupal's search form
   ----------------------------------------------- */
form.search-form + h2,
.item-list > h2:first-child {
  display: none !important;
}

/* -----------------------------------------------
   Results counter / info
   Matches: .search-result-info from views-view--search--page-1
   ----------------------------------------------- */
.gsc-result-info {
  font-family: "Roboto", sans-serif !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  text-transform: uppercase !important;
  color: #444 !important;
  padding: 1rem 0 0.5rem 0 !important;
  margin-bottom: 0.5rem !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid #223654 !important;
  letter-spacing: -0.75px !important;
  background: transparent !important;
}

/* -----------------------------------------------
   Results wrapper – remove Google's default borders
   ----------------------------------------------- */
.gsc-results {
  border: none !important;
}

.gsc-wrapper {
  border: none !important;
  box-shadow: none !important;
}

/* -----------------------------------------------
   Result items
   Matches: tw-py-5 tw-border-b tw-border-gray-200
   from views-view-unformatted--search--page
   ----------------------------------------------- */
.gsc-results .gsc-webResult.gsc-result,
.gsc-webResult.gsc-result {
  padding: 1.25rem 0 !important;
  border-top: none !important;
  border-left: none !important;
  border-right: none !important;
  border-bottom: 1px solid #c5cad2 !important;
  margin-bottom: 0 !important;
  background-color: transparent !important;
  box-shadow: none !important;
}

.gsc-results .gsc-webResult.gsc-result:last-child {
  border-bottom: none !important;
}

/* Override Google's default 8px divider height */
#google-cse-results .gsc-webResult-divider,
.gsc-results .gsc-webResult-divider,
.gsc-webResult.gsc-result .gsc-webResult-divider,
.gsc-webResult-divider {
  height: 1px !important;
}

/* Remove any table-based border/outline from Google results */
.gsc-table-result,
.gsc-table-cell-snippet-close,
.gsc-table-cell-thumbnail {
  border: none !important;
  padding: 0 !important;
}

/* -----------------------------------------------
   Result title
   Matches: h3 tw-text-xl tw-font-roboto tw-text-secondary
   from views-view-fields--search--page-1
   ----------------------------------------------- */
.gs-webResult .gs-title,
.gs-webResult .gs-title a,
.gs-webResult .gs-title a b,
.gs-webResult div.gs-title a {
  font-family: "Roboto", sans-serif !important;
  font-size: 1.25rem !important;
  font-weight: 500 !important;
  text-decoration: none !important;
  color: #095797 !important;
}

.gs-webResult .gs-title a:hover {
  text-decoration: underline !important;
}

/* -----------------------------------------------
   Result URL / visible URL – HIDDEN
   (not shown in the expected design)
   ----------------------------------------------- */
.gs-webResult .gs-visibleUrl,
.gs-webResult .gs-visibleUrl-short,
.gs-webResult .gs-visibleUrl-long,
.gs-webResult .gs-bidi-start-align.gs-visibleUrl,
.gs-webResult .gs-per-result-labels,
.gs-webResult cite,
.gs-webResult .gs-metadata {
  display: none !important;
}

/* -----------------------------------------------
   Result snippet / excerpt
   ----------------------------------------------- */
.gs-webResult .gs-snippet {
  font-family: "Open Sans", sans-serif !important;
  color: #223654 !important;
  font-size: 0.9375rem !important;
  line-height: 1.5 !important;
  margin-top: 0.25rem !important;
}

/* Highlighted search terms in snippet
   Matches: [&>strong]:tw-bg-[#dae6f0] [&>strong]:tw-px-1 */
.gs-webResult .gs-snippet b {
  display: inline !important;
  background-color: #dae6f0 !important;
  padding: 0 0.25rem !important;
  font-weight: 400 !important;
  color: #223654 !important;
}

/* -----------------------------------------------
   Result thumbnail image – hidden
   ----------------------------------------------- */
.gs-webResult .gs-image-box,
.gs-webResult .gs-image-box-result {
  display: none !important;
}

/* Force snippet cell to use full width */
.gsc-table-cell-snippet-close {
  width: 100% !important;
}

/* -----------------------------------------------
   Pagination
   ----------------------------------------------- */
.gsc-cursor-box {
  margin-top: 1.5rem !important;
  text-align: center !important;
}

.gsc-results .gsc-cursor-box {
  border: none !important;
}
 .gsc-results .gsc-cursor {
  display: -webkit-flex !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
}

 .gsc-cursor-container-previous {
  flex-grow: 0 !important;
  text-align: right !important;
  padding: 10px 0 !important;
}

 .gsc-cursor-container-next {
  flex-grow: 0 !important;
  text-align: left !important;
  padding: 10px 0 !important;
}

.gsc-cursor-page {
  font-family: "Open Sans", sans-serif !important;
  font-size: 0.9375rem !important;
  color: #095797 !important;
  padding: 0.25rem 0.5rem !important;
  border: 1px solid #c5cad2 !important;
  border-radius: 0.25rem !important;
  margin: 0 0.125rem !important;
  text-decoration: none !important;
  cursor: pointer !important;
  background-color: transparent !important;
}

.gsc-cursor-page:hover {
  background-color: #dae6f0 !important;
  border-color: #095797 !important;
}

.gsc-cursor-current-page {
  background-color: #095797 !important;
  color: #fff !important;
  border-color: #095797 !important;
  font-weight: 600 !important;
}

/* -----------------------------------------------
   Ads / promotions – hide
   ----------------------------------------------- */
.gsc-adBlock,
.gcsc-more-maybe-branding-root {
  display: none !important;
}

/* -----------------------------------------------
   Hide "Rechercher xxx sur Google" link block
   ----------------------------------------------- */
.gsc-trailing-more-results,
.gsc-webResult.gsc-result .gsc-trailing-more-results,
.gcsc-find-more-on-google-root,
.gcsc-find-more-on-google,
a.gcsc-find-more-on-google,
.gsc-results .gcsc-find-more-on-google-root,
#google-cse-results .gcsc-find-more-on-google-root,
#google-cse-results .gcsc-find-more-on-google {
  display: none !important;
}

/* -----------------------------------------------
   Branding / "powered by Google"
   ----------------------------------------------- */
.gcsc-branding {
  opacity: 0.5 !important;
  margin-top: 1rem !important;
}

/* -----------------------------------------------
   No results message
   ----------------------------------------------- */
.gs-no-results-result .gs-snippet {
  font-family: "Open Sans", sans-serif !important;
  font-size: 1rem !important;
  color: #223654 !important;
  background-color: transparent !important;
  border: none !important;
  padding: 1rem 0 !important;
}

/* (Drupal search form is hidden – we use Google's search box) */

/* -----------------------------------------------
   Remove Google's 700px max-width on the wrapper
   ----------------------------------------------- */
.gsc-above-wrapper-area {
  max-width: 100% !important;
  width: 100% !important;
  border: none !important;
}

/* -----------------------------------------------
   Force full width on all Google CSE elements
   ----------------------------------------------- */
#google-cse-results {
  max-width: 100%;
  width: 100% !important;
}

#google-cse-results .gsc-control-cse {
  max-width: 100% !important;
  width: 100% !important;
}

#google-cse-results .gsc-results-wrapper-overlay,
#google-cse-results .gsc-results-wrapper-visible,
#google-cse-results .gsc-wrapper,
#google-cse-results .gsc-resultsbox-visible,
#google-cse-results .gsc-resultsRoot,
#google-cse-results .gsc-results,
#google-cse-results .gsc-webResult,
#google-cse-results .gsc-result {
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

#google-cse-results table,
#google-cse-results .gsc-table-result {
  width: 100% !important;
  table-layout: fixed !important;
}

#google-cse-results .gsc-expansionArea {
  width: 100% !important;
}

/* -----------------------------------------------
   Header Google CSE searchbox-only widget
   ----------------------------------------------- */
.google-cse-header-form {
  width: 100% !important;
}

.google-cse-header-form .gsc-control-cse {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
}

.google-cse-header-form .gsc-search-box {
  margin: 0 !important;
  padding: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
}

.google-cse-header-form .gsc-search-box table {
  width: 100% !important;
}

.google-cse-header-form .gsc-input-box {
  border: 1px solid #9ca3af !important;
  border-right: 0 !important;
  border-radius: 0.25rem 0 0 0.25rem !important;
  height: 2.5rem !important;
  box-shadow: none !important;
  background: #fff !important;
  outline: none !important;
}

.google-cse-header-form .gsc-input-box:focus-within {
  outline: none !important;
  box-shadow: none !important;
}

.google-cse-header-form input.gsc-input {
  font-family: "Open Sans", sans-serif !important;
  font-size: 1rem !important;
  color: #223654 !important;
  padding: 0.375rem 0.75rem !important;
  background: none !important;
  background-image: none !important;
  height: 100% !important;
  text-indent: 0 !important;
  outline: none !important;
}

.google-cse-header-form input.gsc-input:focus {
  outline: none !important;
  box-shadow: none !important;
}

.google-cse-header-form .gsib_a {
  padding: 0 !important;
  background-image: none !important;
  background: #fff !important;
}

.google-cse-header-form .gsib_b {
  display: none !important;
}

.google-cse-header-form td.gsc-search-button {
  width: 3rem !important;
  min-width: 3rem !important;
  vertical-align: middle !important;
}

.google-cse-header-form button.gsc-search-button-v2 {
  border: 1px solid #9ca3af !important;
  border-left: 0 !important;
  border-radius: 0 0.25rem 0.25rem 0 !important;
  background-color: #fff !important;
  background-image: url('../../patterns/01-atoms/svg/svg/images/loupe-piv-fonce.svg') !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 20px 20px !important;
  width: 3rem !important;
  height: 2.5rem !important;
  padding: 0 !important;
  margin: 0 !important;
  cursor: pointer !important;
}

.google-cse-header-form button.gsc-search-button-v2 svg {
  display: none !important;
}

.google-cse-header-form td.gsc-clear-button {
  display: none !important;
}

/* Hide branding in header */
.google-cse-header-form .gcsc-branding {
  display: none !important;
}

