/*
 * Seino branch-office search (EN / ZH)
 * Content-only CSS for the following wrapper:
 * <div class="search-branch-encn"> ...page body content... </div>
 *
 * Load after Bootstrap and the existing /projk4 stylesheets.
 * No head/body/header/footer rules and no additional JavaScript are required.
 */

.search-branch-encn {
  --branch-blue: #004190;
  --branch-blue-hover: #003472;
  --branch-blue-soft: #eef5ff;
  --branch-text: #333;
  --branch-muted: #666;
  --branch-border: #d7dfe9;
  --branch-surface: #f3f5f8;
  --branch-white: #fff;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin: 0;
  padding-top: 120px;
  overflow-x: hidden;
  color: var(--branch-text);
  background: var(--branch-white);
  font-family: "Noto Sans", "Noto Sans SC", "Noto Sans JP", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}

.search-branch-encn *,
.search-branch-encn *::before,
.search-branch-encn *::after {
  box-sizing: border-box;
}

/* Override Bootstrap's fixed .container widths inside this component only. */
.search-branch-encn > .container,
.search-branch-encn > form > .container,
.search-branch-encn form > .container {
  width: 100% !important;
  max-width: 1200px !important;
  min-width: 0 !important;
  margin-right: auto !important;
  margin-left: auto !important;
  padding-right: 20px !important;
  padding-left: 20px !important;
}

.search-branch-encn [class*="col-"] {
  min-width: 0;
}

/* Main content */
.search-branch-encn .branchTitle {
  color: var(--branch-text);
}

.search-branch-encn h5.branchTitle {
  margin: 0 0 12px;
  color: var(--branch-blue);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.5;
}

