/* Header Search — SP: full width / PC: short on top-right */
#header-in .lc-header-search{
  display:flex !important;
  align-items:center;
  gap:8px;
  margin:4px 0;
  width:100%;
}

/* Wrapper & form */
#header-in .lc-header-search .search-form,
#header-in .lc-header-search .lc-search-form{
  display:flex;
  gap:8px;
  width:100%;
  margin:0;
}

/* Input field */
#header-in .lc-header-search .search-field,
#header-in .lc-header-search input[type="search"],
#header-in .lc-header-search input[type="text"],
#header-in .lc-header-search input[name="s"]{
  flex:1;
  width:100%;
  max-width:none;
  height:40px;
  line-height:40px;
  padding:0 12px;
  border:2px solid var(--color-primary);
  border-radius:12px;
  background:#fff;
  font-size:14px;
  box-sizing:border-box;
}

#header-in .lc-header-search .search-field::placeholder{
  color:#9aa3ab;
}

/* Hide submit/button (Enter to search) */
#header-in .lc-header-search .search-submit,
#header-in .lc-header-search button[type="submit"],
#header-in .lc-header-search input[type="submit"],
#header-in .lc-header-search .search-button,
#header-in .lc-header-search .search-icon{
  display:none !important;
}

/* ===== PC: right-short, with optional positioning classes/offset ===== */
@media (min-width:1025px){
  #header-in .lc-header-search{
    width:auto;
    margin:0;
    margin-left:auto; /* right by default */
    flex:0 0 auto;
    --lc-search-offset-x: 0px;
    transform: translateX(var(--lc-search-offset-x));
  }

  #header-in .lc-header-search form{
    width:auto;
    flex:0 0 auto;
  }

  /* Fixed length — change width and flex to desired value */
  #header-in .lc-header-search .search-field,
  #header-in .lc-header-search input[type="search"],
  #header-in .lc-header-search input[type="text"],
  #header-in .lc-header-search input[name="s"]{
    width:300px !important;   /* ← 調整：例 280 / 420 / 480 */
    max-width:none !important;
    min-width:0 !important;
    flex:0 0 300px !important;/* 同じ値に揃える */
    box-sizing:border-box;
  }

  /* Position switches via body class */
  body.lc-search-left #header-in .lc-header-search{
    margin-left:0 !important;
    margin-right:auto !important;
    transform:none;
  }

  body.lc-search-center #header-in{
    display:flex;
    align-items:center;
  }
  body.lc-search-center #header-in .logo-header{ margin-right:0; }
  body.lc-search-center #header-in .lc-header-search{
    margin-left:0 !important;
    margin-right:0 !important;
    position:relative;
    left:50%;
    transform: translateX(calc(-50% + var(--lc-search-offset-x)));
  }

  /* Slightly tighter header on PC (optional) */
  #header-in{
    padding:6px 18px;
    gap:8px;
  }
  #header-in .lc-header-search input[type="search"],
  #header-in .lc-header-search input[name="s"]{
    height:36px;
    line-height:36px;
    padding:0 12px;
  }
}

/* ===== SP / Tablet: force full-width and tighter header ===== */
@media (max-width:1024px){
  #header-in{
    display:flex !important;
    flex-direction:column !important;
    gap:6px !important;
    padding:6px 12px !important;
  }

  #header-in .lc-header-search,
  #header-in .lc-header-search .search-form,
  #header-in .lc-header-search .search-box,
  #header-in .lc-header-search .input-box{
    width:100% !important;
    max-width:none !important;
    flex:1 1 100% !important;
  }

  /* Ensure input fills available width */
  #header-in .lc-header-search .search-field,
  #header-in .lc-header-search input[type="search"],
  #header-in .lc-header-search input[type="text"]{
    display:block !important;
    width:100% !important;
    max-width:none !important;
    flex:1 1 100% !important;
  }

  /* Prevent inline-form layout issues */
  #header-in .lc-header-search form{ display:flex !important; }

  /* Tighter sizes for compact mobile look */
  #header-in{
    padding:6px 10px !important;
    gap:6px !important;
  }
  #header-in .logo-header,
  #header-in .site-name{
    margin-top:0 !important;
    margin-bottom:0 !important;
    padding:0 !important;
  }
  #header-in .lc-header-search{ margin:0 !important; width:100% !important; }
  #header-in .lc-header-search input[type="search"],
  #header-in .lc-header-search input[name="s"],
  #header-in .lc-header-search .search-field{
    height:34px !important;
    line-height:34px !important;
    padding:0 10px !important;
    border-radius:8px !important;
    font-size:14px !important;
  }

  /* Nav spacing adjustments if needed */
  #navi{ margin-top:6px !important; padding-top:0 !important; }
  #navi .navi-in{ padding:0 6px !important; }
}