/* ==========================================
   EPFL Library – Unified Search Bars
   BEAST (red) + Infoscience (green)
   Shared styles for both search bars
   ========================================== */


/* ------------------------------------------
   Specific colors
   ------------------------------------------ */

#searchbar {
  --search-bg: #FF0000;       /* EPFL color */
  --search-button-hover: #E00000;   /* Slightly darker red for hover */
}

#infosciencebar {
  --search-bg: #00a79f;       /* Infoscience color */
  --search-button-hover: #007480;
}

/* ------------------------------------------
   Main container
   ------------------------------------------ */

#searchbar .epfl-searchbar-inner,
#infosciencebar .epfl-searchbar-inner {
  background: var(--search-bg);
  border-radius: 3px;
  padding: 1.1rem;
  box-shadow: 0 6px 18px rgba(0,0,0,0.15);
}

/* ------------------------------------------
   Main layout (desktop: single row)
   ------------------------------------------ */

#searchbar .epfl-searchbar-row,
#infosciencebar .epfl-searchbar-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: nowrap;
}

#searchbar .epfl-input-group,
#infosciencebar .epfl-input-group {
  display: flex;
  width: 100%;     /* take all available horizontal space */
  min-width: 0;    /* allow input to shrink below its content width if needed */
}

/* ------------------------------------------
   Input field
   ------------------------------------------ */

#searchbar .epfl-input,
#infosciencebar .epfl-input {
  width: 100%;
  border: none;
  border-radius: 3px 0 0 3px;
  height: 52px;
  padding: 0 16px;
  font-size: 1rem;
  outline: none;
  background: #ffffff;
}

#searchbar .epfl-input:focus,
#infosciencebar .epfl-input:focus {
  box-shadow: 0 0 0 2px rgba(0,0,0,.2);
}

/* ------------------------------------------
   Search button styling
   Subtle hover/active effects
   ------------------------------------------ */
#searchbar .epfl-search-button,
#infosciencebar .epfl-search-button {
  position: relative;
  overflow: hidden;
  margin-left: 1px;
  height: 52px;
  flex: 0 0 auto;
  width: 42px;
  min-width: 42px;
  padding: 0;
  border-radius: 0 3px 3px 0;
  border: 1px solid rgba(0,0,0,0.15);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  
  background: var(--search-bg);
  transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}

#searchbar .epfl-search-button svg,
#infosciencebar .epfl-search-button svg {
  width: 23px;
  height: 23px;
}

#searchbar .epfl-search-button:hover,
#infosciencebar .epfl-search-button:hover {
    background-color: var(--search-button-hover);
}

#searchbar .epfl-search-button:hover::before,
#infosciencebar .epfl-search-button:hover::before {
  left: 110%;
  opacity: 1;
}

#searchbar .epfl-search-button:active,
#infosciencebar .epfl-search-button:active {
  transform: translateY(0px);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.12),
    0 5px 12px rgba(0,0,0,0.18);
}

/* Keyboard focus visibility (accessibility) */
#searchbar .epfl-search-button:focus,
#infosciencebar .epfl-search-button:focus {
  outline: none;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.18),
    0 6px 14px rgba(0,0,0,0.18),
    0 0 0 3px rgba(255,255,255,0.35);
}

/* ------------------------------------------
   Links — aligned right (maximize input width)
   ------------------------------------------ */

#searchbar .epfl-links,
#infosciencebar .epfl-links {
  display: flex;
  align-items: center;
  gap: 24px;
  white-space: nowrap;
  justify-content: space-around !important;
  margin-left: auto; /* pousse les liens à droite => input le plus large possible */
}

#searchbar .epfl-links a,
#infosciencebar .epfl-links a {
  color: #ffffff;
  font-weight: 500;
  height: 52px;
  display: flex;
  align-items: center;
    
  text-decoration-line: underline;
  text-decoration-color: transparent; /* underline invisible by default */
  text-decoration-thickness: .08em;
  text-underline-offset: .2em;
  transition: text-decoration-color .2s ease-in-out,color .2s ease-in-out;

}

#searchbar .epfl-links a:hover,
#infosciencebar .epfl-links a:hover {
  text-decoration: underline;
}

/* ------------------------------------------
   Infoscience-specific: select dropdown
   ------------------------------------------ */
#infosciencebar .epfl-select {
  border: none;
  height: 52px;
  padding: 0 12px;
  border-radius: 0px 3px 3px 0px;
  background: #ffffff;
  color: #000;
  max-width: 220px;       /* desktop: prevent select from being too wide */
  font-size: 0.95rem;     /* slightly smaller font for select */
  line-height: 1.1;       /* reduce line height to better vertically center options */
}

/* Vertical divider inside Infoscience search bar */
#infosciencebar .epfl-select {
  border: none;
  height: 52px;
  padding: 0 12px;
  background: #ffffff;
  color: #000;
  border-left: 1px solid rgba(0, 0, 0, 0.08); /* divider */
  border-radius: 0;
  max-width: 220px;
}

/* When select is present, input should not have left rounded corners */
#infosciencebar .epfl-select + .epfl-input {
  border-radius: 0;          /* middle element */
}

/* Ensure button keeps right rounded corners (already the case) */

/* ------------------------------------------
   Responsive adjustments
   ------------------------------------------ */
#searchbar .form-row,
#infosciencebar .form-row {
  align-items: center;
}

#searchbar .epfl-links,
#infosciencebar .epfl-links {
  justify-content: flex-end; /* Desktop: links aligned right */
}

@media (max-width: 991px) { /* < lg */
  #searchbar .epfl-links {
    justify-content: flex-start; /* Tablet/mobile: links aligned left */
    margin-top: 0px;
  }
  #searchbar .epfl-searchbar-inner {
        padding-bottom: 0px
    }
}

@media (max-width: 767px) { /* < md */
  #infosciencebar .epfl-links {
    justify-content: flex-start; /* mobile: links aligned left */
    margin-top: 0px;
  }
  #infosciencebar .epfl-searchbar-inner {
        padding-bottom: 0px
  }

  /* Mobile: transform select into a compact icon-only dropdown */
  #infosciencebar .epfl-select {
    width: 46px;
    min-width: 46px;
    max-width: 46px;
    height: 52px;

    padding: 0;              /* no padding so the background centers well */
    font-size: 0;            /* hides the selected label */
    line-height: 52px;       /* keeps native control height stable */

    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;

    background-color: #ffffff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 16px;

    border: none;
    border-left: 1px solid rgba(0,0,0,0.15);
    border-right: 1px solid rgba(0,0,0,0.15);
    border-radius: 0;
  }

  /* Ensure options remain readable */
  #infosciencebar .epfl-select option {
    font-size: 1rem; /* restores readable option text */
    color: #000;
  }

  /* Ensure input text can be readable on mobile */
  #searchbar .epfl-input,
  #infosciencebar .epfl-input {
    font-size: 0.875rem;
  }
}