.search-branch-encn h2.branchTitle {
  margin: 0;
  font-size: 30px;
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.search-branch-encn hr {
  margin: 28px 0 36px;
  border: 0;
  border-top: 1px solid var(--branch-border);
}

.search-branch-encn h4 {
  margin: 0 0 12px;
  font-size: 21px;
  font-size: clamp(21px, 2.6vw, 28px);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.search-branch-encn p {
  max-width: 100%;
  margin: 0 0 20px;
  overflow-wrap: anywhere;
}

.search-branch-encn #listDisp,
.search-branch-encn form > .container > div:nth-of-type(2) {
  min-width: 0;
  margin-top: 12px;
}

/* Current selection */
.search-branch-encn p.c {
  padding: 14px 18px;
  border-left: 4px solid var(--branch-blue);
  background: var(--branch-blue-soft);
  text-align: left;
  font-weight: 600;
}

/* Shared links and focus state */
.search-branch-encn a {
  color: var(--branch-blue) !important;
  text-underline-offset: .2em;
}

.search-branch-encn a:hover {
  color: var(--branch-blue-hover) !important;
}

.search-branch-encn a:focus-visible {
  border-radius: 2px;
  outline: 3px solid rgba(0, 65, 144, .28);
  outline-offset: 3px;
}

/* Prefecture selection */
.search-branch-encn .prefecture {
  width: 100% !important;
  max-width: 100%;
  margin: 0 0 20px;
  table-layout: fixed;
  border: 1px solid var(--branch-border) !important;
  border-collapse: collapse !important;
  background: var(--branch-white);
}

.search-branch-encn .prefecture th {
  padding: 15px 18px !important;
  border: 1px solid var(--branch-blue) !important;
  background: var(--branch-blue) !important;
  color: var(--branch-white);
  font-size: 19px;
  font-weight: 700;
  line-height: 1.4;
  text-align: left;
}

.search-branch-encn .prefecture td {
  height: 60px;
  padding: 0 !important;
  border: 1px solid var(--branch-border) !important;
  vertical-align: middle !important;
}

.search-branch-encn .prefecture td:has(> br:only-child) {
  background: var(--branch-surface);
}

.search-branch-encn .prefecture td > a {
  position: relative;
  display: flex;
  min-height: 60px;
  align-items: center;
  padding: 12px 42px 12px 18px;
  color: var(--branch-text) !important;
  font-weight: 600;
  text-decoration: none !important;
  overflow-wrap: anywhere;
  transition: color .2s ease, background-color .2s ease;
}

.search-branch-encn .prefecture td > a::after,
.search-branch-encn table.table td.list > a::after {
  position: absolute;
  width: 9px;
  height: 9px;
  border-top: 2px solid var(--branch-blue);
  border-right: 2px solid var(--branch-blue);
  content: "";
  transform: rotate(45deg);
}

.search-branch-encn .prefecture td > a::after {
  right: 18px;
}

.search-branch-encn .prefecture td > a:hover,
.search-branch-encn table.table td.list > a:hover {
  color: var(--branch-blue) !important;
  background: var(--branch-blue-soft);
}

/* Alphabet navigation on the city page */
.search-branch-encn .navSubMenu {
  display: flex;
  max-width: 100%;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
  margin: 24px 0;
  padding: 18px;
  border: 1px solid var(--branch-border);
  background: var(--branch-surface);
  text-align: left;
}

.search-branch-encn .navSubMenu a,
.search-branch-encn .navSubMenu font {
  display: inline-flex;
  min-width: 40px;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border: 1px solid var(--branch-border);
  background: var(--branch-white);
  color: var(--branch-blue) !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  line-height: 1;
  text-decoration: none !important;
}

.search-branch-encn .navSubMenu font {
  border-color: var(--branch-border);
  background: #e9e9e9;
  color: var(--branch-muted) !important;
}

.search-branch-encn .navSubMenu a:hover {
  border-color: var(--branch-blue);
  background: var(--branch-blue-soft);
}

.search-branch-encn .navSubMenu span {
  width: auto !important;
  margin-left: auto;
  background: transparent !important;
}

.search-branch-encn .navSubMenu span a {
  min-width: 240px;
  padding-right: 16px;
  padding-left: 16px;
}

/* City list and result detail tables */
.search-branch-encn table.table:not(.prefecture) {
  width: 100% !important;
  max-width: 100%;
  margin-bottom: 28px;
  border: 1px solid var(--branch-border) !important;
  border-collapse: collapse !important;
  background: var(--branch-white);
}

.search-branch-encn table.table:not(.prefecture) th,
.search-branch-encn table.table:not(.prefecture) td {
  padding: 14px 16px !important;
  border: 1px solid var(--branch-border) !important;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.search-branch-encn table.table:not(.prefecture) .tableHeader > th,
.search-branch-encn table.table:not(.prefecture) .tableHeader > td {
  border-color: var(--branch-blue) !important;
  background: var(--branch-blue) !important;
  color: var(--branch-white);
  font-size: 18px;
  font-weight: 700;
}

.search-branch-encn .tableHeader strong {
  color: var(--branch-white);
}

.search-branch-encn table.table td.list {
  width: auto !important;
  padding: 0 !important;
  text-align: left !important;
}

.search-branch-encn table.table td.list > a {
  position: relative;
  display: block;
  width: 100%;
  min-height: 54px;
  padding: 13px 44px 13px 18px;
  color: var(--branch-text) !important;
  font-weight: 600;
  text-decoration: none !important;
  overflow-wrap: anywhere;
}

.search-branch-encn table.table td.list > a::after {
  top: 50%;
  right: 20px;
  transform: translateY(-50%) rotate(45deg);
}

.search-branch-encn .inputHeader {
  width: 190px;
  background: var(--branch-blue-soft) !important;
  color: var(--branch-text);
  font-weight: 700;
}

.search-branch-encn .fas {
  margin-right: 8px;
  color: var(--branch-blue);
}

/* Secondary actions */
.search-branch-encn .align-center,
.search-branch-encn div.c {
  margin: 32px 0 56px;
  text-align: center;
}

.search-branch-encn .arrow01-left,
.search-branch-encn .closeWin {
  display: inline-flex;
  width: auto;
  max-width: 100%;
  min-width: 200px;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 22px;
  border: 1px solid var(--branch-blue);
  color: var(--branch-blue) !important;
  font-weight: 700;
  text-align: center;
  text-decoration: none !important;
  white-space: normal;
  transition: color .2s ease, background-color .2s ease;
}

.search-branch-encn .arrow01-left:hover,
.search-branch-encn .closeWin:hover {
  background: var(--branch-blue);
  color: var(--branch-white) !important;
}

@media (max-width: 768.98px) {
  .search-branch-encn {
    /*
     * The legacy shared stylesheet sets body { min-width: 600px; }.
     * Percentage widths therefore resolve against 600px on phones.
     * Use the actual viewport width without changing body/head styles.
     */
    width: 100vw;
    max-width: 100vw;
    padding-top: 64px;
  }

  .search-branch-encn > form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .search-branch-encn > .container,
  .search-branch-encn > form > .container,
  .search-branch-encn form > .container {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding-right: 16px !important;
    padding-left: 16px !important;
  }

  .search-branch-encn h2.branchTitle {
    font-size: 30px;
  }

  .search-branch-encn h4 {
    font-size: 21px;
  }

  .search-branch-encn hr {
    margin: 22px 0 28px;
  }

  /*
   * Prefectures: flatten the source table rows into one grid.
   * border-collapse no longer works once tr/td become grid/block elements,
   * so a 1px grid gap is used as the only separator. This prevents doubled
   * lines at source-row boundaries and keeps empty cells from disturbing SP.
   */
  .search-branch-encn .prefecture {
    display: block;
    width: 100%;
    padding: 1px !important;
    border: 0 !important;
    border-collapse: separate !important;
    background: var(--branch-border);
  }

  .search-branch-encn .prefecture tbody {
    display: grid;
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    background: var(--branch-border);
  }

  .search-branch-encn .prefecture tr,
  .search-branch-encn .prefecture tr:first-child {
    display: contents;
  }

  .search-branch-encn .prefecture tr:first-child th {
    display: block;
    width: auto;
    grid-column: 1 / -1;
    border: 0 !important;
  }

  .search-branch-encn .prefecture td {
    display: block;
    width: auto !important;
    height: auto;
    min-width: 0;
    border: 0 !important;
    background: var(--branch-white);
  }

  .search-branch-encn .prefecture td:not(:has(a)) {
    display: none;
  }

  /* If the source row ends with two empty cells, let its lone item fill the row. */
  .search-branch-encn .prefecture tr:last-child:has(> td:nth-child(2) > br:only-child) > td:first-child:has(a) {
    grid-column: 1 / -1;
  }

  .search-branch-encn .prefecture td > a {
    min-height: 56px;
    padding-left: 14px;
  }

  /* City alphabet navigation: six equal columns. */
  .search-branch-encn .navSubMenu {
    gap: 6px;
    padding: 12px;
  }

  .search-branch-encn .navSubMenu > a,
  .search-branch-encn .navSubMenu > font {
    min-width: 0;
    flex: 0 0 calc((100% - 30px) / 6);
    padding-right: 4px;
    padding-left: 4px;
  }

  .search-branch-encn .navSubMenu span {
    flex-basis: 100%;
    margin: 8px 0 0;
  }

  .search-branch-encn .navSubMenu span a {
    width: 100%;
    min-width: 0;
  }

  /* City list stays at the viewport width; HTML width="160" is neutralized. */
  .search-branch-encn table.table:has(td.list) {
    display: table;
    width: 100% !important;
    table-layout: fixed;
  }

  .search-branch-encn table.table:has(td.list) td.list,
  .search-branch-encn table.table:has(td.list) td.normal_value {
    width: auto !important;
    min-width: 0;
  }

  /*
   * Detail table becomes one two-column grid on SP.
   * The desktop source interleaves Hours and Deadline by row because both
   * headings use rowspan. Reorder the grid items so each section stays whole.
   */
  .search-branch-encn table.table:has(.inputHeader) {
    display: block;
    width: 100% !important;
    max-width: 100%;
    padding: 1px !important;
    border: 0 !important;
    overflow: hidden;
    background: var(--branch-border);
  }

  .search-branch-encn table.table:has(.inputHeader) tbody {
    display: grid;
    width: 100%;
    min-width: 0;
    grid-template-columns: minmax(112px, .85fr) minmax(0, 1.15fr);
    gap: 1px;
    background: var(--branch-border);
  }

  .search-branch-encn table.table:has(.inputHeader) tr {
    display: contents;
  }

  .search-branch-encn table.table:has(.inputHeader) th,
  .search-branch-encn table.table:has(.inputHeader) td {
    display: block;
    width: auto !important;
    min-width: 0;
    height: auto !important;
    border: 0 !important;
    background-color: var(--branch-white);
  }

  .search-branch-encn table.table:has(.inputHeader) .tableHeader > th {
    grid-column: 1 / -1;
    order: 10;
  }

  /* Address */
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(2) > * {
    order: 20;
  }

  /* Phone and fax become two ordinary label/value rows. */
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(3) > :nth-child(-n + 2) {
    order: 30;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(3) > :nth-child(n + 3) {
    order: 31;
  }

  /* Hours heading and its weekday/Saturday/holiday values. */
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > th:nth-child(1) {
    grid-column: 1 / -1;
    order: 40;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > td:nth-child(2),
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > td:nth-child(3) {
    order: 41;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(5) > :nth-child(-n + 2) {
    order: 42;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(6) > :nth-child(-n + 2) {
    order: 43;
  }

  /* Deadline heading and its weekday/Saturday/Sunday values. */
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > th:nth-child(4) {
    grid-column: 1 / -1;
    order: 50;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > td:nth-child(5),
  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(4) > td:nth-child(6) {
    order: 51;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(5) > :nth-child(n + 3) {
    order: 52;
  }

  .search-branch-encn table.table:has(.inputHeader) tr:nth-child(6) > :nth-child(n + 3) {
    order: 53;
  }
}

@media (max-width: 480px) {
  .search-branch-encn {
    padding-top: 48px;
  }

  .search-branch-encn .prefecture tbody {
    grid-template-columns: 1fr;
  }

  .search-branch-encn .arrow01-left,
  .search-branch-encn .closeWin {
    width: 100%;
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .search-branch-encn *,
  .search-branch-encn *::before,
  .search-branch-encn *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
  }
}

@media print {
  .search-branch-encn .navSubMenu,
  .search-branch-encn .align-center,
  .search-branch-encn .closeWindow {
    display: none !important;
  }
}


